yiskw713 / video_feature_extractor

27 stars 3 forks source link

question about file format #3

Closed zhangguangxun closed 4 years ago

zhangguangxun commented 4 years ago

In your link, the dataset MSR-VTT is in mp4 however in your code the formation of videos should be in hdf5. Does it mean I need to change the mp4 video into hdf5 firstly?

yiskw713 commented 4 years ago

Hi zhangguangxun,

Thank you for visiting my repo. Yes, you need to convert mp4 video into hdf5 or images (png, jpg). This is because loading images or hdf5 files is faster than loading mp4 when extracting features and training models. You can convert mp4 video with utils/generate_video_hdf5.py or utils/generate_video_jpg.py. So please run these codes first.

Thanks.

zhangguangxun commented 4 years ago

Thanks a lot for your quick reply

zhangguangxun commented 4 years ago

Sorry to interrupt you again. I was confused when I was trying to run generate_video_hdf5.py. I found the type of dir_path and dst_path is Path when I run this

python utils/generate_video_hdf5.py dir_path=./data/MSRVTT/TrainValVideo dst_path=./data/MSRVTT/TrainValVideohdf5/ dataset=msrvtt

The error is that argparse toke dir_path=./data/MSRVTT/TrainValVideo as the dir_path rather than ./data/MSRVTT/TrainValVideo If I remove the keyword as

python utils/generate_video_hdf5.py ./data/MSRVTT/TrainValVideo/ ./data/MSRVTT/TrainValVideohdf5/ dataset=msrvtt

The code will run but it seems that nothing had happened. So do you have some suggestions to the above question? Or how can I pass the Path type variable in Shell. Thanks a lot.

zhangguangxun commented 4 years ago

The error for the first situation is that

Traceback (most recent call last):
  File "utils/generate_video_hdf5.py", line 133, in <module>
    class_dir_paths = [x for x in sorted(args.dir_path.iterdir())]
  File "/home/zhangguangxun/anaconda3/envs/exp_env/lib/python3.6/pathlib.py", line 1081, in iterdir
    for name in self._accessor.listdir(self):
  File "/home/zhangguangxun/anaconda3/envs/exp_env/lib/python3.6/pathlib.py", line 387, in wrapped
    return strfunc(str(pathobj), *args)
FileNotFoundError: [Errno 2] No such file or directory: 'dir_path=./data/MSRVTT/TrainValVideo'
yiskw713 commented 4 years ago

Hi zhangguangxu

I think the second one is correct, but I think all of the keywords should be removed. You seemed to assign dataset=msrvtt to args.dataset. Please try to run the below

python utils/generate_video_hdf5.py ./data/MSRVTT/TrainValVideo/ ./data/MSRVTT/TrainValVideohdf5/ msrvtt
zhangguangxun commented 4 years ago

Thanks~~~

hayachiq commented 3 years ago

can you please help me with bellow error Traceback (most recent call last): File "utils/generate_video_hdf5.py", line 128, in status_list = Parallel(n_jobs=args.n_jobs, backend='threading')( File "C:\Users\u6778\Miniconda3\lib\site-packages\joblib\parallel.py", line 1054, in call self.retrieve() File "C:\Users\u6778\Miniconda3\lib\site-packages\joblib\parallel.py", line 933, in retrieve self._output.extend(job.get(timeout=self.timeout)) File "C:\Users\u6778\Miniconda3\lib\multiprocessing\pool.py", line 771, in get raise self._value File "C:\Users\u6778\Miniconda3\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, kwds)) File "C:\Users\u6778\Miniconda3\lib\site-packages\joblib_parallel_backends.py", line 595, in call return self.func(*args, *kwargs) File "C:\Users\u6778\Miniconda3\lib\site-packages\joblib\parallel.py", line 262, in call return [func(args, kwargs) File "C:\Users\u6778\Miniconda3\lib\site-packages\joblib\parallel.py", line 262, in return [func(*args, *kwargs) File "utils/generate_video_hdf5.py", line 25, in video_process p = subprocess.run(ffprobe_cmd, capture_output=True) File "C:\Users\u6778\Miniconda3\lib\subprocess.py", line 489, in run with Popen(popenargs, **kwargs) as process: File "C:\Users\u6778\Miniconda3\lib\subprocess.py", line 854, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\u6778\Miniconda3\lib\subprocess.py", line 1307, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

yiskw713 commented 3 years ago

@hayachiq Thanks for visiting my repo. To convert mp4 videos to hdf5, you need to install FFmpeg and FFprobe. Please install them and try again.

hayachiq commented 3 years ago

@yiskw713 thank you for your fast reply ... sadly it didnt work after installing FFmpeg and FFprobe i got the same error.

yiskw713 commented 3 years ago

@hayachiq sorry, i don't know why it doesn't work... My codes support not only hdf5 but also image files such as jpg and png. So please try to convert mp4 videos to jpg images using tools like opencv.

hayachiq commented 3 years ago

its ok dear thank you for your kind help

hayachiq commented 3 years ago

hi :) it turns out it needed OS restart for ffmpeg installation worked successfully now thank you