Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue during features extraction. #52

Closed
DorianBattivelli opened this issue Jul 24, 2020 · 46 comments
Closed

Issue during features extraction. #52

DorianBattivelli opened this issue Jul 24, 2020 · 46 comments

Comments

@DorianBattivelli
Copy link

DorianBattivelli commented Jul 24, 2020

@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:

Schermata 2020-07-24 alle 15 35 17

I then click on append ROI data to features, and here what appears:

Schermata 2020-07-24 alle 15 39 29

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

@DorianBattivelli
Copy link
Author

Ok, I found the topic in your FAQ. I'll follow the the Batch pre-process videos in SimBA tutorial.

@sgoldenlab
Copy link
Owner

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:

image

@DorianBattivelli
Copy link
Author

@sgoldenlab Thank you for the answer. Indeed I tried this function, but it does not work neither.
Here what appear in my terminal:

Schermata 2020-07-24 alle 16 55 06

@sgoldenlab
Copy link
Owner

sgoldenlab commented Jul 24, 2020

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?

image

@DorianBattivelli
Copy link
Author

Yes, here one file for one set of videos:

Schermata 2020-07-24 alle 17 46 06

@sgoldenlab
Copy link
Owner

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?

@DorianBattivelli
Copy link
Author

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:

Schermata 2020-07-24 alle 17 57 15

@sgoldenlab
Copy link
Owner

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.

@sgoldenlab
Copy link
Owner

sgoldenlab commented Jul 24, 2020

@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?

@DorianBattivelli
Copy link
Author

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:

Schermata 2020-07-24 alle 18 59 41

@sgoldenlab
Copy link
Owner

That's what I meant, it looks like it should!

@sgoldenlab
Copy link
Owner

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:

image

Could you insert a new line on Line 41 which would read like this?

image

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

@sgoldenlab
Copy link
Owner

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

@DorianBattivelli
Copy link
Author

I'll try that as soon as I'll be back at mine, and I let you know, thanks.

@DorianBattivelli
Copy link
Author

@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).

Schermata 2020-07-24 alle 22 21 33

Now that I saved the file like that, I can't launch SimBA anymore, here what appears:

Schermata 2020-07-24 alle 22 25 29

@sgoldenlab
Copy link
Owner

Ah its common one, it needs to be uniform 4 spaces or uniform tabs, I will send you the file

@sgoldenlab
Copy link
Owner

sgoldenlab commented Jul 24, 2020

plot_heatmap_location_new.zip

just replace the one you have with this

@DorianBattivelli
Copy link
Author

Thank you, I managed to open SimBA with your file.
Here the error when I try to generate the heat map:

Schermata 2020-07-24 alle 22 35 50

@sgoldenlab
Copy link
Owner

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.

image

@DorianBattivelli
Copy link
Author

I did the change:

Schermata 2020-07-24 alle 22 47 27

But the error still occurs, even after that I restarted Simba from scratch:

Schermata 2020-07-24 alle 22 49 29

@sgoldenlab
Copy link
Owner

ah

@sgoldenlab
Copy link
Owner

Sorry one more float!

image

@DorianBattivelli
Copy link
Author

I did the change:

Schermata 2020-07-24 alle 23 00 58

But now I cannot fill the bin window anymore, I can't write anything:

Schermata 2020-07-24 alle 23 05 36

@sgoldenlab
Copy link
Owner

That seems very strange, does it come with en error msg in the terminal? Does it persist after restarting SimBA?

@DorianBattivelli
Copy link
Author

Actually, I don't know what happened, but now it is working, the analysis is on going, thank you!

@sgoldenlab
Copy link
Owner

good news again!

@DorianBattivelli
Copy link
Author

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:
Schermata 2020-07-25 alle 01 58 48

Should I modify something in the code?

@sgoldenlab
Copy link
Owner

sgoldenlab commented Jul 25, 2020

Hmm, I don't think so - are the videos all the same resolution?

I may have to troubleshoot this tomorrow.

@DorianBattivelli
Copy link
Author

DorianBattivelli commented Jul 25, 2020

Yes, they have the same resolution.
Ok, so let's see that later, thank you again,
Best,
Dorian

@DorianBattivelli
Copy link
Author

DorianBattivelli commented Jul 25, 2020

@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:
Schermata 2020-07-25 alle 09 47 35

The resolution of the videos I worked with this morning:
Schermata 2020-07-25 alle 09 49 58

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!

@sgoldenlab
Copy link
Owner

sgoldenlab commented Jul 25, 2020

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.

@sgoldenlab
Copy link
Owner

plot_heatmap_location_new.zip

@DorianBattivelli - can you give this file a go?

It should catch and correct the IndexErrors you are seeing.

@DorianBattivelli
Copy link
Author

Thank you, actually yes, it works for some video, but for some others, the problem persists:

Schermata 2020-07-25 alle 18 48 56

@sgoldenlab
Copy link
Owner

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?

@DorianBattivelli
Copy link
Author

DorianBattivelli commented Jul 25, 2020

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.

@DorianBattivelli
Copy link
Author

No problem for sharing my csv file, where can I send it to you privately?

@sgoldenlab
Copy link
Owner

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.

@DorianBattivelli
Copy link
Author

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.

@sgoldenlab
Copy link
Owner

Thanks! got it, will take a look a little later and get you a fix.

@DorianBattivelli
Copy link
Author

Thank you!

@sgoldenlab
Copy link
Owner

One more thing - could you share your video_info.csv also? To make sure I'm working with your settings

@DorianBattivelli
Copy link
Author

Done

@sgoldenlab
Copy link
Owner

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:

image

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.

@DorianBattivelli
Copy link
Author

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.

@sgoldenlab
Copy link
Owner

plot_heatmap_location_new.zip

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

@DorianBattivelli
Copy link
Author

Hi @sgoldenlab , thank you very much for the big help, that works perfectly well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants