umyelab / LabGym

Quantify user-defined behaviors.
GNU General Public License v3.0
64 stars 5 forks source link

issue with "train categorizers" #78

Closed vzimmern closed 7 months ago

vzimmern commented 9 months ago

Thanks for a wonderful piece of programming. It has been absolutely transformative in our research project on gene therapy in mice. I was really struggling to get anywhere with DeepLabCut and your piece of programming has helped our project along immensely.

I have a question about the "training categorizer" step. I am on a Macintosh laptop in a Python virtual environment. LabGym installs correctly and runs smoothly until I get to this step.

Here is the setup:

Capture d’écran 2023-11-22 à 3 38 19 PM

And the error in Terminal is:

Capture d’écran 2023-11-22 à 3 39 01 PM

I am struggling to make sense of the error. I am happy to provide any other information needed in order to get an answer.

best, Vincent Zimmern, MS, MD

Capture d’écran 2023-11-22 à 3 38 19 PM Capture d’écran 2023-11-22 à 3 39 01 PM
yujiahu415 commented 9 months ago

Hi Vincent,

Thank you for the nice comments! This issue may be because too few examples in certain behavior category. But I need more information to be sure. So how many pairs of behavior examples in each behavior category (folder)? Can you also double check the behavior examples to see whether they are all in pairs (one animation + one pattern image, with the same name but different file extension)? Thanks!

vzimmern commented 9 months ago

There were 2 behavior types that had fewer than 100 pairs -- one only had 1 pair and the other had 21 pairs. What's the minimum number of behaviors that are needed?

Thanks again not only for such a nice piece of useful code (I'm raving about it to my colleagues) but also for such quick responses on Github.

yujiahu415 commented 9 months ago

You need to at least have 10 pairs of examples for each category to enable the training. You can either add in more training examples or just delete that category if its frequency is also very low in your videos to analyze. Generally, the more training examples, the higher accuracy of the Categorizer.

yujiahu415 commented 9 months ago

By the way, I saw that you included body parts in pattern images with the STD of 0. You probably could try higher STD, like 50. Higher STD typically reduces unnecessary details of the body parts and may enhance the learning efficiency. But since you already generated and sorted the examples with STD as 0, you may first try Categorizer with different complexity and input size, if the training accuracy is not satisfying.

vzimmern commented 9 months ago

Thanks for the quick response and great advice. I will try to find a different video that has more of the missing behavior (the one with only 1 pair). Can't thank you enough for this excellent code.