kenshohara / video-classification-3d-cnn-pytorch

Video classification tools using 3D ResNet
MIT License
1.1k stars 260 forks source link

main.py file generates different sized .txt files #46

Closed katelgote closed 5 years ago

katelgote commented 5 years ago

I have run this file successfully. For videos in a folder, it sometimes generates files with dict format and sometimes tuple. What is the reason for it? I tested this issue on Arrest030_x264.mp4 video. 1) Earlier I got 14.3 MB file with tuple format and later got 3.3 MB file with dict format. 2) This tuple format (14.3 MB file) had only 213 vectors(each with 512 dim) while dict format (3.3 MB file) had 540 vectors(each with dim 512) which was as expected (= no. of frames / 16) 3) I got to know about the format by writing this code in ipython2:- a = open('Arrest030_x264.txt', 'r').read() a = a[1:-1] a = ast.literal_eval(a) print type(a) 4) Also, by running this code on same file again gives different values. Is this randomness due to ffmpeg? 5) Also, in this main.py line18, what's the significance of 112 in opt.sample_size = 112 ?

katelgote commented 5 years ago

The following change need to be done:- In main.py file, you should put the outputs = [] line inside the for loop which goes for all the input_files. Earlier if this not done, was causing to store the previous video's features along with the current ones and thus the succeeding generated files had increasing file size. Thus, one need to empty the outputs variable. Thank You