StevenLiuWen / ano_pred_cvpr2018

Official implementation of Paper Future Frame Prediction for Anomaly Detection -- A New Baseline, CVPR 2018
435 stars 126 forks source link

evaluate.py / mio.py: TypeError: 'NoneType' object is not iterable #3

Closed Santana18 closed 6 years ago

Santana18 commented 6 years ago

First thank you for your interesting publication and well documented code example. I had some path errors, which I bandaid-fixed by hard-coding relative paths.

  File "/home/Code/ano_pred_cvpr2018-master/Codes/evaluate.py", line 126, in __load_ucsd_avenue_subway_gt abnormal_events = scio.loadmat(mat_file, squeeze_me=True)['gt']

  File "/home/anaconda3/envs/deeplearning/lib/python3.6/site-packages/scipy/io/matlab/mio.py", line 141, in loadmat 

MR, file_opened = mat_reader_factory(file_name, appendmat, **kwargs)

  File "/home/anaconda3/envs/deeplearning/lib/python3.6/site-packages/scipy/io/matlab/mio.py", line 64, in mat_reader_factory 

byte_stream, file_opened = _open_file(file_name, appendmat)

TypeError: 'NoneType' object is not iterable

Worked after replacing it with:

abnormal_events = scio.loadmat('../Data/avenue/avenue.mat', squeeze_me=True)['gt']

Next path error afterwards was:

FileNotFoundError: [Errno 2] No such file or directory: '/public/home/gaoshenghua/liuwen/datasets/avenue/testing/frames'

Replacing all absolute paths with relative paths fixed this one.

StevenLiuWen commented 6 years ago

@Santana18 Thanks for your notification. I have corrected the 'DATA_DIR' in evaluate.py. DATA_DIR = '../Data If all datasets are located in 'Data' folder, including training and testing frames, as well as the gt mat file, it will work.

Santana18 commented 6 years ago

Works out of the box for me now. Thanks!