Skip to content

Commit

Permalink
Fix CVAT format import for frame stepped tasks (#2151)
Browse files Browse the repository at this point in the history
* Fix cvat format import with frame step

* update changelog
  • Loading branch information
zhiltsov-max authored Sep 8, 2020
1 parent 0efc11d commit 0933ee2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Fixed multiple errors which arises when polygon is of length 5 or less (<https://github.com/opencv/cvat/pull/2100>)
- Fixed CVAT format import for frame stepped tasks (<https://github.com/openvinotoolkit/cvat/pull/2151>)

### Security
-
Expand Down
4 changes: 3 additions & 1 deletion cvat/apps/dataset_manager/formats/cvat.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,9 @@ def load(file_object, annotations):
)
elif el.tag == 'image':
image_is_opened = True
frame_id = match_dm_item(DatasetItem(id=el.attrib['id'], image=el.attrib['name']), annotations)
frame_id = annotations.abs_frame_id(match_dm_item(
DatasetItem(id=el.attrib['id'], image=el.attrib['name']),
annotations))
elif el.tag in supported_shapes and (track is not None or image_is_opened):
attributes = []
shape = {
Expand Down
13 changes: 10 additions & 3 deletions cvat/apps/engine/tests/_test_rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,14 @@ def _create_task(self, owner, assignee):
"client_files[0]": generate_image_file("test_1.jpg")[1],
"client_files[1]": generate_image_file("test_2.jpg")[1],
"client_files[2]": generate_image_file("test_3.jpg")[1],
"client_files[4]": generate_image_file("test_4.jpg")[1],
"client_files[5]": generate_image_file("test_5.jpg")[1],
"client_files[6]": generate_image_file("test_6.jpg")[1],
"client_files[7]": generate_image_file("test_7.jpg")[1],
"client_files[8]": generate_image_file("test_8.jpg")[1],
"client_files[9]": generate_image_file("test_9.jpg")[1],
"image_quality": 75,
"frame_filter": "step=3",
}
response = self.client.post("/api/v1/tasks/{}/data".format(tid), data=images)
assert response.status_code == status.HTTP_202_ACCEPTED
Expand Down Expand Up @@ -2202,7 +2209,7 @@ def _run_api_v1_jobs_id_annotations(self, owner, assignee, annotator):
"occluded": False
},
{
"frame": 1,
"frame": 2,
"label_id": task["labels"][1]["id"],
"group": None,
"source": "manual",
Expand Down Expand Up @@ -2239,7 +2246,7 @@ def _run_api_v1_jobs_id_annotations(self, owner, assignee, annotator):
]
},
{
"frame": 1,
"frame": 2,
"attributes": [],
"points": [2.0, 2.1, 100, 300.222],
"type": "rectangle",
Expand All @@ -2256,7 +2263,7 @@ def _run_api_v1_jobs_id_annotations(self, owner, assignee, annotator):
"attributes": [],
"shapes": [
{
"frame": 1,
"frame": 2,
"attributes": [],
"points": [1.0, 2.1, 100, 300.222],
"type": "rectangle",
Expand Down

0 comments on commit 0933ee2

Please sign in to comment.