gsig / charades-algorithms

Activity Recognition Algorithms for the Charades Dataset
http://allenai.org/plato/charades/
201 stars 96 forks source link

Error when running pytorch main.py #11

Closed wxy1224 closed 6 years ago

wxy1224 commented 6 years ago

Hi gsig, thanks for sharing this project. I just ran into this error when executing python main.py in the pytorch directory.

Traceback (most recent call last): File "main.py", line 59, in main() File "main.py", line 49, in main top1,top5 = trainer.train(train_loader, model, criterion, optimizer, epoch, opt) File "/net/10.79.12.41/vision/u/xw1/charades-algorithms/pytorch/train.py", line 80, in train for i, (input, target, meta) in enumerate(part(loader)): File "/net/10.79.12.41/vision/u/xw1/charades-algorithms/pytorch/train.py", line 77, in part return itertools.islice(x, int(len(x)*args.train_size)) File "/vision/u/xw1/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 417, in iter return DataLoaderIter(self) File "/vision/u/xw1/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 242, in init self._put_indices() File "/vision/u/xw1/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 290, in _put_indices indices = next(self.sample_iter, None) File "/vision/u/xw1/anaconda3/lib/python3.6/site-packages/torch/utils/data/sampler.py", line 119, in iter for idx in self.sampler: File "/vision/u/xw1/anaconda3/lib/python3.6/site-packages/torch/utils/data/sampler.py", line 50, in iter return iter(torch.randperm(len(self.data_source)).long())

I see that this is caused by dataloader providing 0 training data. My opts.py is set up as the followings:

--data : "{Path}/Charades_v1_features_flow" --dataset : "charadesflow" --train-file and --val-file are also set to the correct csv files

Is there anything I'm missing in opts.py or any thoughts on how I could solve this error? Thanks a lot!

gsig commented 6 years ago

Hi there, This error is indeed complaining that your training dataset is empty. Which is likely because it didn't find any images in the folders. Did you check the log file to see where it is trying to construct your dataset? You can share the log file and I can take a look.

Also, I used python 2.7, so it's possible that there is something different in python 3.6

wxy1224 commented 6 years ago

log.txt Thanks, here's my log file. The code runs fine when dataset is specified to "fake", but reports error when running with "charadesflow" or "charadesrgb". I would agree it is the problem with finding dataset. And my data path is the one that contains all the video folders, so I'm assuming this one should be correct. image

Update: I tried to print inside "prepare" function in "datasets/charadesflow.py", and it seems that this function is not getting called, I guess this is incorrect.

gsig commented 6 years ago

Thanks! Can you also clear your caches (probably ./cache/test/*.pkl) and the run it, and send the logfile so we see what is happening in the data loading routines.

wxy1224 commented 6 years ago

log.txt Thanks for the advice, I just removed the pkl files and ran again and here's the log. It seems that it's running fine before it saves the pkl files.

gsig commented 6 years ago

Ah. Is this the numpy/txt features for flow? The code is expecting the optical flow images themselves (also available on the website). We provide Two-Stream features as well for RGB/Flow, and I suspect this might be those? If not, can you show me the output of: 'ls /vision/u/xw1/data/charades/Charades_v1_features_flow/U1DE4'?

wxy1224 commented 6 years ago

I see, I was using the two-stream features, I'll download the images and try running again, thank you!

gsig commented 6 years ago

Good luck! Also, keep in mind that training the flow network takes much longer than the RGB network, and requires much more IO. For most research you might have more luck using focusing on training RGB networks while you are experimenting with different things. You can see the examples for using ResNet152 etc as the RGB architecture, which gives pretty good performance.