-
Notifications
You must be signed in to change notification settings - Fork 15
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
ignoring point order in skeleton annotations when comparing annotations #57
Conversation
… and existence of absent points
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe recent changes enhance the robustness and clarity of annotation comparison and export functionalities across the Datumaro framework. Key improvements include refined type annotations for better code safety, improved handling of skeleton annotations, and modularized file operations for YOLO format. Additionally, comprehensive testing has been introduced to validate these enhancements, ensuring more reliable behavior in annotation processing. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Converter
participant Annotation
User->>Converter: Call export method with item
Converter->>Annotation: Check if annotation is valid
Annotation-->>Converter: Return validation status
Converter->>Converter: Save annotation file if valid
Note right of Converter: Uses _save_annotation_file method
sequenceDiagram
participant User
participant TestSuite
participant AnnotationComparator
User->>TestSuite: Run skeleton annotation comparison test
TestSuite->>AnnotationComparator: Compare expected and actual annotations
AnnotationComparator->>AnnotationComparator: Sort and filter elements
AnnotationComparator-->>TestSuite: Return comparison result
TestSuite-->>User: Assert results
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- datumaro/components/operations.py (3 hunks)
- datumaro/plugins/yolo_format/converter.py (3 hunks)
- datumaro/util/test_utils.py (2 hunks)
- tests/test_diff.py (2 hunks)
- tests/unit/data_formats/test_yolo_format.py (2 hunks)
Additional comments not posted (8)
datumaro/util/test_utils.py (2)
118-118
: Type annotations improve clarity.The addition of type annotations for
expected
andactual
parameters enhances code readability and type safety.
132-144
: Verify sorting logic for skeleton annotations.Ensure that the sorting of elements based on visibility and label is correct and aligns with the intended functionality.
Run the following script to verify the sorting logic in the codebase:
Verification successful
Sorting logic for skeleton annotations is correctly implemented.
The elements are filtered to exclude those with
Points.Visibility.absent
and sorted by theirlabel
, which aligns with the intended functionality. No issues found with the sorting logic.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the sorting logic for skeleton annotations. # Test: Search for the sorting logic in the codebase. Expect: Correct implementation of sorting by visibility and label. rg --type python -A 5 $'elements=sorted'Length of output: 70
Script:
#!/bin/bash # Description: Verify the sorting logic for skeleton annotations. # Test: Search for the sorting logic in the codebase. Expect: Correct implementation of sorting by visibility and label. rg --type py -A 5 $'elements=sorted'Length of output: 780
datumaro/plugins/yolo_format/converter.py (2)
197-199
: Encapsulation of file operations improves modularity.The
_save_annotation_file
method centralizes the file writing operation, enhancing code reusability and maintainability.
294-296
: Check for empty annotations enhances robustness.The check for non-empty
yolo_annotation
before saving prevents unnecessary file operations and improves error handling.tests/test_diff.py (1)
282-419
: New test case for skeleton annotation comparison is well-structured.The
test_skeleton_annotation_comparison
method effectively validates the comparison logic for skeleton annotations usingExactComparator
.tests/unit/data_formats/test_yolo_format.py (1)
471-489
: Test correctly ensures no annotation files for unsupported types.The renamed test method
test_can_save_without_creating_annotation_file_and_load
accurately validates that no annotation files are created for unsupported types likeMask
.datumaro/components/operations.py (2)
1860-1860
: Type annotations improve clarity.The addition of type annotations for parameters
a
andb
enhances code readability and type safety.
1870-1878
: Verify filtering and sorting logic for skeleton annotations.Ensure that the filtering and sorting of elements based on visibility and label are correctly implemented.
Run the following script to verify the filtering and sorting logic in the codebase:
Verification successful
Filtering and Sorting Logic Verified
The filtering and sorting logic for skeleton annotations is correctly implemented in the codebase. The elements are filtered based on visibility and sorted by label, as expected. This logic is found in
datumaro/util/test_utils.py
, indicating that it is likely tested. No issues were found.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the filtering and sorting logic for skeleton annotations. # Test: Search for the filtering and sorting logic in the codebase. Expect: Correct implementation of filtering and sorting by visibility and label. rg --type python -A 5 $'elements=sorted'Length of output: 70
Script:
#!/bin/bash # Description: Verify the filtering and sorting logic for skeleton annotations. # Test: Search for the filtering and sorting logic in the codebase. Expect: Correct implementation of filtering and sorting by visibility and label. rg --type py -A 5 $'elements=sorted'Length of output: 780
cvat-ai/cvat#8340 |
self.CONVERTER.convert(source_dataset, test_dir, save_media=True) | ||
|
||
assert os.listdir(osp.join(test_dir, "labels", "train")) == [] | ||
parsed_dataset = Dataset.import_from(test_dir, self.IMPORTER.NAME) | ||
self.compare_datasets(source_dataset, parsed_dataset) | ||
Dataset.import_from(test_dir, self.IMPORTER.NAME) |
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.
It would be useful to check that the imported dataset has the expected value (i.e. the same as the original dataset, just without the annotation).
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.
done
Quality Gate passedIssues Measures |
Summary
How to test
Checklist
develop
branchLicense
Feel free to contact the maintainers if that's a concern.
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Documentation