-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[GSoC2024] Fix missing related images 3d dataset exports #7699
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6ad671f
corrected bindings file
bargav25 3c6ba79
Merge branch 'develop' into related_imgs_in_export
zhiltsov-max c5525ba
Fix spurious failures in `case_17_lock_hide_features.js` (#7742)
SpecLad c400b36
[GSoC2024] feat: add shortcut support for pinning properties (#7709)
tahamukhtar20 b4c125d
Fix incorrect changelog fragment (#7745)
bsekachev 81af102
Human protocol integration documentation (#7547)
mdacoca 1876279
[GSoC2024] feature: allow downloading video frames in custom extensio…
ChanBong b0ba786
test to check the export of Datumaro - (save_images = True)
bargav25 ca0c932
Merge branch 'develop' into related_imgs_in_export
zhiltsov-max 338f7e2
Apply suggestions from code review
zhiltsov-max b74bbc4
Apply suggestions from code review
zhiltsov-max 4477d66
corrected dumping function - Datumaro
bargav25 431f443
added in logs
bargav25 c2fac5a
Update changelog.d/20240412_013221_jbargav025_related_imgs_in_export.md
bargav25 6d1f762
added sly dump check
bargav25 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
changelog.d/20240412_013221_jbargav025_related_imgs_in_export.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### Fixed | ||
|
||
- Fixed missing related images in Datumaro 3D exports | ||
(<https://github.com/cvat-ai/cvat/pull/7699>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -250,26 +250,56 @@ def etree_to_dict(t): | |||||||
self.assertEqual(len(items), len(task_data["shapes"])) | ||||||||
elif format_name == "Sly Point Cloud Format 1.0": | ||||||||
with tempfile.TemporaryDirectory() as tmp_dir: | ||||||||
checking_files = [osp.join(tmp_dir, "key_id_map.json"), | ||||||||
osp.join(tmp_dir, "meta.json"), | ||||||||
osp.join(tmp_dir, "ds0", "ann", "000001.pcd.json"), | ||||||||
osp.join(tmp_dir, "ds0", "ann", "000002.pcd.json"), | ||||||||
osp.join(tmp_dir, "ds0", "ann","000003.pcd.json")] | ||||||||
if related_files: | ||||||||
checking_files.extend([osp.join(tmp_dir, "ds0", "related_images", "000001.pcd_pcd", "000001.png.json"), | ||||||||
osp.join(tmp_dir, "ds0", "related_images", "000002.pcd_pcd", "000002.png.json"), | ||||||||
osp.join(tmp_dir, "ds0", "related_images", "000003.pcd_pcd", "000003.png.json")]) | ||||||||
zipfile.ZipFile(content).extractall(tmp_dir) | ||||||||
checking_files = [ | ||||||||
osp.join(tmp_dir, "key_id_map.json"), | ||||||||
osp.join(tmp_dir, "meta.json"), | ||||||||
osp.join(tmp_dir, "ds0", "ann", "000001.pcd.json"), | ||||||||
osp.join(tmp_dir, "ds0", "ann", "000002.pcd.json"), | ||||||||
osp.join(tmp_dir, "ds0", "ann", "000003.pcd.json") | ||||||||
] | ||||||||
point_cloud_files = [ | ||||||||
osp.join(tmp_dir, "pointcloud", "ds0", "000001.pcd"), | ||||||||
osp.join(tmp_dir, "pointcloud", "ds0", "000002.pcd"), | ||||||||
osp.join(tmp_dir, "pointcloud", "ds0", "000003.pcd") | ||||||||
] | ||||||||
point_cloud_files_present = any(osp.exists(f) for f in point_cloud_files) | ||||||||
if related_files and point_cloud_files_present: | ||||||||
checking_files.extend([ | ||||||||
osp.join(tmp_dir, "ds0", "related_images", "000001_pcd", "000001.png.json"), | ||||||||
osp.join(tmp_dir, "ds0", "related_images", "000002_pcd", "000002.png.json"), | ||||||||
osp.join(tmp_dir, "ds0", "related_images", "000003_pcd", "000003.png.json") | ||||||||
]) | ||||||||
jsons = glob(osp.join(tmp_dir, '**', '*.json'), recursive=True) | ||||||||
self.assertTrue(jsons) | ||||||||
self.assertTrue(set(checking_files).issubset(set(jsons))) | ||||||||
elif format_name == "Datumaro 3D 1.0": | ||||||||
with tempfile.TemporaryDirectory() as tmp_dir: | ||||||||
zipfile.ZipFile(content).extractall(tmp_dir) | ||||||||
extracted_files = set( | ||||||||
os.path.relpath(os.path.join(root, file), tmp_dir) | ||||||||
for root, dirs, files in os.walk(tmp_dir) | ||||||||
for file in files | ||||||||
) | ||||||||
expected_files = {'annotations/default.json'} | ||||||||
point_cloud_files = {'point_clouds/default/000001.pcd', 'point_clouds/default/000002.pcd', 'point_clouds/default/000003.pcd'} | ||||||||
# Check for point cloud files | ||||||||
if not point_cloud_files.isdisjoint(extracted_files): | ||||||||
expected_files.update(point_cloud_files) | ||||||||
if related_files: | ||||||||
expected_files.update([ | ||||||||
'related_images/default/000001/image_0.png', | ||||||||
'related_images/default/000002/image_0.png', | ||||||||
'related_images/default/000003/image_0.png' | ||||||||
]) | ||||||||
self.assertEqual(extracted_files, expected_files) | ||||||||
|
||||||||
|
||||||||
class Task3DTest(_DbTestBase): | ||||||||
@classmethod | ||||||||
def setUpClass(cls): | ||||||||
super().setUpClass() | ||||||||
cls.format_names = ["Sly Point Cloud Format 1.0", "Kitti Raw Format 1.0"] | ||||||||
cls.format_names = ["Sly Point Cloud Format 1.0", "Kitti Raw Format 1.0", "Datumaro 3D 1.0"] | ||||||||
cls._image_sizes = {} | ||||||||
cls.pointcloud_pcd_filename = "test_canvas3d.zip" | ||||||||
cls.pointcloud_pcd_path = osp.join(os.path.dirname(__file__), 'assets', cls.pointcloud_pcd_filename) | ||||||||
|
@@ -761,5 +791,5 @@ def test_api_v2_export_dataset(self): | |||||||
with open(file_name, "wb") as f: | ||||||||
f.write(content.getvalue()) | ||||||||
self.assertEqual(osp.exists(file_name), edata['file_exists']) | ||||||||
self._check_dump_content(content, task_ann_prev.data, format_name,related_files=False) | ||||||||
self._check_dump_content(content, task_ann_prev.data, format_name, related_files=True) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It seems there is an error in the test. |
||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code doesn't seem to be executed