Closed 0lm closed 5 years ago
Well, I will try this weekend, and give you the feedback.
The machines in my lab do not always have SSD, and the pipeline of [image reading -> extract frames -> send images to PyTorch/TensorFlow] is too slow. So we tend to convert videos to frames in advance. And, after converting, there are too many jpg/png files, so we merge the images to one solid file (hdf5/lmdb) for PyTorch/Caffe/TensorFlow. ----That's why this tool.
In summary:
If you have ONLY ONE video, only for extracting images, ffmpeg
please.
If you have 1000+ video, for training CNNs, please try this tool.
oh i see. so the problem was, i couldnt use this tool with only 1 video in the first place, since its made for at least 2, thats why i got strange results? thanks for the answer and sorry for my late reply.
Sorry, tooooo busy to reply.
I mean, it sure can process only one video. But if you have only one video, it's more convenient to use ffmpeg commands directly.
Here is my config file:
{
"meta": {
"class_num": 1,
"class_name": [
"only_one_class"
]
},
"annotation": {
"label1_abcdefg": {
"path": "/Users/haoyu/screen_record.mov",
"class": 1
}
}
}
... And here is the command:
> python video2frame.py anno.json --fps 10 --db_type FILE
... And finally, the result:
/Users/haoyu/screen_record.mov : OK
100%|█████████████████████████████████████████████| 1/1 [00:10<00:00, 10.49s/it]
Processed 1 videos
All success! Congratulations!
All Done!
hello unfortunately i am not an advanced user in python. but i successfully make use of python scripts, mostly by reading instructions, experimenting and looking into the internet if i am stuck. i successfully installed an enviroment and all dependencies with anaconda3. i downloaded the video2frame repo and opened it via python inside the conda enviroment, by linking it to the path of video2frame.py, created a json by copying and pasting your example, but i edited the video paths and delited the 2nd class since i have only 1 video, and set up the amount of fps per second. unfortunately it always gives me json errors. am i doing anything wrong? i gues i didnt really get how to setup the json. and besides i wondered how to even put an output path to the command, since i have no idea where the output will be. strangely after the rrors the command onyly creates a very small (maybe 500 KB) big hdf5 file by default.
Example of what i did: (video2frame env) >> python D:/path/to/video2frame.py D:/path/to/dataset.json --fps 10 the dataset.json was cereated by me. i copied and pasted the template on the github description here, chaned class num to 1, deleted all stuff regarding to class 2 (since i use only 1 video) and then tried to run that command. but i got a few line errors in decype.py (somethng like that it was called) when it tried to read the json.
so to sum it up: how exactly do i mae video2frame extract 10 frames per second from start time 150sec of the video to 460sec from a 2000 sec long video, and set up the output path myself to get png (in the best case) or jpg output files instead of hdf5 data files.
and besides i wondered whats the benefit in using video2frame compared to directly using ffmpeg to get frames from a video?
if anyone should ever have time to answer: thanks in advance for trying to help me out.