sgoldenlab / simba

SimBA (Simple Behavioral Analysis), a pipeline and GUI for developing supervised behavioral classifiers
https://simba-uw-tf-dev.readthedocs.io/
GNU General Public License v3.0
273 stars 137 forks source link

Files are not created. #264

Closed BarakMalul closed 1 year ago

BarakMalul commented 1 year ago

Describe the bug Files are not created despite the message seems valid

To Reproduce Steps to reproduce the behavior: when appending boris csv files that are seems to be perfectly matched with the format of a project that in tests folder in your repository, the next text appears but no files created at all:

"Processing BORIS for 0 file(s)... Found 7 annotated behaviors in 16 files with C:/Users/Barak Malul/OneDrive/Documents/boris annotiations/MyDesk/Ready directory The following behavior annotations where detected in the boris directory: start recording full circle on restrainer - half head sync half circle stop recording on restrainer - full SIMBA COMPLETE: BORIS annotations appended to dataset and saved in project_folder/csv/targets_inserted directory (elapsed time: 0.2269s) 🚀"

but no files created following to it at all. also happening when pressing "skip outline correction" - everything seems to be valid but no files created

Expected behavior files will be created as requested

Desktop (please complete the following information):

Additional context "in addition when trying to press "label behaviour" and "select video", then adding new video the next error pop up: simba error: c:/users/barak malul/onedrive/documents/new folder\project1\project_folder\logs\video_info.csv is not a valid file path 🚨"

sronilsson commented 1 year ago

Hi @BurakMulal - thanks for reporting!

This suggest that although SimBA finds your BORIS files and your annotated behaviors inside of them, the first part of the message Processing BORIS for 0 file(s)… suggests that SimBA doesn’t find any files to append these annotations to. If you check inside your project_folder/csv/features_extracted directory, do you have any files representing your videos there? To create these files, click to extract features before appending your annotations using this menu as documented HERE

image

The second issue, with the missing video_info.csv file: This file is created when you use this menu below as documented HERE. It stores, among other things, the pixels per millimeter of each video so we can standardize movements and velocities across videos with slightly shifted camera locations.

image
BarakMalul commented 1 year ago

Thank you for the quick support!

regerd to the first issue, when i press "extract featurs" i get in response: "SIMBA COMPLETE: Loaded project C:/Users/Barak Malul/OneDrive/Documents/empathy/project_folder/project_config.ini 🚀 Pose-estimation body part setting for feature extraction: 2 animals 20 body-parts"

and in the cmd i get: "(simba-test) C:\Users\Barak Malul>simba Exception in thread Thread-1: Traceback (most recent call last): File "C:\ProgramData\anaconda3\envs\simba-test\lib\threading.py", line 916, in _bootstrap_inner self.run() File "C:\ProgramData\anaconda3\envs\simba-test\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "C:\ProgramData\anaconda3\envs\simba-test\lib\site-packages\simba\SimBA.py", line 681, in run_feature_extraction feature_extractor = feature_extractor_classesself.pose_setting KeyError: '20'"

and regard to your question, in project_folder/csv/features_extracted directory there are no files created at all.

regard to the second issue, indeed i created a csv file by that screen named video_info but i keep getting the same error.

sronilsson commented 1 year ago

Thanks @BarakMalul - I will insert some better error msgs here..

This error comes from SimBA looking in your project_config.ini under section [create ensemble settings] and option [pose_estimation_body_parts] and it looks like it finds the value 20. Not sure how this happened but 20 is not a valid entry. It's matching this entry to a class using THIS dictionary and you see 20 is not a valid key. In your case [create ensemble settings][pose_estimation_body_parts] should read user_defined as below (if you have 2 animals and 20 body-parts).

image

For the missing c:/users/barak malul/onedrive/documents/new folder\project1\project_folder\logs\video_info.csv file, can you confirm if it exists in the project or not in your project? It should be created when you click the SAVE DATA button in the last screengrab in my prior reply at the top left of the window.

BarakMalul commented 1 year ago
  1. It is looks like when I redefined pose_estimation_body_parts = user_defined, the problem solved, and the extracting frame move forward to another problem: "SIMBA VIDEO PARAMETERS FILE ERROR: SimBA could not find CollectedData_chen in the video_info.csv file. Make sure all videos analyzed are represented in the project_folder/logs/video_info.csv file. 🚨"

"CollectedData_chen" include only the parameter and the data from DLC project in the desired format as I know, and not info about the video at all, so It's hard for me to understand the essence of the error.

  1. For the missing c:/users/barak malul/onedrive/documents/new folder\project1\project_folder\logs\video_info.csv file - it is exist in this url adress, but the error below keep showing up: "simba error: c:/users/barak malul/onedrive/documents/new folder\project1\project_folder\logs\video_info.csv is not a valid file path 🚨""
sronilsson commented 1 year ago
  1. It is looks like when I redefined pose_estimation_body_parts = user_defined, the problem solved, and the extracting frame move forward to another problem: "SIMBA VIDEO PARAMETERS FILE ERROR: SimBA could not find CollectedData_chen in the video_info.csv file. Make sure all videos analyzed are represented in the project_folder/logs/video_info.csv file. 🚨" "CollectedData_chen" include only the parameter and the data from DLC project in the desired format as I know, and not info about the video at all, so It's hard for me to understand the essence of the error.

When you click to extract features, SimBA trawls all the CSVs inside your project_folder/csv/outlier_corrected_movement_location folder. It finds a CSV file called CollectedData_chen. It then looks inside the project_folder/logs/video_info.csv, in the left-most column named video, for a row entry called CollectedData_chen to grab your registered pixels-per-millimeter for this video. It then fails, because in your project_folder/logs/video_info.csv file, there is no video registered as CollectedData_chen. Just a note: I think the CollectedData is a prefix for DLC files holding human-annotations, not pose-estimation predictions as expected by SimBA? I may be wrong though..

  1. For the missing c:/users/barak malul/onedrive/documents/new folder\project1\project_folder\logs\video_info.csv file - it is exist in this url adress, but the error below keep showing up:
"simba error: c:/users/barak malul/onedrive/documents/new folder\project1\project_folder\logs\video_info.csv is not a valid file path 🚨""

Which version of SimBA are you running? Remind me - this error happens when you click to skip outlier correction? The error in (1) suggests that the file is there.

BarakMalul commented 1 year ago
  1. from your answer I understand that I might be using wrond the DLC files. I took this file (CollectedData_chen.csv) from training-datasets folder in DLC project, then made it in the same fromat as in the repository:(tests/data/test_projects/mouse_open_field/project_folder/csv/input_csv), but I indeed didn't have any predictive values, because DLC didn't create them, so I kept the values empty. It might be the problem?

2.I'm using SimBA v.1.60.1 , when I click to skip outlier correction there is no error message at all

sronilsson commented 1 year ago

Hi @BarakMalul - if the probability p columns are all left empty, I think SimBA will all force them to zero... but there might be other issues. Typically you'd want to import a file with predictions, from DLC they have one of these substrings in the file-names often: “DLC_” , “DeepCut”, "dlc_resnet50", "dlc_resnet_50", "dlc_dlcrnetms5", "dlc_effnet_b0", "dlc_resnet101".

BarakMalul commented 1 year ago

I'll try to make it more detailed so w'll succeed in solving it.I trained Model at DLC for pose estimation. in addition I have annotiations on totally different videos from BORIS. now I want to use both of them to create calssifier on the specific behaviours annotiated in BORIS files. what should I watch carfully to avoid the mistake that bloking my from succeed in training the classifiers?

Few question that I have: Which of the videos should I load to the project(those which relate to boris or DLC project)? which files of DLC should I load? the config? what else?

Thank you!

sronilsson commented 1 year ago

Hi @BarakMalul - your BORIS annotations and pose-estimation data has to come from the same videos, there has to be a relationship with the tracking data and your annotated behaviors otherwise SimBA and the ML classifiers can't find correlations.

BarakMalul commented 1 year ago

So the labled data & videos which were inserted to the DLC model have to be identical as the boris annotiations? or maybe if I analyze the videos which the annotiations in BORIS are based on through the DLC trained model and take the output it will work?

sronilsson commented 1 year ago

Yes the BORIS annotated videos have to go through the DLC trained model, you don't have to label body-parts key-points in the BORIS annotated videos.

BarakMalul commented 1 year ago

Just to make sure I understand you - I should insert the videos that the BORIS annotiations was made on to the DLC model i trained in order to to analyze them > then take the analyzed data per each video (the csv or h5 file?) and add it to the SimBA project. is it correct?

sronilsson commented 1 year ago

Yes, that is correct!

BarakMalul commented 1 year ago

Thank you so much for the detailed explanations and the willing to help. I appriciate it!