Trackmate - Hanging on Solving Cost Matrix

I use trackmate to analyze particles tracking in a relatively linear up/down format, and my latest iteration is based on using Lap Tracker with linking and a high x-penalty.

In general the generation and solving of the cost matrix only takes 0.1-2 seconds, but for a few stacks (those with high particle counts/images) the solving of the cost matrix seems to hang (never seems to solve the matrix, even >10 minutes). The difficulty is that it is hard to predict when the # of images/particles will cause the hang.

I can work around this sometimes by limiting the # of images or using ROI to analyze certain sections, but it would be helpful to learn more about why this inability to solve the matrix might occur.

Hi

Can you give details on the image, the number of spots, the settings etc?
Thanks

Thanks for replying!

I have two examples, one that worked, and another that doesn’t.

Example 1= WORKS

Image size = 672 x 512 pixels, 8-bit, thresholded, 3053 images.
LOG Detector, number of spots = 97129
No filtering of spots
LAP Tracker
Frame to Frame Linking, Max Distance = 90 pixels, x penalty = 100
Track Segment Gap Closing Max Distance = 90 pixels, max frames gap = 50, x penalty = 100

Example 2 = DOESNT WORK
Image size = 672 x 512 pixels, 8-bit, thresholded
LOG Detector, number of spots = 245424
No filtering of spots
LAP Tracker
Frame to Frame Linking, Max Distance = 90 pixels, x penalty = 100
Track Segment Gap Closing Max Distance = 90 pixels, max frames gap = 50, x penalty = 100

I realize that there are more spots and more images in the second setting, but it doesn’t seem entirely reliable on the # of spots or the number of images.

I can try and find some additional examples, but it does seem more likely to fail when the # of spots and/or # of images is higher. I don’t seem to be running into CPU or memory issues, based on my surveillance of my activity monitor.

Thanks!

I think it is a memory issue.

The number of spots is large and you picked a very large linking distance. Even with the sparse matrix approach from this year, this will cause a gigantic cost matrix to be created. This in turn will saturate the memory and take very long to compute.

Could you try again case #2 with max distances of about 9 pixels?

Decreasing the max distances to about 9 pixels did indeed help as Trackmate was able to solve that matrix.
A couple of thoughts/questions:

  1. It doesn’t seem like Trackmate/FIJI is increasing it’s memory usage when I run Trackmate, and I have a lot of spare memory (I assume RAM in this case) allocated to FIJI, is it something that is just not reporting in my activity monitor?

  2. Biologically, I need relatively high max distances when tracking these particles, is there a way to “optimize” the lap tracker so that it might be able to compute these large matrices with the memory that I have? As I mentioned before, I primarily care about up/down motion so I’ve already penalized “x” heavily so I don’t think that penalizing it more would be helpful.

Thanks so much for your help on this!!

As for memory usage, you would need to be more specific. Can you give us numbers? How much RAM you allocated to Fiji? What the Activity monitor reports?

Also, the problem you try to solve is not that big. What computer do you have?

Finally, for your challenge I would try to lower the number of spots if you can. The cost matrix has roughly a size of N^2 where N is the number of spots per frame. Though the new sparse approach should help. So I am not entirely sure I am right.

More than that, we would need to dwell on the problem itself.

1 Like

Thanks.

I have a Retina iMac 27K with a 3.3Ghz i5 processor, 16GB of RAM. Currently 12GB is allocated to FIJI.
Typically FIJI uses no more than 2-4 GB of RAM. When I re-ran the example #2 with the ORIGINAL settings I kept an eye on it and it stayed static at 2.96GB of RAM usage.

In further troubleshooting, I have noticed that I use the original max distances (and penalties) but have reduced the frame gap to <10 and it seems to consistently work. I would like to go higher but I can work with around 9.

What is more interesting to me is that I would fathom that I have the processing power and RAM available to solve the larger matrices but I cannot pinpoint where the hang is!

Thanks again, and thanks for your quick replies. This is non-urgent so please do not feel like you need to respond ASAP.

Looks like this thread is dead, but I think I am seeing the same issue. Please see my recent post.

In case anyone else comes across this thread later, I just want to point out the following guide:

1 Like