Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix pascal_voc import bug #4647

Merged
merged 22 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ non-ascii paths while adding files from "Connected file share" (issue #4428)
- Extra rerenders of different pages with each click (<https://github.com/opencv/cvat/pull/5178>)
- Skeleton points exported out of order in the COCO Keypoints format
(<https://github.com/opencv/cvat/issues/5048>)
- PASCAL VOC 1.1 can't import dataset (<https://github.com/opencv/cvat/pull/4647>)
- Changing an object causes current z layer to be set to the maximum (<https://github.com/opencv/cvat/pull/5145>)
- Job assignee can not resolve an issue (<https://github.com/opencv/cvat/pull/5167>)
- Create manifest with cvat/server docker container command (<https://github.com/opencv/cvat/pull/5172>)
Expand Down
2 changes: 2 additions & 0 deletions cvat/apps/dataset_manager/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,8 @@ def load_dataset_data(project_annotation, dataset: dm.Dataset, project_data):
else:
for label in dataset.categories()[dm.AnnotationType.label].items:
if not project_annotation.db_project.label_set.filter(name=label.name).exists():
if label.name == 'background':
SpecLad marked this conversation as resolved.
Show resolved Hide resolved
continue
raise CvatImportError(f'Target project does not have label with name "{label.name}"')
for subset_id, subset in enumerate(dataset.subsets().values()):
job = rq.get_current_job()
Expand Down
16 changes: 16 additions & 0 deletions tests/python/rest_api/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,22 @@ def test_can_import_export_dataset_with_imagenet_format(self):

self._test_import_project(username, project_id, format_name, import_data)

def test_can_import_export_dataset_with_pascal_voc_format(self):
SpecLad marked this conversation as resolved.
Show resolved Hide resolved
username = "admin1"
format_name = "PASCAL VOC 1.1"
project_id = 4

response = self._test_export_project(username, project_id, format_name)

tmp_file = io.BytesIO(response.data)
tmp_file.name = "dataset.zip"

import_data = {
"dataset_file": tmp_file,
}

self._test_import_project(username, project_id, format_name, import_data)


@pytest.mark.usefixtures("restore_db_per_function")
class TestPatchProjectLabel:
Expand Down