OvidijusParsiunas/myvision

Loss of detail with very small bounding boxes

Closed this issue · 6 comments

Reproduce:

  1. Load a 512x512 image and accurately label a very small object with full zoom.
  2. Export (VOC XML or Yolo Text)
  3. Open a new tab and reimport

Hey @m345054, thankyou very much for raising the issue. Just so I understand the problem more clearly, could you elaborate on what the loss is? Is the data that is recorded in the exported file incorrect or is it the drawn bounding boxes on the reimport that are causing the problems? Also, may I ask what the magnitude of the loss is?

If you could perhaps provide data examples/screenshots, it would be very helpful to diagnose the problem!
Thankyou!

Hello I attached some screenshots. I can later debug if the error appears while exporting or when its reimported.
I labeled the cross exactly at the pixels border but when reimporting a small gap appears.
example1
example1zoomed

Reimport:
reimportzoomed
reimportzoomed2

Thankyou for the explanation! I believe I have fixed the problem on a local version of the app, but I need to do a lot of thorough testing to make sure that I haven't broken any functionality which is currently correct.

Just to give a bit of clarity on why you were observing the issue:
Zoom functionality has been problematic in the past because the app doesn't actually zoom in the picture but instead expands it and crops the overflowing parts. When the user draws a bounding box/polygon on the zoomed in picture, the app has information of the shape's coordinates (pixels) on the screen (canvas element) and not the pixels relative to the original not zoomed in image. Hence, the app needs to perform calculations in order to identify how each zoomed in shape coordinate maps to the not zoomed in image coordinate. This is where data loss happens as this calculation is relatively cumbersome which involves rounding, hence resulting in data loss.

To note, if you zoom in and draw a bounding box with coordinates that would be in-between pixels of the original image, the app can only assume and guess (by rounding) which pixel is the coordinate meant to be on. Hence when you export data and import it on another browser tab - the two apps may draw shapes slightly differently as the original still has shapes between pixels.

Furthermore, this is explicitly problematic in VOC.XML as it only accepts integer coordinates, whereas when you zoom in - you are drawing very fine decimal place coordinates, thus when the app rounds up the coordinates to integers they may not be exactly what you have drawn. Unfortunately this is a limitation of this format which is impossible to get around, however the app will try to be as precise as possible.

In summary, I have noticed that the coordinate calculation algorithm is not perfect and am currently testing a better solution for more accurate and consistent results. Watch this thread for further updates.

Thankyou!

Bounding box result data should be much more accurate now.

Awesome thank you for your help