datumaro icon indicating copy to clipboard operation
datumaro copied to clipboard

[WIP] Make coordinate rounding optional

Open zhiltsov-max opened this issue 2 years ago • 0 comments

Summary

Currently, Datumaro rounds spatial annotation coordinates to 2 decimal digits. There are few reasons for this:

  • typically we don't need higher precision even for large images
  • storing long decimal tails in annotation files increases file size and hinders visual editing for no reason
  • fixed and short decimal range allows to compare annotations directly, without extra manual rounding, because numbers are already rounded and typical floating point problems are mitigated

However, while these reasons make sense, there are also a huge drawback: performance. For instance, in COCO 2017 parsing it takes about extra 30s (~50%) just to round numbers, while annotations may not be even needed (eg. to report dataset size or annotation count). For exporting this dataset back it takes even more time.

This PR changes the strategy on this and:

  • Removes mandatory rounding from annotation class constructors
  • Adds the RoundCoordinates transform (mostly, for internal use)
  • Deprecates automatic rounding on export in COCO, CVAT, VOC, YOLO, LabelMe, MOT, Supervisely, Kitti formats. In future it should be disabled
  • Adds the round-digits export parameter to control rounding in formats, that export coordinates (COCO, Datumaro, CVAT, Supervisely, LabeMe etc.)

How to test

Checklist

  • [ ] I submit my changes into the develop branch
  • [ ] I have added description of my changes into CHANGELOG
  • [ ] I have updated the documentation accordingly
  • [ ] I have added tests to cover my changes
  • [ ] I have linked related issues

License

  • [ ] I submit my code changes under the same MIT License that covers the project. Feel free to contact the maintainers if that's a concern.
  • [ ] I have updated the license header for each file (see an example below)
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT

zhiltsov-max avatar Mar 29 '22 14:03 zhiltsov-max