cvat-ai / cvat

Annotate better with CVAT, the industry-leading data engine for machine learning. Used and trusted by teams at any scale, for data of any scale.
https://cvat.ai
MIT License
12.57k stars 3k forks source link

Impossible import annotations with points in LFW 1.0 format #5100

Open Marishka17 opened 2 years ago

Marishka17 commented 2 years ago

My actions before raising this issue

Expected Behaviour

Current Behaviour

Possible Solution

Steps to Reproduce (for bugs)

  1. Restore demo_task.zip
  2. Export annotations in LFW format
  3. Upload annotations

Context

Details ``` bash Traceback (most recent call last): File "/home/maya/Documents/cvat_ai/cvat/.env/lib/python3.8/site-packages/rq/worker.py", line 936, in perform_job rv = job.perform() File "/home/maya/Documents/cvat_ai/cvat/.env/lib/python3.8/site-packages/rq/job.py", line 684, in perform self._result = self._execute() File "/home/maya/Documents/cvat_ai/cvat/.env/lib/python3.8/site-packages/rq/job.py", line 690, in _execute return self.func(*self.args, **self.kwargs) File "/usr/lib/python3.8/contextlib.py", line 75, in inner return func(*args, **kwds) File "/home/maya/Documents/cvat_ai/cvat/cvat/apps/dataset_manager/task.py", line 775, in import_task_annotations task.import_annotations(f, importer) File "/home/maya/Documents/cvat_ai/cvat/cvat/apps/dataset_manager/task.py", line 658, in import_annotations importer(src_file, task_data, **options) File "/home/maya/Documents/cvat_ai/cvat/cvat/apps/dataset_manager/formats/registry.py", line 37, in __call__ f_or_cls(*args, **kwargs) File "/home/maya/Documents/cvat_ai/cvat/cvat/apps/dataset_manager/formats/lfw.py", line 21, in _import dataset = Dataset.import_from(tmp_dir, 'lfw') File "/home/maya/Documents/cvat_ai/cvat/.env/lib/python3.8/site-packages/datumaro/components/dataset.py", line 1214, in import_from env.make_extractor(src_conf.format, src_conf.url, **extractor_kwargs) File "/home/maya/Documents/cvat_ai/cvat/.env/lib/python3.8/site-packages/datumaro/components/environment.py", line 230, in make_extractor return self.extractors.get(name)(*args, **kwargs) File "/home/maya/Documents/cvat_ai/cvat/.env/lib/python3.8/site-packages/datumaro/plugins/lfw_format.py", line 45, in __init__ self._items = list(self._load_items(path).values()) File "/home/maya/Documents/cvat_ai/cvat/.env/lib/python3.8/site-packages/datumaro/plugins/lfw_format.py", line 199, in _load_items annotations.append(Points([float(p) for p in line[1:]], label=label)) UnboundLocalError: local variable 'label' referenced before assignment ```

Your Environment

sizov-kirill commented 1 year ago

The main problem here is usage of LFW format.

LFW format it's mainly for working with tags not with points. Yes, LFW format has landmark.txt that describes facial landmarks for images, but format doesn't support any labels for these landmarks it's just face points that has no any labels. So having only points without any tags has no meaning from LFW format point of view.

But I agree that if we can export dataset in some format we should be able to import exported annotations as well, so I prepared PR in Datumaro, that eliminate this error that occurs during importing this annotations in LFW.

Also I'll prepare PR for cvat documenatation where I'll fix description of LFW format in our docs.

zhiltsov-max commented 1 year ago

From my point, the situation can be formulated as "garbage in - garbage out". The format doesn't suppose the annotations from the task in the issue, but following the documentation, it's not clear how to use the format and how to prepare annotations to make it working. I think, we should document the required annotations, make sure it's clear how to use the format and that we can annotate a meaningful dataset in this format.