facebookresearch/VMZ

Feature extraction tutorial error

WurmD opened this issue · 3 comments

WurmD commented

python3 data/create_video_db.py --list_file sample_videos.csv --output_file my_lmdb_data --use_list 1 --use_video_id 1 --use_start_frame 1

yields

TypeError
'/home/dario/temp/datasets/ADD/Anomaly-Videos/Abuse/Abuse001_x264.mp4' has type str, but expected one of: bytes

at https://github.com/facebookresearch/VMZ/blob/master/c2/data/create_video_db.py#L86

                if not use_list:
                    with open(file_name, mode='rb') as file:
                        video_data = file.read()
                else:
                    video_data = file_name

                tensor_protos = caffe2_pb2.TensorProtos()
                video_tensor = tensor_protos.protos.add()
                video_tensor.data_type = 4  # string data
>>              video_tensor.string_data.append(video_data)

video_data is indeed a str, since video_data = file_name given use_list

I'm uncertain what to do now. Do you need more information? Can you reproduce this?

this is an error by python3 vs python 2 incompatible in term of string data type.

WurmD commented

Oh.. I didn't realize this repo used python2..

Is there an updated version of this repo for python3 @dutran ?

We plan to have an update on that. For now, a simple fix should be video_data.encode('utf-8')