Closed DorianBattivelli closed 4 years ago
Ok, I found the topic in your FAQ. I'll follow the the Batch pre-process videos in SimBA tutorial.
Hi @DorianBattivelli - yes it's to do with all body-parts falling on the same X/Y co-ordinates. Happy you found it.
There are two types of heatmaps - one that requires features and one that doesn't.
The one that does require features plots heatmaps representing the time/location of animals engaging in classified behaviours and is accessed in the visualization tab.
The one that doesn't require features plots heatmaps representing the time spend in locations and is accessed in ROI tab:
@sgoldenlab Thank you for the answer. Indeed I tried this function, but it does not work neither. Here what appear in my terminal:
Ah could be another .avi / .mp4 issue. Let me check.
Nope, it works fine regardless of mp4 / avi.
I think the program has troubles finding the resolution of your video in your logs/video_info.csv
file. Does your video_info.csv contain the resolution width and height for all videos like this?
Yes, here one file for one set of videos:
Ah thanks - I'm not sure why - but the heading seems to have moved one row? It now starts at row two, whereas SimBA expects the heading in row 1. Does it work if you move it up?
I think it is because I converted it in xlsx file to make easier the lecture on the screenshot, but the original csv starts from row 1:
Thanks - let me check this again when I get to a computer. Might be that I can replicate it by using the auto argument or playing more with the bin size.
@DorianBattivelli - would you happen to have any files in your outlier_corrected_movement_location folder which is not represented in your video_info.csv file?
Not sur to understand what you mean :/
The files in my outlier_corrected_movement_location folder are the same than the ones in my video_info.csv file:
That's what I meant, it looks like it should!
As I can't replicate it here, I wonder if you can help me by inserting a line in your code and tell me what's printed out?
In this file:
Could you insert a new line on Line 41 which would read like this?
At least of these guys for some reason is going to be zero in your setup and it would help knowing which one it is
Don't worry about the try and except you see at the lower part, you don't have it, I just inserted it now to catch the error you are seeing
I'll try that as soon as I'll be back at mine, and I let you know, thanks.
@sgoldenlab, I added the line you told me (print(...)), but the line starting by binWidth, etc. was not at line 40 in my document, but at the line 54, so I added the line at line 55. In yellow you can see the line 41, while in blue next to the cursor is the line I inserted (at line 55) (I don't know how to make the row number visible on wordpad, so I counted it manually).
Now that I saved the file like that, I can't launch SimBA anymore, here what appears:
Ah its common one, it needs to be uniform 4 spaces or uniform tabs, I will send you the file
just replace the one you have with this
Thank you, I managed to open SimBA with your file. Here the error when I try to generate the heat map:
Ah I think I understand. The bin size becomes rounded of to less than a pixel due to a rather low resolution that I did not anticipate sorry. Try this - in the script - change int
to float
.
I did the change:
But the error still occurs, even after that I restarted Simba from scratch:
ah
Sorry one more float!
I did the change:
But now I cannot fill the bin window anymore, I can't write anything:
That seems very strange, does it come with en error msg in the terminal? Does it persist after restarting SimBA?
Actually, I don't know what happened, but now it is working, the analysis is on going, thank you!
good news again!
I have actually one issue again for heat map generation. I'm able to generate the videos, but when I ask to save the last image only, it just analyses the first video, and stops. It does not analyse the next videos:
Should I modify something in the code?
Hmm, I don't think so - are the videos all the same resolution?
I may have to troubleshoot this tomorrow.
Yes, they have the same resolution. Ok, so let's see that later, thank you again, Best, Dorian
@sgoldenlab, to give you further inputs about my issue.
This morning I tried to generate heat map (only the last picture) with another set of videos and I get a strange result. Since I have 2 animals, I first run for "center1", and it generated one picture for all my videos, so I though the problem was solved. But then, when I run for "center2", one picture is missing for my last video.
FYI: The resolution of the videos for which I failed to obtain a heat map yesterday (the program stopped after having generated the HM of the first video) picture is:
The resolution of the videos I worked with this morning:
I have the feeling that the resolution of my videos is very low, and that can be very problematic. Actually it's because I cropped a subfield of my raw videos, so the remaining portion on which I'm focusing for working ends up with a pretty bad resolution. Btw, turning back to my original problem that concerned the issue I have to extract de features, I don't think that the pre process tutorial can help me. I already did what is explained there for all my videos: cropping and splitting my files before working on it. So I actually don't know how I will be able to build classifiers from these files. Let me know if you have some ideas, Thanks!
Hi @DorianBattivelli. Yes for your first point, I think what is happening is that one animal, for whatever reason - is placed "outside" the heat-map array and it breaks. For this reason I thought I'd just insert a fix saying if the animal (as in your case) is placed in column 16 (and the array only contains 15 columns) then place the animal in column 15.
EDIT: This is because, for example, "Center2" has a coordinate outside the map, but "Center1" does not.
For your second, I am not entire sure I understand - could you be more specific? I know the videos are pretty poor resolution (0.3 pixels per milometer) but this should not matter if you have good tracking and can see yourself what is happening in the cropped videos.
@DorianBattivelli - can you give this file a go?
It should catch and correct the IndexErrors you are seeing.
Thank you, actually yes, it works for some video, but for some others, the problem persists:
Thanks it's because your body part is now two columns out of the frame, why I don't know, and I only controlled for one. I don't have a file to troubleshoot with, would you mind sharing a single .csv for me from your outlier_corrected_movdment_location folder?
Concerning the second point, I meant that certainly the reason why my feature extraction failed is due to the low resolution / the bad quality of my model. I deduced that from what I read on your FAQ concerning the QHull 6013 error that I have when I click "extract features". There, it is said that this error occurs when one or the two animals are missing (and so the tracking is not good enough, DLC failed to identify the body parts I guess). What is strange is that when I look at my labeled videos on DLC, I think that the tracking is pretty good. But when I open my csv files, I see a lot of cells with "0", which I suppose means that the label is not detected right?
For all these reasons, I deduce that my impossibility to extract the features is due to the low quality of my tracking model. Maybe I'm wrong.
No problem for sharing my csv file, where can I send it to you privately?
Can share share through a google drive with snilsson@uw.edu ?
Yes zeros are not good for feature extractions. I don't know when this occurs, but if it happens when animals is not present you can deal with it by clipping that part of the video. If the zero detection happens because the experimenter is present, then crop/clip that part of the video. If all the animal are present, the body-parts are present, and the experimenter is not there (and pose-estimation should pick up the body-part location but you still see zero) then you have to improve the model somehow - train it on additional videos and/or frames is a good start.
Shared.
FYI: cEFp1: I can generate a HM for each video only with Ear_right1. But if I select Center1, it works only for the first video (cEFp1_15), but fails for the other.
cEFp3: it works for video _15, for both Center_1 and Center_2, but for the video _60, Center2 fails.
Thanks! got it, will take a look a little later and get you a fix.
Thank you!
One more thing - could you share your video_info.csv also? To make sure I'm working with your settings
Done
Hi @DorianBattivelli - I'm sorry I still struggle to re-create this, my heatmaps generate fine for the 60 file using the center of animal 2:
What I am thinking is that you sent me the DLC output files, from project-folder/csv/input_csv
in SimBA correct? If you send me the outlier corrected files, I may be able to recreate it with those.
Since I'm working on multi animal project, I converted the h5 DLC files in csv through SimBA, and they are the files I sent to you. I just uploaded the outlier_corrected_movements_location folders on drive.
Hi @DorianBattivelli - can you try it using this script? It should catch any error you have in the alignment between the resolution of your video and bin size, and print a warning, and then plows on
Hi @sgoldenlab , thank you very much for the big help, that works perfectly well!
@sgoldenlab , Hello, I'm unfortunately dealing with a new error message. I have been able to analyze the ROI and to obtain: number of entries, cumulative time, distance and velocity data. Now I would like to draw heat maps. But I should first extract features right?
When I click Extract Features, it seems that the process stops, and here what happens:
I then click on append ROI data to features, and here what appears:
Have you any idea about the reason why it's not working?
As reminder, I'm working on multi animal project, on windows 7, avi videos, SimBA = 1.2.7. Concerning the outlier correction, I skipped it. Thank you, Best, Dorian