harvitronix / five-video-classification-methods

Code that accompanies my blog post outlining five video classification methods in Keras and TensorFlow
https://medium.com/@harvitronix/five-video-classification-methods-implemented-in-keras-and-tensorflow-99cad29cc0b5
MIT License
1.18k stars 478 forks source link

Error on 2_extract_files #22

Closed michael20at closed 7 years ago

michael20at commented 7 years ago

Hi, would love to try out the classification methods, but sadly I get an error on 2_extract_files:

Traceback (most recent call last): File "2_extract_files.py", line 99, in main() File "2_extract_files.py", line 96, in main extract_files() File "2_extract_files.py", line 38, in extract_files video_parts = get_video_parts(video_path) File "2_extract_files.py", line 76, in get_video_parts filename = parts[3] IndexError: list index out of range

Did everything in the readme beforehand, all modules are installed and uptodate (I think?)!

Thank you for your help!

michael20at commented 7 years ago

Solved it myself, problem was windows filesystem, since 2_extract_files is made for linux filesystem and got confused with // and .

For anyone interested, I changed:

line 28 to: folders = ['train/', 'test/']

and changed get_video_parts to:

def get_video_parts(video_path): """Given a full path to a video, return its parts.""" parts = video_path.split('\') filename = parts[2] filename_no_ext = filename.split('.')[0] classname = parts[1] train_or_test = parts[0] return train_or_test, classname, filename_no_ext, filename

nicknick2020 commented 7 years ago

Your suggestion got me 99% of the way there but I had to change this line of get_video_parts:

parts = video_path.split('\')

There should be two \s instead of one. I don't know why but this site seems to delete the 2nd \ in these comments. Hope this helps the next user!

harvitronix commented 7 years ago

Thanks for following up on this @nbiller and @michael20at. I'm pretty ignorant to Windows path handling!