trex icon indicating copy to clipboard operation
trex copied to clipboard

Flipping body axis between head and taill while drosophila tracking

Open beepathu opened this issue 1 year ago • 1 comments

Describe the bug I am encountering an issue with the Trex tracking software while attempting to analyze the turning of flies. The software frequently flips between detecting the head and tail as the body axis, leading to inaccuracies in the data, mainly angle of turning. Any guidance on adjusting parameters to address the flipping body axis problem would be greatly appreciated.

The parameter settings that i currently use for trex are: meta_real_width = 11.3 frame_rate = 20 posture_direction_smoothing = 16 outline_smooth_step = 12 midline_invert = true track_max_speed = 24 output_invalid_value = "nan" output_format = "csv" individual_prefix = "fly" gui_show_number_individuals = true gui_playback_speed = 0.4 gui_show_selections = false track_max_individuals = 19 auto_minmax_size = true

I am attaching some images below in hope that you get a better idea of the issue.

Here is a screenshot of our video in the Trex that shows a circular arena with 20 flies: image (16)

Here is an example of how the head and tail switches in a fly, these images were taken in consecutive frames: trex_error_2 trex_error

beepathu avatar Feb 22 '24 14:02 beepathu

Hey,

this is difficult to determine from the images alone. But,

  • posture_direction_smoothing should probably be disabled for now. this is more a bandate than a solution. the reason the posture may be flipping back and forth is that the shape does not really have a "pointy end". so determining tail/head would be inconsistent.
  • outline_smooth_step should be default
  • less smoothing in general would be better, and then use outline_approximate instead (e.g. 2 or 3) since it allows for one end to be smaller
  • you could try to have lower threshold when converting so you get the wings (in case they have any), which would make the shape less symmetrical / one end pointier, and then approximate

If this does not help, then it's likely a data-problem. Meaning the shapes are just not pointy enough to be automatically determined. I think it should though!

mooch443 avatar Mar 21 '24 11:03 mooch443