sollan / alma

Fully automated (rodent) limb motion analysis toolbox for behavioral analysis with bodypart coordinate data, building upon markerless pose estimation.
GNU General Public License v3.0
13 stars 5 forks source link

How to adjust sensitivity on footfall analysis for deviation or threshold? Particularly with start/end time of footfall #39

Closed scoki211 closed 3 months ago

scoki211 commented 7 months ago

Hi there

I am having issues with deviation being too sensitive, i.e there appears to be too many false positives for it to be useful out the box for automated footfall analysis. I note in the paper you guys mention adjusting the prominence peak detection threshold. It's a bit unclear how I should modify this (I'm assuming it's line 109 of FootfallFunctions.py?) as the prominence is (10, 100000) out of the box, but that doesn't appear to correspond to y axis numbers displayed on the validation image display which run from 0 at the top to 1000 at the bottom.

Basically when I compare my manual review with the automated deviation algo, I'm recording 11 footfalls manually, and it's picking up 34.

When I use threshold, it appears to do a much more accurate job, capturing 10/11. However, there is a more pressing concern, which is that the automated start and end points aren't particularly accurate. It will often set the start and end points at exactly the same position, or will record the start at the bottom of the slip trough or towards the end of the trough before recovery. Is there anything I could look to adjust here to improve accuracy without having to go through and manually adjust each footfall timing?

Regards Jack

sollan commented 7 months ago

Hi!

You are right, the deviation algorithm is expected to produce more false positives, so a manual validation is necessary.

By design, the threshold method will have an issue with the start / end times of the footfalls, since the onset and recovery timepoints are often marked by small variations in the y-axis location that are lost when we apply a threshold (unless the camera position, recording angle, etc. all aligned to create a perfect recording).

It might be preferable to validate and reject false positives rather than look for the missed footfalls / modify timing. However, the start / end times of the deviation method would be closer to reality than the threshold method. Did you also have the timing problem with "deviation"?

And yes, if you wish to, the way to modify "prominence" would be to change it in the code. (This basically means "slips that are between 10~100000 units in depth.) I can imagine that increasing the lower bound would give you fewer false positives, for example if you only want to identify footfalls and not "minor slips".

This would be nice to have it as an additional configurable parameter. Feel free to create a pull request if you make any changes to the code that you think can be useful for others too.

Best, Annette