diff --git a/fiftyone/utils/cvat.py b/fiftyone/utils/cvat.py index 6d2eae4df2..8e314074dc 100644 --- a/fiftyone/utils/cvat.py +++ b/fiftyone/utils/cvat.py @@ -4742,7 +4742,7 @@ def _has_ignored_attributes(self, label_schema): _, occluded_attr_name, group_id_attr_name, - ) = self._to_cvat_attributes(label_info["attributes"]) + ) = self._to_cvat_attributes(label_info.get("attributes", {})) if occluded_attr_name or group_id_attr_name: return True diff --git a/tests/intensive/cvat_tests.py b/tests/intensive/cvat_tests.py index 450d89f9dc..b1a0ea0c95 100644 --- a/tests/intensive/cvat_tests.py +++ b/tests/intensive/cvat_tests.py @@ -468,7 +468,20 @@ def test_project(self): api = results.connect_to_api() project_id = api.get_project_id(project_name) self.assertIsNotNone(project_id) - self.assertIn(project_id, results.project_ids) + if project_id not in results.project_ids: + # Delete project if it exists + api.delete_project(project_id) + anno_key_retry = "anno_key_retry" + results = dataset.annotate( + anno_key_retry, + backend="cvat", + label_field="ground_truth", + project_name=project_name, + ) + api = results.connect_to_api() + project_id = api.get_project_id(project_name) + self.assertIsNotNone(project_id) + self.assertIn(project_id, results.project_ids) anno_key2 = "anno_key2" results2 = dataset.annotate( @@ -480,6 +493,14 @@ def test_project(self): self.assertNotIn(project_id, results2.project_ids) self.assertIsNotNone(api.get_project_id(project_name)) + # Test upload without schema + anno_key3 = "anno_key3" + results3 = dataset.annotate( + anno_key3, + backend="cvat", + project_name=project_name, + ) + with self.assertRaises(ValueError): label_schema = { "ground_truth": {