zauberzeug / field_friend

A Development Platform for Autonomous Weeding.
https://feldfreund.de
MIT License
11 stars 3 forks source link

Flaky tests (probably caused by not getting over the necessary threshold of plant detections) #71

Closed rodja closed 1 week ago

rodja commented 3 months ago

By using flake-finder pytest extension we can see some flakyness:

ptw . --now --flake-finder -x -k weeding

After some digging I think it may be caused by not getting over the necessary threshold of plant detections. How does the new add_crop behaviour work? I think I'll need a walkthrough or something from @pascalzauberzeug or @angelom93. Especially the _add_crop_prediction code does not yet make sense to me.

pascalzauberzeug commented 2 months ago

@rodja In add_crop check_if_plant_exists checks if a detected plant already exists by calculating the distances to all known crops. If yes, the detection confidence is added to the matched crop's confidence. We should probably make check_if_plant_exists return None or the matched plant and add the confidence in another function. If it's a new plant we add it to the list of plants.

_add_crop_prediction uses the nearest two known crops and a known spacing between crops to calculate where the next crop should be. If the newly detected crop fits into this prediction radius, it gets a confidence boost. This helps to ignore false crop detections between the rows.

rodja commented 1 week ago

Year. I just tested the current main code with flakefinder. The flakyness is gone!