YttriLab / A-SOID

An active learning platform for expert-guided, data efficient discovery of behavior.
Other
55 stars 7 forks source link

Error during "Create labeled Video" #75

Closed Mijar007 closed 8 months ago

Mijar007 commented 8 months ago

Describe the bug After prediction, I tried to create a labeled video. The frame extraction step worked. Pushing the "Create labeled Video" afterwards raised the following error:

IndexError: index 1828 is out of bounds for axis 0 with size 1828
Traceback:
File "C:\ProgramData\anaconda3\envs\asoid\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)
File "C:\Users\Rabenstein\Python\A-SOID-main\asoid\app.py", line 328, in <module>
    main()
File "C:\Users\Rabenstein\Python\A-SOID-main\asoid\app.py", line 317, in main
    F_predict.main(ri=ri, config=st.session_state['config'])
File "C:\Users\Rabenstein\Python\A-SOID-main\asoid\apps\F_predict.py", line 824, in main
    just_annotate_video(annot_vid_path.replace('mp4', 'npy'),
File "C:\Users\Rabenstein\Python\A-SOID-main\asoid\apps\F_predict.py", line 543, in just_annotate_video
    annotate_video(video_path, framerate, annotation_classes,
File "C:\Users\Rabenstein\Python\A-SOID-main\asoid\apps\F_predict.py", line 516, in annotate_video
    cv2.putText(rgb_im, f'{annotation_classes[int(predictions_match[j])]}',

Expected behavior No error and video creation

Screenshots

image

image

Desktop (please complete the following information): Win 11 pro, 10.0.22631, x64, German language MS Edge used as Browser

Project Config (please post the content of the corresponding config.ini file) [Project] PROJECT_TYPE = DeepLabCut PROJECT_NAME = Mar-11-2024_test4 PROJECT_PATH = C:\Users\Rabenstein/Desktop/asoid_output FRAMERATE = 24 KEYPOINTS_CHOSEN = Nose, Front_Right_1, Front_Right_2, Front_Left_1, Front_Left_2, Rear_Right_1, Rear_Right_2, Rear_Left_1, Rear_Left_2, Midline_Front, Midline_Center, Midline_Rear EXCLUDE_OTHER = False FILE_TYPE = csv INDIVIDUALS_CHOSEN = single animal CLASSES = Wiggle, other MULTI_ANIMAL = False IS_3D = False

[Data] DATA_INPUT_FILES = GOPR0612DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0613DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0614DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0615DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0616DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0617DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0618DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0619DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0620DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0621DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0622DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0623DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0624DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0625DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0626DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0627DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0628DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0629DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0630DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0631DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0632DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0633DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0634DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0635DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0636DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0637DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0638DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0639DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0640DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0641DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0642DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0643DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0644DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0645DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0646DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0647DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0648DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0649DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0650DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0651DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0652DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0653DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0654DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0655DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0656DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0657DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0658DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0659DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0660DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv, GOPR0661DLC_resnet50_Wiggle_TestJan26shuffle1_100000.csv LABEL_INPUT_FILES = GOPR0612.avi_No focal subject.tsv, GOPR0613.avi_No focal subject.tsv, GOPR0614.avi_No focal subject.tsv, GOPR0615.avi_No focal subject.tsv, GOPR0616.avi_No focal subject.tsv, GOPR0617.avi_No focal subject.tsv, GOPR0618.avi_No focal subject.tsv, GOPR0619.avi_No focal subject.tsv, GOPR0620.avi_No focal subject.tsv, GOPR0621.avi_No focal subject.tsv, GOPR0622.avi_No focal subject.tsv, GOPR0623.avi_No focal subject.tsv, GOPR0624.avi_No focal subject.tsv, GOPR0625.avi_No focal subject.tsv, GOPR0626.avi_No focal subject.tsv, GOPR0627.avi_No focal subject.tsv, GOPR0628.avi_No focal subject.tsv, GOPR0629.avi_No focal subject.tsv, GOPR0630.avi_No focal subject.tsv, GOPR0631.avi_No focal subject.tsv, GOPR0632.avi_No focal subject.tsv, GOPR0633.avi_No focal subject.tsv, GOPR0634.avi_No focal subject.tsv, GOPR0635.avi_No focal subject.tsv, GOPR0636.avi_No focal subject.tsv, GOPR0637.avi_No focal subject.tsv, GOPR0638.avi_No focal subject.tsv, GOPR0639.avi_No focal subject.tsv, GOPR0640.avi_No focal subject.tsv, GOPR0641.avi_No focal subject.tsv, GOPR0642.avi_No focal subject.tsv, GOPR0643.avi_No focal subject.tsv, GOPR0644.avi_No focal subject.tsv, GOPR0645.avi_No focal subject.tsv, GOPR0646.avi_No focal subject.tsv, GOPR0647.avi_No focal subject.tsv, GOPR0648.avi_No focal subject.tsv, GOPR0649.avi_No focal subject.tsv, GOPR0650.avi_No focal subject.tsv, GOPR0651.avi_No focal subject.tsv, GOPR0652.avi_No focal subject.tsv, GOPR0653.avi_No focal subject.tsv, GOPR0654.avi_No focal subject.tsv, GOPR0655.avi_No focal subject.tsv, GOPR0656.avi_No focal subject.tsv, GOPR0657.avi_No focal subject.tsv, GOPR0658.avi_No focal subject.tsv, GOPR0659.avi_No focal subject.tsv, GOPR0660.avi_No focal subject.tsv, GOPR0661.avi_No focal subject.tsv ROOT_PATH = None

[Processing] LLH_VALUE = 0.1 ITERATION = 0 MIN_DURATION = 0.4 TRAIN_FRACTION = 0.1 MAX_ITER = 100 MAX_SAMPLES_ITER = 40 CONF_THRESHOLD = 0.7 N_SHUFFLED_SPLIT = None

Additional context Add any other context about the problem here.

JensBlack commented 8 months ago

Thanks for reporting with that detail!

I will take a look at the corresponding lines.

In the meantime: Can you verify that the pose file is matching the video file you uploaded?

Mijar007 commented 8 months ago

Thank you for your answer. Yes the video matches the pose file. I also tried the labeled video from DLC. It also raised the error. When I drop the video in the upload area, the button tells me, that it will start the extraction of 1828 frames. However, 1830 frames are in the output folder after extraction. If I look at the video properties, it tells me, that the frame rate is 23.98 frames/s. image

Could this cause the error, since A-SOiD detects the Video with a frame rate of 24 frames/s?

Mijar007 commented 8 months ago

I just deleted the last two extracted frames from the extraction folder to match the real number of extracted frames with the planned ones displayed on the extraction button. Now the video creation worked.