YttriLab / B-SOID

Behavioral segmentation of open field in DeepLabCut, or B-SOID ("B-side"), is a pipeline that pairs unsupervised pattern recognition with supervised classification to achieve fast predictions of behaviors that are not predefined by users.
GNU General Public License v3.0
190 stars 54 forks source link

IndexError: list index out of range #16

Closed unetzjuser closed 3 years ago

unetzjuser commented 4 years ago

First of all, thanks a lot for this nice contribution!

I encountered a problem when predicting new datasets. When I run this command: data_new, feats_new, labels_fslow, labels_fshigh = bsoid_py.main.run(PREDICT_FOLDERS)

There is an "IndexError".

In [3]: data_new, feats_new, labels_fslow, labels_fshigh = bsoid_py.main.run(PRE ...: DICT_FOLDERS)

Well, I did not copy the processed here.


IndexError Traceback (most recent call last)

in ----> 1 data_new, feats_new, labels_fslow, labels_fshigh = bsoid_py.main.run(PREDICT_FOLDERS) ~/Software/Deep Learning/B-SOiD/bsoid_py/main.py in run(predict_folders) 62 with open(os.path.join(OUTPUT_PATH, str.join('', ('bsoid_', MODEL_NAME, '.sav'))), 'rb') as fr: 63 behv_model, scaler = joblib.load(fr) ---> 64 data_new, feats_new, labels_fslow, labels_fshigh = bsoid_py.classify.main(predict_folders, scaler, FPS, behv_model) 65 filenames = [] 66 all_df = [] ~/Software/Deep Learning/B-SOiD/bsoid_py/classify.py in main(predict_folders, scaler, fps, behv_model) 167 plot_feats(feats_new, labels_fslow) 168 if GEN_VIDEOS: --> 169 videoprocessing.main(VID_NAME, labels_fslow[ID], FPS, FRAME_DIR) 170 return data_new, feats_new, labels_fslow, labels_fshigh ~/Software/Deep Learning/B-SOiD/bsoid_py/utils/videoprocessing.py in main(vidname, labels, fps, output_path) 154 def main(vidname, labels, fps, output_path): 155 vid2frame(vidname, labels, fps, output_path) --> 156 create_labeled_vid(labels, crit=3, counts=5, frame_dir=output_path, output_path=SHORTVID_DIR) 157 return 158 ~/Software/Deep Learning/B-SOiD/bsoid_py/utils/videoprocessing.py in create_labeled_vid(labels, crit, counts, frame_dir, output_path) 121 sort_nicely(images) 122 fourcc = cv2.VideoWriter_fourcc(*'mp4v') --> 123 frame = cv2.imread(os.path.join(frame_dir, images[0])) 124 height, width, layers = frame.shape 125 rnges = [] IndexError: list index out of range Where is the problem? Is this because the DIR path is too long? Thank you very much!
runninghsus commented 3 years ago

Hi @unetzjuser

Might I recommend using the bsoid_app? It is better maintained and it might just solve your issue.

unetzjuser commented 3 years ago

Thanks for your reply! I will try it.