facebookresearch / VMZ

VMZ: Model Zoo for Video Modeling
Apache License 2.0
1.04k stars 156 forks source link

Feature extraction tutorial error #123

Open WurmD opened 3 years ago

WurmD commented 3 years ago

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?

dutran commented 3 years ago

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

WurmD commented 3 years ago

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

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

dutran commented 3 years ago

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