-
Notifications
You must be signed in to change notification settings - Fork 3.2k
YOLOv8 support #8240
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
YOLOv8 support #8240
Conversation
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 WalkthroughThis update enhances the project by introducing support for YOLOv8 formats, improving its functionality for object detection tasks. It includes new export and import capabilities for various YOLOv8 formats and updates relevant tests to ensure compatibility. Additionally, it upgrades several dependencies to their latest versions, ensuring the robustness and performance of the application. The documentation has also been expanded to guide users in utilizing the new YOLOv8 features effectively. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CVAT
participant YOLOv8Exporter
participant YOLOv8Importer
User->>CVAT: Request to export dataset
CVAT->>YOLOv8Exporter: Initiate export process
YOLOv8Exporter->>CVAT: Export dataset in YOLOv8 format
CVAT->>User: Provide exported dataset
User->>CVAT: Request to import dataset
CVAT->>YOLOv8Importer: Initiate import process
YOLOv8Importer->>CVAT: Import dataset in YOLOv8 format
CVAT->>User: Confirm successful import
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
Outside diff range, codebase verification and nitpick comments (4)
site/content/en/docs/manual/advanced/formats/format-yolov8.md (1)
8-12
: Fix grammatical issue.Add the missing article for clarity.
- YOLOv8 is format family which consists of four formats: + YOLOv8 is a format family which consists of four formats:Tools
LanguageTool
[uncategorized] ~8-~8: Possible missing article found.
Context: ... data in YOLOv8 formats' --- YOLOv8 is format family which consists of four formats: ...(AI_HYDRA_LEO_MISSING_A)
cvat/apps/engine/tests/test_rest_api.py (3)
6117-6117
: Add a comment to explain the new condition.Consider adding a comment to explain the purpose of this condition for "YOLOv8 Detection 1.0".
# Handle YOLOv8 Detection format
6120-6120
: Add a comment to explain the new condition.Consider adding a comment to explain the purpose of this condition for "YOLOv8 Oriented Bounding Boxes 1.0".
# Handle YOLOv8 Oriented Bounding Boxes format
6123-6123
: Add a comment to explain the new condition.Consider adding a comment to explain the purpose of this condition for "YOLOv8 Segmentation 1.0".
# Handle YOLOv8 Segmentation format
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (13)
- changelog.d/20240730_160939_dmitrii.lavrukhin_yolo8_support.md (1 hunks)
- cvat/apps/dataset_manager/formats/yolo.py (2 hunks)
- cvat/apps/dataset_manager/tests/test_formats.py (3 hunks)
- cvat/apps/dataset_manager/tests/test_rest_api_formats.py (5 hunks)
- cvat/apps/engine/tests/test_rest_api.py (2 hunks)
- cvat/requirements/base.in (1 hunks)
- cvat/requirements/base.txt (6 hunks)
- cvat/requirements/development.txt (1 hunks)
- cvat/requirements/production.txt (1 hunks)
- site/content/en/docs/manual/advanced/formats/format-yolo.md (1 hunks)
- site/content/en/docs/manual/advanced/formats/format-yolov8.md (1 hunks)
- tests/python/rest_api/test_projects.py (1 hunks)
- tests/python/rest_api/test_tasks.py (2 hunks)
Files skipped from review due to trivial changes (3)
- cvat/requirements/base.txt
- cvat/requirements/production.txt
- site/content/en/docs/manual/advanced/formats/format-yolo.md
Additional context used
LanguageTool
site/content/en/docs/manual/advanced/formats/format-yolov8.md
[uncategorized] ~8-~8: Possible missing article found.
Context: ... data in YOLOv8 formats' --- YOLOv8 is format family which consists of four formats: ...(AI_HYDRA_LEO_MISSING_A)
Additional comments not posted (24)
changelog.d/20240730_160939_dmitrii.lavrukhin_yolo8_support.md (1)
1-4
: Changelog entry looks good.The changelog entry is clear and follows the project's conventions.
cvat/requirements/base.in (1)
9-9
: Dependency update looks good.The
datumaro
package version has been updated to a new commit hash. Ensure that the new version has been tested and does not introduce any breaking changes.cvat/requirements/development.txt (1)
66-66
: Dependency update looks good.The
setuptools
package version has been updated to72.1.0
. Ensure that the new version has been tested and does not introduce any breaking changes.site/content/en/docs/manual/advanced/formats/format-yolov8.md (2)
1-6
: LGTM!The header metadata is correctly formatted.
14-109
: LGTM!The export section is well-structured and informative.
cvat/apps/dataset_manager/formats/yolo.py (8)
58-64
: LGTM!The
_export
function for YOLOv8 Detection is well-implemented and follows best practices.
66-72
: LGTM!The
_export
function for YOLOv8 Oriented Bounding Boxes is well-implemented and follows best practices.
74-80
: LGTM!The
_export
function for YOLOv8 Segmentation is well-implemented and follows best practices.
82-88
: LGTM!The
_export
function for YOLOv8 Pose is well-implemented and follows best practices.
90-100
: LGTM!The
_import
function for YOLOv8 Detection is well-implemented and follows best practices.
102-112
: LGTM!The
_import
function for YOLOv8 Segmentation is well-implemented and follows best practices.
114-124
: LGTM!The
_import
function for YOLOv8 Oriented Bounding Boxes is well-implemented and follows best practices.
126-135
: LGTM!The
_import
function for YOLOv8 Pose is well-implemented and follows best practices.cvat/apps/dataset_manager/tests/test_formats.py (3)
312-316
: LGTM!The additions to the
test_export_formats_query
method are consistent and ensure that the new YOLOv8 formats are included in the export formats query.
349-352
: LGTM!The additions to the
test_import_formats_query
method are consistent and ensure that the new YOLOv8 formats are included in the import formats query.
402-405
: LGTM!The additions to the
test_empty_images_are_exported
method are consistent and ensure that the new YOLOv8 formats are tested for empty images export.tests/python/rest_api/test_projects.py (1)
837-840
: LGTM! Ensure the new YOLOv8 formats are correctly handled.The new entries for YOLOv8 dataset variants are correctly added and specify the path format for images. Ensure that the system correctly handles these new formats during export.
Verification successful
The new YOLOv8 formats are correctly handled and integrated.
The search results show that the new YOLOv8 formats are used across multiple test files, indicating that they are being tested and handled correctly within the codebase. The entries for YOLOv8 dataset variants are appropriately added and specified.
tests/python/rest_api/test_projects.py
tests/python/rest_api/test_tasks.py
cvat/apps/dataset_manager/tests/test_rest_api_formats.py
cvat/apps/dataset_manager/tests/test_formats.py
cvat/apps/engine/tests/test_rest_api.py
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new YOLOv8 formats are correctly handled in the codebase. # Test: Search for the usage of the new YOLOv8 formats. Expect: Correct handling of these formats. rg --type python -A 5 $'YOLOv8 Detection 1.0|YOLOv8 Oriented Bounding Boxes 1.0|YOLOv8 Segmentation 1.0|YOLOv8 Pose 1.0'Length of output: 152
Script:
#!/bin/bash # Description: Verify that the new YOLOv8 formats are correctly handled in the codebase. # Test: Search for the usage of the new YOLOv8 formats. Expect: Correct handling of these formats. rg --glob '*.py' -A 5 $'YOLOv8 Detection 1.0|YOLOv8 Oriented Bounding Boxes 1.0|YOLOv8 Segmentation 1.0|YOLOv8 Pose 1.0'Length of output: 9182
cvat/apps/dataset_manager/tests/test_rest_api_formats.py (5)
413-413
: Verify the inclusion of "YOLOv8 Detection 1.0".Ensure that all necessary changes related to the "YOLOv8 Detection 1.0" format are included and correctly implemented.
520-520
: Verify the inclusion of "YOLOv8 Detection 1.0".Ensure that all necessary changes related to the "YOLOv8 Detection 1.0" format are included and correctly implemented.
966-966
: Verify the inclusion of "YOLOv8 Detection 1.0".Ensure that all necessary changes related to the "YOLOv8 Detection 1.0" format are included and correctly implemented.
1080-1081
: Verify the inclusion of "YOLOv8 Detection 1.0".Ensure that all necessary changes related to the "YOLOv8 Detection 1.0" format are included and correctly implemented.
2055-2055
: Verify the inclusion of "YOLOv8 Detection 1.0".Ensure that all necessary changes related to the "YOLOv8 Detection 1.0" format are included and correctly implemented.
tests/python/rest_api/test_tasks.py (2)
817-819
: Verify the addition of the new format.Ensure that the new format "YOLOv8 Detection 1.0" is correctly integrated and that all necessary checks and validations are in place.
2930-2933
: Verify the addition of the new formats.Ensure that the new formats "YOLOv8 Oriented Bounding Boxes 1.0", "YOLOv8 Detection 1.0", "YOLOv8 Pose 1.0", and "YOLOv8 Segmentation 1.0" are correctly integrated and that all necessary checks and validations are in place.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #8240 +/- ##
===========================================
+ Coverage 83.34% 83.36% +0.01%
===========================================
Files 393 393
Lines 41579 41616 +37
Branches 3843 3843
===========================================
+ Hits 34655 34693 +38
+ Misses 6924 6923 -1
|
@Eldies , could you please resolve conflicts? |
@Eldies , should we keep empty txt files? It looks like it isn't required: https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data#12-create-labels-1 |
datumaro.components.errors.DatasetExportError: Can't export: skeletons should have the same number of points |
# Conflicts: # cvat/requirements/base.in # cvat/requirements/base.txt
@Eldies , cannot import annotations to a job with skeletons at least. "KeyError: 'project'". The same annotation can be loaded into a task. |
"type": "points" | ||
} | ||
], | ||
"svg": "<line x1=\"38.92810821533203\" y1=\"53.31378173828125\" x2=\"80.23341369628906\" y2=\"18.36313819885254\" stroke=\"black\" data-type=\"edge\" data-node-from=\"2\" stroke-width=\"0.5\" data-node-to=\"3\"></line><line x1=\"30.399484634399414\" y1=\"32.74474334716797\" x2=\"38.92810821533203\" y2=\"53.31378173828125\" stroke=\"black\" data-type=\"edge\" data-node-from=\"1\" stroke-width=\"0.5\" data-node-to=\"2\"></line><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"30.399484634399414\" cy=\"32.74474334716797\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"1\" data-node-id=\"1\" data-label-name=\"1\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"38.92810821533203\" cy=\"53.31378173828125\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"2\" data-node-id=\"2\" data-label-name=\"2\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"80.23341369628906\" cy=\"18.36313819885254\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"3\" data-node-id=\"3\" data-label-name=\"3\"></circle>" |
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 make for a better test if the circles in the SVG were not in the same order as the sublabels in the sublabels
field. That way, you could test that the importer is actually taking the order from the SVG.
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.
Isn't it the same order?
as far as I understand, sub labels are being loaded here, from svg, and therefore have the same order: https://github.com/cvat-ai/cvat/blob/develop/cvat/apps/dataset_manager/bindings.py#L1465
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.
Sure, but the point is to test that nothing unusual happens if the sublabels are listed in a different order in sublabels
vs svg
.
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.
I don't understand how that situation can happen
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.
The order of the elements in the sublabels
array and the svg
string are determined by whoever calls the API. An API client could just list the sublabels in different orders in those two fields.
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.
changed the order in svg
. It caused skeleton annotation elements to change order, so I updated compare_datasets function to allow it.
I am not sure: probably I should update ExactComparator and compare_datasets in datumaro to allow skeleton elements to have different order
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.
I am not sure: probably I should update ExactComparator and compare_datasets in datumaro to allow skeleton elements to have different order
That would probably be a good idea, but I'm okay with the current solution too.
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.
added it (and a small bugfix) in cvat-ai/datumaro#57
Co-authored-by: Roman Donchenko <[email protected]>
removing this requirement in cvat-ai/datumaro#55 |
|
||
@exporter(name='YOLOv8 Detection', ext='ZIP', version='1.0') | ||
def _export_yolov8_detection(dst_file, temp_dir, instance_data, save_images=False): | ||
_export_common(dst_file, temp_dir, instance_data, 'yolov8', save_images=save_images) |
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.
I would recommend to use here 'yolov8_detection'. In the future, we can use yolov8 for exporting all annotations. All other variants have format suffix. I would add it for YOLOv8 Detection as well for consistency.
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.
renamed
For skeletons we dump all points name. I'm not sure it is correct. names: |
The current implementation of YOLOv8 segmentation doesn't support masks. I believe it is a problem. At the same time, there is a tricky case, which we need to understand how to dump. It is a mask with holes. Probably, here is the solution: ultralytics/ultralytics#1106 |
supported masks, including masks with holes
Only dump skeleton label now |
|
txt files without annotations are still present. I created a skeleton on the 1st image, polygon and mask on the 2nd and exported in the segmentation format. I got two annotation files. One of them was empty. |
Hi! Try: |
## Summary by CodeRabbit - **New Features** - Introduced support for YOLOv8 formats, enhancing object detection capabilities. - Added new export and import functions for YOLOv8 formats within the dataset manager. - Expanded documentation to cover YOLOv8 format specifications and export processes. - **Bug Fixes** - Improved handling of various YOLOv8 annotation formats to ensure accurate processing. - **Tests** - Enhanced test coverage for YOLOv8 formats in both dataset export/import and REST API functionalities. - **Documentation** - Updated existing links in the YOLO format documentation for clarity. - Added new documentation detailing YOLOv8 formats and their export processes. Co-authored-by: Roman Donchenko <[email protected]>
Motivation and context
Adding support for YOLOv8 formats
How has this been tested?
Checklist
develop
branch(cvat-canvas,
cvat-core,
cvat-data and
cvat-ui)
License
Feel free to contact the maintainers if that's a concern.
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Documentation