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

Export only annotated images option. #8340

Open
wants to merge 54 commits into
base: develop
Choose a base branch
from

Conversation

bschultz96
Copy link

@bschultz96 bschultz96 commented Aug 22, 2024

Added radio buttons to export either all images or only annotated images when "Save Images" is selected during export process.

The default is set to True to match with the previous behavior when saving images.

Motivation and context

This is a useful addition when creating and adding to datasets. We had been using a work around to export only the annotated images but decided doing the work to implement this would be worthwhile.

How has this been tested?

Manual testing, exporting projects, tasks, and jobs have all been tested.

Checklist

  • I submit my changes into the develop branch
    - [ ] I have created a changelog fragment
    - [ ] I have updated the documentation accordingly
    - [ ] I have added tests to cover my changes
    - [ ] I have linked related issues (see GitHub docs)
    - [ ] I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

Summary by CodeRabbit

  • New Features

    • Introduced a new allImages parameter for dataset export, allowing users to choose whether to export all images or only those with annotations across various export functions.
    • Enhanced the export UI with new options for saving images in the export modal.
  • Bug Fixes

    • Resolved issues related to export functionality ensuring that the allImages parameter is correctly applied.
  • Documentation

    • Updated API documentation to include the new allImages parameter, providing clarity on its purpose and default value.
  • Style

    • Improved UI aesthetics related to the export modal for better user experience.

Copy link
Contributor

coderabbitai bot commented Aug 22, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent changes across the codebase introduce a new parameter, allImages, to various export-related functions and classes. This parameter allows users to specify whether all images should be included in dataset exports. Modifications were made to function signatures, internal logic, and API documentation to accommodate this new functionality, improving the granularity and flexibility of the export processes throughout the application.

Changes

Files Change Summary
cvat-core/src/annotations.ts, cvat-core/src/project-implementation.ts, cvat-core/src/project.ts, cvat-core/src/server-proxy.ts, cvat-core/src/session-implementation.ts, cvat-core/src/session.ts, cvat-ui/src/actions/export-actions.ts Added allImages parameter to export functions, modifying function signatures and internal logic to include this parameter for more control over image inclusion during exports.
cvat-ui/src/components/export-dataset/export-dataset-modal.tsx Updated form in the export dataset modal to include a new option for saving all images, modifying the FormValues type and handling state management accordingly.
cvat/apps/dataset_manager/bindings.py, cvat/apps/dataset_manager/formats/*.py Introduced all_images parameter in multiple functions and classes, enhancing the ability to control image inclusion in dataset exports across various formats.
cvat/apps/dataset_manager/project.py, cvat/apps/dataset_manager/task.py Updated export_project, export_job, and export_task functions to include the all_images parameter in their signatures, allowing for more dynamic export options.
cvat/apps/dataset_manager/util.py, cvat/apps/engine/background.py, cvat/apps/engine/views.py Modified functions to integrate the all_images parameter for enhanced export filename generation and callback handling, improving the granularity of image export control across the engine.
cvat/schema.yml Added a new query parameter all_images as a boolean to allow users to specify whether to include all images in dataset exports.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant API
    participant ExportManager
    participant Dataset
    
    User->>API: Request Export with all_images
    API->>ExportManager: Pass all_images parameter
    ExportManager->>Dataset: Export Dataset with all_images
    Dataset-->>ExportManager: Return Export Status
    ExportManager-->>API: Return API Response
    API-->>User: Provide Export Results
Loading

🐇 In the meadow, I hop and play,
With new exports brightening the day!
All images saved, what a delight,
A dataset journey, pure and bright!
Let's celebrate this joyous feat,
With carrots and love, life is sweet! 🥕✨


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 (1)
cvat/apps/engine/utils.py (1)

393-398: Update function calls to include the all_images parameter

The build_annotations_file_name function has been updated with a new all_images parameter, but the current calls to this function in cvat/apps/engine/background.py do not include this parameter. Please update these calls to ensure consistency in the filename generation logic.

  • cvat/apps/engine/background.py: Update calls to build_annotations_file_name to include the all_images parameter.
Analysis chain

Ensure consistency in the build_annotations_file_name logic.

The addition of the all_images parameter allows for more nuanced filename generation. Verify that the logic aligns with the intended behavior and that all relevant code paths are updated.

Run the following script to verify the function usage:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `build_annotations_file_name` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'build_annotations_file_name'

Length of output: 82


Script:

#!/bin/bash
# Description: Verify all function calls to `build_annotations_file_name` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 $'build_annotations_file_name'

Length of output: 1713

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3f57f2a and 186c928.

Files selected for processing (40)
  • cvat-core/src/annotations.ts (2 hunks)
  • cvat-core/src/project-implementation.ts (1 hunks)
  • cvat-core/src/project.ts (2 hunks)
  • cvat-core/src/server-proxy.ts (3 hunks)
  • cvat-core/src/session-implementation.ts (2 hunks)
  • cvat-core/src/session.ts (3 hunks)
  • cvat-ui/src/actions/export-actions.ts (2 hunks)
  • cvat-ui/src/components/export-dataset/export-dataset-modal.tsx (7 hunks)
  • cvat/apps/dataset_manager/bindings.py (5 hunks)
  • cvat/apps/dataset_manager/formats/camvid.py (1 hunks)
  • cvat/apps/dataset_manager/formats/cityscapes.py (1 hunks)
  • cvat/apps/dataset_manager/formats/coco.py (2 hunks)
  • cvat/apps/dataset_manager/formats/cvat.py (4 hunks)
  • cvat/apps/dataset_manager/formats/datumaro.py (2 hunks)
  • cvat/apps/dataset_manager/formats/icdar.py (3 hunks)
  • cvat/apps/dataset_manager/formats/imagenet.py (1 hunks)
  • cvat/apps/dataset_manager/formats/kitti.py (1 hunks)
  • cvat/apps/dataset_manager/formats/labelme.py (1 hunks)
  • cvat/apps/dataset_manager/formats/lfw.py (1 hunks)
  • cvat/apps/dataset_manager/formats/market1501.py (1 hunks)
  • cvat/apps/dataset_manager/formats/mask.py (1 hunks)
  • cvat/apps/dataset_manager/formats/mot.py (1 hunks)
  • cvat/apps/dataset_manager/formats/mots.py (1 hunks)
  • cvat/apps/dataset_manager/formats/openimages.py (1 hunks)
  • cvat/apps/dataset_manager/formats/pascal_voc.py (1 hunks)
  • cvat/apps/dataset_manager/formats/pointcloud.py (1 hunks)
  • cvat/apps/dataset_manager/formats/velodynepoint.py (1 hunks)
  • cvat/apps/dataset_manager/formats/vggface2.py (1 hunks)
  • cvat/apps/dataset_manager/formats/widerface.py (1 hunks)
  • cvat/apps/dataset_manager/formats/yolo.py (1 hunks)
  • cvat/apps/dataset_manager/project.py (2 hunks)
  • cvat/apps/dataset_manager/task.py (4 hunks)
  • cvat/apps/dataset_manager/util.py (1 hunks)
  • cvat/apps/dataset_manager/views.py (4 hunks)
  • cvat/apps/engine/background.py (6 hunks)
  • cvat/apps/engine/mixins.py (3 hunks)
  • cvat/apps/engine/utils.py (1 hunks)
  • cvat/apps/engine/views.py (3 hunks)
  • cvat/apps/events/handlers.py (1 hunks)
  • cvat/schema.yml (3 hunks)
Additional comments not posted (70)
cvat/apps/dataset_manager/formats/widerface.py (1)

18-21: LGTM! But verify the function usage in the codebase.

The addition of the all_images parameter to the _export function is well-implemented and aligns with the PR objectives.

However, ensure that all function calls to _export correctly handle the new all_images parameter.

Run the following script to verify the function usage:

Verification successful

No direct usage of _export function in widerface.py found in the codebase. The _export function in widerface.py is not directly referenced or imported elsewhere, indicating that the addition of the all_images parameter does not affect other parts of the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `_export` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'_export'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify all function calls to `_export` match the new signature.

# Corrected Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 '_export'

Length of output: 158023


Script:

#!/bin/bash
# Description: Search for any imports or references to the `_export` function in widerface.py

# Search for imports of widerface.py
rg --type py 'import widerface' -A 5

# Search for any references to the `_export` function in widerface.py
rg --type py '_export' -A 5

Length of output: 158062

cvat/apps/dataset_manager/formats/lfw.py (1)

27-28: LGTM! But verify the function usage in the codebase.

The addition of the all_images parameter to the _exporter function is well-implemented and aligns with the PR objectives.

However, ensure that all function calls to _exporter correctly handle the new all_images parameter.

Run the following script to verify the function usage:

Verification successful

Function usage verified successfully. The all_images parameter in the _exporter function is correctly handled in the codebase through the make_exporter function. The parameter is passed appropriately in the export calls in the following files:

  • cvat/apps/dataset_manager/project.py
  • cvat/apps/dataset_manager/task.py
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `_exporter` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'_exporter'

Length of output: 64


Script:

#!/bin/bash
# Corrected script to verify all function calls to `_exporter` match the new signature.

# Search for the function usage in Python files and include context lines.
rg '_exporter' --glob '*.py' -A 5

Length of output: 3336

cvat/apps/dataset_manager/formats/vggface2.py (1)

18-21: LGTM! But verify the function usage in the codebase.

The addition of the all_images parameter to the _export function is well-implemented and aligns with the PR objectives.

However, ensure that all function calls to _export correctly handle the new all_images parameter.

Run the following script to verify the function usage:

Verification successful

Function Usage Verification: _export in vggface2.py

The _export function in vggface2.py correctly handles the all_images parameter in its implementation. However, there are no direct calls to this function within the file, suggesting it might be used elsewhere in the codebase or intended for internal use. No further issues were found regarding the handling of the new parameter.

  • The _export function correctly includes all_images in its call to dataset.export.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `_export` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'_export'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify all function calls to `_export` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 $'_export'

Length of output: 158023


Script:

#!/bin/bash
# Description: Verify the usage of `_export` within the vggface2.py file to ensure the new parameter is handled correctly.

# Test: Search for the function usage within the file.
rg --type py -A 5 '_export' cvat/apps/dataset_manager/formats/vggface2.py

Length of output: 445

cvat/apps/dataset_manager/formats/labelme.py (1)

18-19: LGTM! The addition of the all_images parameter enhances flexibility.

The changes align with the PR objectives and provide more control over the export process.

cvat/apps/dataset_manager/formats/imagenet.py (1)

20-21: LGTM! The addition of the all_images parameter enhances flexibility.

The changes align with the PR objectives and provide more control over the export process.

cvat/apps/dataset_manager/formats/pointcloud.py (1)

19-21: LGTM! The addition of the all_images parameter enhances flexibility.

The changes align with the PR objectives and provide more control over the export process.

cvat/apps/dataset_manager/formats/mask.py (1)

18-19: Enhance flexibility with the all_images parameter.

The addition of the all_images parameter to the _export function provides users with the flexibility to choose whether to include all images during the export process. Ensure that this parameter is correctly handled in all relevant parts of the codebase.

Run the following script to verify the function usage:

Verification successful

Ensure correct handling of the all_images parameter across the codebase.

The all_images parameter is consistently included in the _export function signatures across various files, indicating that it is correctly handled. The function calls match the new signature, ensuring flexibility in the export process.

  • The _export function in mask.py and other related files includes the all_images parameter.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `_export` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'_export'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify all function calls to `_export` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 $'_export'

Length of output: 158023

cvat/apps/dataset_manager/formats/camvid.py (1)

19-20: Enhance flexibility with the all_images parameter.

The addition of the all_images parameter to the _export function provides users with the flexibility to choose whether to include all images during the export process. Ensure that this parameter is correctly handled in all relevant parts of the codebase.

Run the following script to verify the function usage:

cvat/apps/dataset_manager/formats/velodynepoint.py (1)

29-31: Enhance flexibility with the all_images parameter.

The addition of the all_images parameter to the _export_images function provides users with the flexibility to choose whether to include all images during the export process. Ensure that this parameter is correctly handled in all relevant parts of the codebase.

Run the following script to verify the function usage:

Verification successful

The all_images parameter is correctly handled across the codebase.

The _export_images function, with the all_images parameter, is used consistently across different files, ensuring its proper handling. The parameter is correctly passed to relevant functions, confirming its integration.

  • cvat/apps/dataset_manager/formats/pointcloud.py
  • cvat/apps/dataset_manager/formats/velodynepoint.py
  • cvat/apps/dataset_manager/formats/cvat.py
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `_export_images` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'_export_images'

Length of output: 69


Script:

#!/bin/bash
# Description: Verify all function calls to `_export_images` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 $'_export_images'

Length of output: 1936

cvat/apps/dataset_manager/formats/yolo.py (1)

22-23: Verify the integration of the all_images parameter.

The addition of the all_images parameter to the _export function and its usage in GetCVATDataExtractor enhances configurability. Ensure that this parameter is correctly passed and utilized in all relevant parts of the codebase.

Run the following script to verify the function usage:

cvat/apps/dataset_manager/formats/cityscapes.py (1)

22-23: Verify the integration of the all_images parameter.

The addition of the all_images parameter to the _export function and its usage in GetCVATDataExtractor enhances configurability. Ensure that this parameter is correctly passed and utilized in all relevant parts of the codebase.

Run the following script to verify the function usage:

cvat/apps/dataset_manager/formats/kitti.py (1)

22-23: Verify the integration of the all_images parameter.

The addition of the all_images parameter to the _export function and its usage in GetCVATDataExtractor enhances configurability. Ensure that this parameter is correctly passed and utilized in all relevant parts of the codebase.

Run the following script to verify the function usage:

Verification successful

Integration of all_images Parameter Verified

The all_images parameter is consistently passed to GetCVATDataExtractor across multiple files, confirming its correct integration in the codebase. No issues were found.

  • Instances in files like yolo.py, kitti.py, coco.py, and others show correct usage.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `_export` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'_export'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify all function calls to `_export` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 '_export('

Length of output: 97


Script:

#!/bin/bash
# Description: Verify all function calls to `_export` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 '_export\('

Length of output: 35114


Script:

#!/bin/bash
# Description: Search for references to the `_export` function to verify parameter usage.

# Test: Search for references or calls to `_export`. Expect: To find how the function is invoked.
rg --type py '_export'

Length of output: 41045


Script:

#!/bin/bash
# Description: Search for instances of `GetCVATDataExtractor` to verify `all_images` usage.

# Test: Search for `GetCVATDataExtractor` usage. Expect: To verify `all_images` parameter usage.
rg --type py 'GetCVATDataExtractor'

Length of output: 6388

cvat/apps/dataset_manager/formats/pascal_voc.py (1)

22-23: LGTM! Verify the all_images parameter usage.

The addition of the all_images parameter enhances the flexibility of the export process. The changes align with the PR objectives.

Ensure that the all_images parameter is correctly utilized in the codebase.

Run the following script to verify the usage of the all_images parameter:

Verification successful

The all_images parameter is correctly utilized across the codebase. The parameter is consistently used in various export functions, ensuring the intended flexibility in handling images during export processes.

  • cvat/apps/dataset_manager/formats/pascal_voc.py: Used in _export function.
  • cvat/apps/dataset_manager/formats/mots.py: Used in _export function.
  • cvat/apps/dataset_manager/formats/yolo.py: Used in _export function.
  • And many other files as shown in the search results.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `all_images` parameter in the codebase.

# Test: Search for the `all_images` parameter usage. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'all_images='

Length of output: 66


Script:

#!/bin/bash
# Corrected command to verify the usage of the `all_images` parameter in the codebase.

# Test: Search for the `all_images` parameter usage. Expect: Consistent usage across the codebase.
rg -A 5 'all_images='

Length of output: 30651

cvat/apps/dataset_manager/formats/datumaro.py (1)

28-29: LGTM! Verify the all_images parameter usage.

The addition of the all_images parameter in both instances of the _export function enhances the flexibility of the export process. The changes align with the PR objectives.

Ensure that the all_images parameter is correctly utilized in the codebase.

Run the following script to verify the usage of the all_images parameter:

Also applies to: 49-51

Verification successful

The all_images parameter is correctly utilized across the codebase.

The all_images parameter is consistently used in various export functions and related processes, aligning with the intended functionality. No issues were found with its implementation.

  • Files with all_images usage:
    • cvat/apps/events/handlers.py
    • cvat/apps/engine/background.py
    • cvat/apps/engine/mixins.py
    • cvat/apps/dataset_manager/task.py
    • cvat/apps/dataset_manager/views.py
    • cvat/apps/dataset_manager/project.py
    • cvat/apps/dataset_manager/formats/*
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `all_images` parameter in the codebase.

# Test: Search for the `all_images` parameter usage. Expect: Consistent usage across the codebase.
rg --type python -A 5 $'all_images='

Length of output: 66


Script:

#!/bin/bash
# Description: Verify the usage of the `all_images` parameter in the codebase.

# Test: Search for the `all_images` parameter usage. Expect: Consistent usage across the codebase.
rg --type py -A 5 $'all_images='

Length of output: 30661

cvat/apps/dataset_manager/formats/market1501.py (1)

64-65: LGTM! Verify the all_images parameter usage.

The addition of the all_images parameter enhances the flexibility of the export process. The changes align with the PR objectives.

Ensure that the all_images parameter is correctly utilized in the codebase.

Run the following script to verify the usage of the all_images parameter:

cvat/apps/dataset_manager/formats/openimages.py (1)

41-42: Enhancement: Added all_images parameter to _export.

The addition of the all_images parameter provides more control over the image export process. The default value of True maintains backward compatibility.

Verify that the GetCVATDataExtractor correctly handles the all_images parameter.

Run the following script to verify the usage of the all_images parameter in GetCVATDataExtractor:

cvat/apps/dataset_manager/formats/coco.py (2)

43-44: Enhancement: Added all_images parameter to _export.

The addition of the all_images parameter provides more control over the image export process. The default value of True maintains backward compatibility.

Verify that the GetCVATDataExtractor correctly handles the all_images parameter.

Run the following script to verify the usage of the all_images parameter in GetCVATDataExtractor:


19-20: Enhancement: Added all_images parameter to _export.

The addition of the all_images parameter provides more control over the image export process. The default value of True maintains backward compatibility.

Verify that the GetCVATDataExtractor correctly handles the all_images parameter.

Run the following script to verify the usage of the all_images parameter in GetCVATDataExtractor:

cvat/apps/dataset_manager/formats/mot.py (1)

96-97: Enhancement: Added all_images parameter to _export.

The addition of the all_images parameter provides more control over the image export process. The default value of True maintains backward compatibility.

Verify that the GetCVATDataExtractor correctly handles the all_images parameter.

Run the following script to verify the usage of the all_images parameter in GetCVATDataExtractor:

cvat/apps/dataset_manager/formats/mots.py (1)

96-97: Enhancement: Added all_images parameter to _export.

The addition of the all_images parameter allows for more control over the export process, aligning with the PR's objective to provide an option for exporting only annotated images.

cvat-ui/src/actions/export-actions.ts (2)

106-106: Enhancement: Added allImages parameter to exportDatasetAsync.

The inclusion of the allImages parameter provides more granular control over the dataset export process, allowing users to specify whether all images should be included.


118-118: Update: Modified call to exportDataset to include allImages.

The call to instance.annotations.exportDataset now includes the allImages parameter, ensuring that the export process respects the user's choice regarding image inclusion.

cvat/apps/dataset_manager/formats/icdar.py (3)

80-81: Enhancement: Added all_images parameter to _export_recognition.

The inclusion of the all_images parameter allows for more flexible data extraction, aligning with the PR's objective to provide an option for exporting only annotated images.


103-104: Enhancement: Added all_images parameter to _export_localization.

The addition of the all_images parameter provides more control over the export process, enhancing the flexibility of the function.


125-126: Enhancement: Added all_images parameter to _export_segmentation.

The inclusion of the all_images parameter allows users to specify their preference for image inclusion during the export process, improving the function's configurability.

cvat/apps/dataset_manager/util.py (1)

163-173: LGTM! Verify the usage of the new parameter.

The changes to the make_export_filename function look good. The new parameter all_images is correctly integrated into the logic.

However, ensure that all calls to make_export_filename are updated to include the new all_images parameter.

Run the following script to verify the function usage:

Verification successful

Function Usage Verified: The make_export_filename function is correctly called with the all_images parameter in the codebase. No further updates are necessary.

  • The function call in cvat/apps/dataset_manager/views.py includes the all_images parameter.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `make_export_filename` include the new `all_images` parameter.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'make_export_filename'

Length of output: 75


Script:

#!/bin/bash
# Description: Verify all function calls to `make_export_filename` include the new `all_images` parameter.

# Corrected command to search for the function usage.
rg 'make_export_filename' --type py -A 5

Length of output: 1195

cvat-core/src/project-implementation.ts (1)

114-127: LGTM! Verify the usage of the new parameter.

The changes to the exportDataset function call look good. The new parameter allImages is correctly integrated into the logic.

However, ensure that all calls to exportDataset are updated to include the new allImages parameter.

Run the following script to verify the function usage:

Verification successful

All function calls to exportDataset include the allImages parameter. The integration of the new parameter is consistent across the codebase.

  • The allImages parameter is correctly included in calls to exportDataset in various files such as cvat-ui/src/actions/export-actions.ts, cvat-core/src/project-implementation.ts, and others.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `exportDataset` include the new `allImages` parameter.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type js -A 5 $'exportDataset'

Length of output: 9025


Script:

#!/bin/bash
# Description: Search for direct calls to the `exportDataset` function in the codebase to verify the inclusion of the `allImages` parameter.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts --type js -A 5 'exportDataset('

Length of output: 125


Script:

#!/bin/bash
# Description: Search for direct calls to the `exportDataset` function in the codebase to verify the inclusion of the `allImages` parameter.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts --type js -A 5 'exportDataset\('

Length of output: 5529

cvat/apps/dataset_manager/project.py (1)

Line range hint 29-41: LGTM! Verify the usage of the new parameter.

The changes to the export_project function look good. The new parameter all_images is correctly integrated into the logic.

However, ensure that all calls to export_project are updated to include the new all_images parameter.

Run the following script to verify the function usage:

Verification successful

Verification Successful: The all_images parameter is correctly integrated.

The export_project function is not directly called elsewhere in the codebase, indicating that its usage is consistent with the changes made. The related functions in views.py correctly incorporate the all_images parameter.

  • No direct calls to export_project were found outside its definition.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `export_project` include the new `all_images` parameter.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'export_project'

Length of output: 69


Script:

#!/bin/bash
# Description: Verify all function calls to `export_project` include the new `all_images` parameter.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg -t py -A 5 'export_project'

Length of output: 13638


Script:

#!/bin/bash
# Description: Verify all direct calls to `export_project` include the new `all_images` parameter.

# Test: Search for direct calls to the `export_project` function.
rg -t py 'export_project('

Length of output: 109


Script:

#!/bin/bash
# Description: Verify all direct calls to `export_project` include the new `all_images` parameter.

# Test: Search for direct calls to the `export_project` function.
rg -t py 'export_project\('

Length of output: 441

cvat-core/src/annotations.ts (1)

140-140: Verify the usage of the allImages parameter.

Ensure that the allImages parameter is correctly passed and utilized in the serverProxy calls for tasks, jobs, and projects.

Run the following script to verify the usage of the allImages parameter in the serverProxy calls:

Verification successful

The allImages parameter is correctly utilized in the codebase.

The allImages parameter is consistently passed and utilized in the exportDataset function calls across various components and modules, including the serverProxy. This confirms its proper integration for tasks, jobs, and projects.

  • cvat-core/src/annotations.ts: Utilizes allImages in serverProxy calls for tasks, jobs, and projects.
  • cvat-ui/src/actions/export-actions.ts: Passes allImages in exportDatasetAsync.
  • cvat-core/src/session.ts: Includes allImages in function definitions and calls.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `allImages` parameter in serverProxy calls.

# Test: Search for the usage of `exportDataset` in serverProxy. Expect: Correct usage of `allImages`.
rg --type typescript -A 5 $'serverProxy.tasks.exportDataset'
rg --type typescript -A 5 $'serverProxy.jobs.exportDataset'
rg --type typescript -A 5 $'serverProxy.projects.exportDataset'

Length of output: 286


Script:

#!/bin/bash
# Description: Verify the usage of the `allImages` parameter in serverProxy calls.

# Test: Search for the usage of `exportDataset` in serverProxy. Expect: Correct usage of `allImages`.
rg --type ts -A 5 $'serverProxy.tasks.exportDataset'
rg --type ts -A 5 $'serverProxy.jobs.exportDataset'
rg --type ts -A 5 $'serverProxy.projects.exportDataset'

Length of output: 157


Script:

#!/bin/bash
# Description: Search for any usage of `exportDataset` in the codebase to verify the `allImages` parameter.

# Test: Search for any occurrence of `exportDataset` in TypeScript files.
rg --type ts -A 5 'exportDataset'

Length of output: 17908

cvat-ui/src/components/export-dataset/export-dataset-modal.tsx (4)

41-41: Verify the default value of allImages.

Ensure that the default value of allImages is correctly set to true in the initialValues object.

Run the following script to verify the default value of allImages:

Verification successful

Default value of allImages is correctly set to true.

The initialValues object in cvat-ui/src/components/export-dataset/export-dataset-modal.tsx confirms that allImages is set to true. No changes are needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the default value of `allImages` in initialValues.

# Test: Search for the default value of `allImages` in initialValues. Expect: Default value is `true`.
rg --type tsx -A 5 $'initialValues'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify the default value of `allImages` in initialValues.

# Test: Search for the default value of `allImages` in initialValues. Expect: Default value is `true`.
rg --glob '*.tsx' -A 10 'initialValues'

Length of output: 21839


32-32: Verify the addition of allImages to FormValues.

Ensure that the allImages property is correctly integrated into the FormValues type and used appropriately in the form.

Run the following script to verify the integration of the allImages property in the form:

Verification successful

Integration of allImages in FormValues Verified

The allImages property is correctly integrated into the FormValues type and is appropriately used in the form logic within export-dataset-modal.tsx. It is utilized in setting form values and is part of the radio button group for image saving options. Additionally, its presence in related files supports its role in the export functionality.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of the `allImages` property in the form.

# Test: Search for the usage of `allImages` in the form. Expect: Correct integration in form logic.
rg --type tsx -A 5 $'allImages'

Length of output: 58


Script:

#!/bin/bash
# Description: Verify the integration of the `allImages` property in the form.

# Test: Search for the usage of `allImages` in the form. Expect: Correct integration in form logic.
rg --type ts -A 5 'allImages'

Length of output: 11439


59-59: Verify the management of saveImages state.

Ensure that the saveImages state is correctly managed and reset when the modal is closed.

Run the following script to verify the management of the saveImages state:

Verification successful

The saveImages state is correctly managed.

The saveImages state is reset to false when the modal is closed, ensuring proper state management. No issues found with the current implementation.

  • The state is initialized with useState(false).
  • It is reset to false when the modal is closed.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the management of `saveImages` state.

# Test: Search for the management of `saveImages` state. Expect: Correct management and reset logic.
rg --type tsx -A 5 $'setSaveImages'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify the management of `saveImages` state.

# Test: Search for the management of `saveImages` state. Expect: Correct management and reset logic.
rg --glob '*.tsx' -A 5 'setSaveImages'

Length of output: 1957


200-210: Verify the conditional rendering of the radio button group.

Ensure that the radio button group for image saving options is correctly conditionally rendered based on the saveImages state.

Run the following script to verify the conditional rendering of the radio button group:

Verification successful

Conditional Rendering Verified

The radio button group for image saving options is correctly conditionally rendered based on the saveImages state. The logic {saveImages && ( ensures that the component is only rendered when saveImages is true.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the conditional rendering of the radio button group.

# Test: Search for the conditional rendering logic of the radio button group. Expect: Correct conditional rendering based on `saveImages`.
rg --type tsx -A 5 $'saveImages &&'

Length of output: 64


Script:

#!/bin/bash
# Description: Verify the conditional rendering of the radio button group.

# Find all .tsx files and search for the conditional rendering logic of the radio button group.
fd --extension tsx --exec rg 'saveImages &&' {}

Length of output: 84

cvat/apps/dataset_manager/views.py (4)

211-212: Verify the new export_project_as_dataset_full function.

Ensure that the export_project_as_dataset_full function is correctly implemented to export with all images.

Run the following script to verify the implementation of the export_project_as_dataset_full function:

Verification successful

Function export_project_as_dataset_full is correctly implemented.

The function is designed to export all images by setting save_images=True and all_images=True. No issues were found with its implementation.

  • Location: cvat/apps/dataset_manager/views.py
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of export_project_as_dataset_full function.

# Test: Search for the implementation of `export_project_as_dataset_full`. Expect: Correct implementation for exporting with all images.
rg --type python -A 5 $'def export_project_as_dataset_full'

Length of output: 91


Script:

#!/bin/bash
# Corrected command to search for the implementation of export_project_as_dataset_full function.
rg -A 5 'def export_project_as_dataset_full'

Length of output: 491


202-203: Verify the new export_task_as_dataset_full function.

Ensure that the export_task_as_dataset_full function is correctly implemented to export with all images.

Run the following script to verify the implementation of the export_task_as_dataset_full function:

Verification successful

The export_task_as_dataset_full function is correctly implemented.

The function correctly calls the export function with all_images=True, ensuring that all images are included in the export process. No issues were found with its implementation.

  • Location: cvat/apps/dataset_manager/views.py at lines 202-203
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of export_task_as_dataset_full function.

# Test: Search for the implementation of `export_task_as_dataset_full`. Expect: Correct implementation for exporting with all images.
rg --type python -A 5 $'def export_task_as_dataset_full'

Length of output: 88


Script:

#!/bin/bash
# Using ast-grep to find the implementation of the export_task_as_dataset_full function
ast-grep --lang python --pattern $'def export_task_as_dataset_full($_, $_, $_):\n    $$$'

Length of output: 348


193-194: Verify the new export_job_as_dataset_full function.

Ensure that the export_job_as_dataset_full function is correctly implemented to export with all images.

Run the following script to verify the implementation of the export_job_as_dataset_full function:

Verification successful

The export_job_as_dataset_full function is correctly implemented.

The function calls export with save_images=True and all_images=True, ensuring it exports all images as intended. The implementation aligns with the expected behavior.

  • Location: cvat/apps/dataset_manager/views.py
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of export_job_as_dataset_full function.

# Test: Search for the implementation of `export_job_as_dataset_full`. Expect: Correct implementation for exporting with all images.
rg --type python -A 5 $'def export_job_as_dataset_full'

Length of output: 87


Script:

#!/bin/bash
# Description: Verify the implementation of export_job_as_dataset_full function.

# Test: Search for the implementation of `export_job_as_dataset_full`. Expect: Correct implementation for exporting with all images.
rg -A 5 $'def export_job_as_dataset_full'

Length of output: 609


100-100: Verify the usage of the all_images parameter in export.

Ensure that the all_images parameter is correctly integrated into the export function and used appropriately in the export logic.

Run the following script to verify the usage of the all_images parameter in the export function:

Verification successful

The all_images parameter is correctly integrated into the export function.

The all_images parameter is used in constructing the export filename and is passed to the export_fn function, indicating its proper integration into the export logic. No issues were found with its usage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `all_images` parameter in export function.

# Test: Search for the usage of `all_images` in export function. Expect: Correct integration in export logic.
rg --type python -A 5 $'def export'

Length of output: 67


Script:

#!/bin/bash
# Description: Verify the usage of the `all_images` parameter in export function.

# Search for the export function and display its implementation to verify the usage of the `all_images` parameter.
rg 'def export' -A 20 cvat/apps/dataset_manager/views.py

Length of output: 3185


Script:

#!/bin/bash
# Description: Verify the usage of the `all_images` parameter in export function by displaying more lines of its implementation.

# Search for the export function and display more lines to capture the usage of the `all_images` parameter.
rg 'def export' -A 50 cvat/apps/dataset_manager/views.py

Length of output: 5807

cvat-core/src/project.ts (2)

37-37: Ensure proper handling of the new allImages parameter.

The addition of the allImages parameter to the exportDataset method enhances flexibility. Ensure that the parameter is correctly handled in all invocations of this method.

Run the following script to verify the function usage:

Verification successful

The allImages parameter is properly handled in the exportDataset method.

The allImages parameter is consistently included in the function signatures and calls across the codebase, indicating correct handling.

  • Files where exportDataset is used with allImages:
    • cvat-core/src/annotations.ts
    • cvat-core/src/project.ts
    • cvat-core/src/session.ts
    • cvat-core/src/server-proxy.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `exportDataset` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'exportDataset'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify all function calls to `exportDataset` match the new signature.

# Corrected Test: Search for the function usage in TypeScript files. Expect: Only occurrences of the new signature.
rg --type ts -A 5 $'exportDataset'

Length of output: 17908


269-279: Verify the propagation of the allImages parameter.

Ensure that the allImages parameter is correctly propagated through the PluginRegistry.apiWrapper.call function, and that any downstream logic that relies on this parameter is updated accordingly.

Run the following script to verify the function usage:

Verification successful

The allImages parameter is correctly propagated and utilized.

The allImages parameter is passed through the PluginRegistry.apiWrapper.call function and is correctly used in the exportDataset function within cvat-core/src/annotations.ts. This confirms that the parameter is being handled as expected in the export logic.

  • cvat-core/src/annotations.ts: The allImages parameter is used in the exportDataset function implementation.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `allImages` parameter is correctly propagated.

# Test: Search for the function usage. Expect: Correct propagation of `allImages`.
rg --type typescript -A 5 $'PluginRegistry.apiWrapper.call'

Length of output: 93


Script:

#!/bin/bash
# Description: Verify that the `allImages` parameter is correctly propagated.

# Test: Search for the function usage. Expect: Correct propagation of `allImages`.
rg -A 5 $'PluginRegistry.apiWrapper.call'

Length of output: 29566


Script:

#!/bin/bash
# Description: Search for the implementation of `Project.prototype.annotations.exportDataset` to verify the usage of `allImages`.

# Test: Find the function definition and its usage of `allImages`.
ast-grep --lang typescript --pattern $'class Project {
  $$$
  annotations = {
    $$$
    exportDataset($_, $_, $_, $_, $_, $_) {
      $$$
    }
    $$$
  }
  $$$
}'

Length of output: 168


Script:

#!/bin/bash
# Description: Search for the implementation of `exportDataset` to verify the usage of `allImages`.

# Test: Find the function definition and its usage of `allImages`.
rg 'exportDataset' -A 10

Length of output: 38186

cvat/apps/events/handlers.py (1)

501-504: Verify the integration of the all_images parameter.

The addition of the all_images parameter to the handle_dataset_export function enhances the export functionality. Ensure that the parameter is correctly integrated and that any downstream logic that relies on this parameter is updated accordingly.

Run the following script to verify the function usage:

Verification successful

Integration of all_images Parameter Verified

The all_images parameter has been correctly integrated into the handle_dataset_export function. The function call in cvat/apps/engine/background.py includes this parameter, ensuring that it is being utilized as intended. No further updates are necessary.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `handle_dataset_export` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'handle_dataset_export'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify all function calls to `handle_dataset_export` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 $'handle_dataset_export'

Length of output: 1182

cvat/apps/engine/mixins.py (3)

463-464: OpenAPI documentation update looks good.

The addition of the all_images parameter in the OpenAPI documentation is clear and provides necessary information to the users.


431-434: Ensure correct handling of all_images parameter.

The all_images parameter is being correctly retrieved and used in the export_dataset_v1 function. Ensure that this parameter is properly handled in the callback function and the DatasetExportManager.

Run the following script to verify the usage of all_images in the callback function:


478-481: Ensure correct handling of all_images parameter in export_dataset_v2.

The all_images parameter is being correctly retrieved and used in the export_dataset_v2 function. Ensure that this parameter is properly handled in the callback function and the DatasetExportManager.

Run the following script to verify the usage of all_images in the callback function:

Verification successful

Correct handling of all_images parameter verified.

The all_images parameter is properly handled in both the DatasetExportManager and the get_export_callback function. It is used to determine the appropriate export function based on its value. No issues found.

  • DatasetExportManager in cvat/apps/engine/background.py
  • get_export_callback in cvat/apps/engine/views.py
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `all_images` in the callback function.

# Test: Search for the callback function usage. Expect: `all_images` is used appropriately.
rg --type python -A 5 $'def get_export_callback'

Length of output: 80


Script:

#!/bin/bash
# Search for the definition of the get_export_callback function and check for the usage of the all_images parameter.
ast-grep --lang python --pattern 'def get_export_callback($_, $_): $$$'

# Search for the DatasetExportManager class to verify handling of the all_images parameter.
ast-grep --lang python --pattern 'class DatasetExportManager($$$_): $$$'

Length of output: 26010


Script:

#!/bin/bash
# Search for the definition of the get_export_callback function across the codebase.
rg --type py 'def get_export_callback'

Length of output: 370


Script:

#!/bin/bash
# Extract the implementation of the get_export_callback function to verify the usage of the all_images parameter.
ast-grep --lang python --pattern 'def get_export_callback(self, save_images: bool, all_images: bool) -> Callable: $$$' cvat/apps/engine/views.py

Length of output: 1762

cvat/apps/engine/background.py (5)

162-162: Addition of all_images in ExportArgs is appropriate.

The all_images attribute is correctly added to the ExportArgs dataclass, enhancing the export functionality.


Line range hint 175-195: Ensure correct initialization of all_images.

The all_images parameter is correctly initialized in the constructor of DatasetExportManager. Ensure that this parameter is properly utilized in the export logic.

Run the following script to verify the usage of all_images in the export logic:

Verification successful

all_images Parameter Utilization Verified

The all_images parameter is correctly utilized in the export logic across various parts of the codebase. It is consistently used to determine whether to include all images or only annotated ones during dataset export.

  • Files Involved:
    • cvat/apps/dataset_manager/views.py
    • cvat/apps/dataset_manager/task.py
    • cvat/apps/dataset_manager/formats/*.py

The parameter's usage aligns with its intended functionality, ensuring proper dataset export behavior.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `all_images` in the export logic.

# Test: Search for the usage of `all_images` in export-related functions. Expect: `all_images` is used appropriately.
rg --type python -A 5 $'def export'

Length of output: 67


Script:

#!/bin/bash
# Description: Search for the usage of `all_images` in the codebase to verify its utilization in export logic.

# Search for the usage of `all_images` in the codebase to understand its role in export-related functions.
rg 'all_images' -A 10

Length of output: 67225


217-217: Ensure all_images is used correctly in ExportArgs.

The all_images attribute is correctly included in the ExportArgs instantiation. Ensure that this attribute is used effectively in the export process.

Run the following script to verify the usage of all_images in the export process:

Verification successful

all_images is correctly used in the export process.

The all_images attribute is consistently utilized across various export-related functions, indicating its proper integration into the export logic.

  • cvat/apps/dataset_manager/views.py: Used in the export function.
  • cvat/apps/engine/mixins.py: Passed to get_export_callback.
  • cvat/apps/dataset_manager/formats/*.py: Used in multiple _export functions.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `all_images` in the export process.

# Test: Search for the usage of `all_images` in export-related methods. Expect: `all_images` is used appropriately.
rg --type python -A 5 $'class DatasetExportManager'

Length of output: 83


Script:

#!/bin/bash
# Corrected script to verify the usage of `all_images` in the export process.

# Search for the usage of `all_images` in the DatasetExportManager class.
rg 'class DatasetExportManager' -A 50 | rg 'all_images'

Length of output: 465


Script:

#!/bin/bash
# Further verification of the usage of `all_images` in export-related logic.

# Search for `all_images` in export-related functions or methods to verify its impact on the export process.
rg 'def ' -A 10 | rg 'all_images'

Length of output: 11766


248-248: Ensure all_images is passed correctly in handle_local_download.

The all_images parameter is correctly passed to the handle_local_download function. Ensure that this parameter is utilized correctly in the function logic.

Run the following script to verify the usage of all_images in the handle_local_download function:

Verification successful

all_images is used correctly in handle_local_download. The all_images parameter is passed to the build_annotations_file_name function, where it determines the dataset type in the file name, ensuring correct usage in the function logic.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `all_images` in the `handle_local_download` function.

# Test: Search for the usage of `all_images` in the function. Expect: `all_images` is used appropriately.
rg --type python -A 5 $'def handle_local_download'

Length of output: 82


Script:

#!/bin/bash
# Corrected script to verify the usage of `all_images` in the `handle_local_download` function.

# Test: Search for the usage of `all_images` in the function. Expect: `all_images` is used appropriately.
rg --type py -A 10 $'def handle_local_download'

Length of output: 927


Script:

#!/bin/bash
# Extended script to verify the usage of `all_images` in the `handle_local_download` function.

# Test: Search for the usage of `all_images` in the function with more context lines.
rg --type py -A 50 $'def handle_local_download'

Length of output: 3821


Script:

#!/bin/bash
# Script to verify the usage of `all_images` in the `build_annotations_file_name` function.

# Test: Search for the `build_annotations_file_name` function and check the usage of `all_images`.
rg --type py -A 20 $'def build_annotations_file_name'

Length of output: 1261


410-410: Ensure all_images is used correctly in handle_dataset_export.

The all_images parameter is correctly passed to the handle_dataset_export function. Ensure that this parameter is utilized correctly in the function logic.

Run the following script to verify the usage of all_images in the handle_dataset_export function:

cvat/apps/dataset_manager/task.py (2)

Line range hint 967-979: Ensure correct handling of all_images in export_task.

The all_images parameter is correctly added to the export_task function. Ensure that this parameter is utilized correctly in the export logic.

Run the following script to verify the usage of all_images in the export_task function:


Line range hint 918-930: Ensure correct handling of all_images in export_job.

The all_images parameter is correctly added to the export_job function. Ensure that this parameter is utilized correctly in the export logic.

Run the following script to verify the usage of all_images in the export_job function:

cvat-core/src/session.ts (2)

Line range hint 176-186: LGTM! Verify the function usage in the codebase.

The addition of the allImages parameter is consistent and logical.

Ensure that all calls to exportDataset in the codebase are updated to include the new allImages parameter.

Run the following script to verify the function usage:

Verification successful

Function Usage Verified Successfully

The exportDataset function calls have been updated to include the allImages parameter across the codebase. The changes are consistent with the new function signature.

  • Locations include:
    • cvat-ui/src/components/export-dataset/export-dataset-modal.tsx
    • cvat-ui/src/actions/export-actions.ts
    • cvat-core/src/session.ts
    • cvat-core/src/project.ts
    • cvat-core/src/annotations.ts
    • cvat-core/src/session-implementation.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `exportDataset` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'exportDataset'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify all function calls to `exportDataset` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts -A 5 $'exportDataset'

Length of output: 17908


364-364: LGTM! Verify the method usage in the codebase.

The addition of the allImages parameter is consistent and logical.

Ensure that all calls to the exportDataset method in the codebase are updated to include the new allImages parameter.

Run the following script to verify the method usage:

Verification successful

All usages of exportDataset are updated with allImages parameter.

The method exportDataset is consistently used with the allImages parameter across the codebase, confirming that all necessary updates have been made.

  • cvat-core/src/session.ts
  • cvat-core/src/project.ts
  • cvat-core/src/server-proxy.ts
  • cvat-core/src/annotations.ts
  • cvat-core/src/project-implementation.ts
  • cvat-core/src/session-implementation.ts
  • cvat-ui/src/actions/export-actions.ts
  • cvat-ui/src/components/export-dataset/export-dataset-modal.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all method calls to `exportDataset` match the new signature.

# Test: Search for the method usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'exportDataset'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify all method calls to `exportDataset` match the new signature.

# Test: Search for the method usage. Expect: Only occurrences of the new signature.
rg --type ts -A 5 'exportDataset'

Length of output: 17908

cvat-core/src/session-implementation.ts (2)

516-529: LGTM! Verify the function usage in the codebase.

The addition of the allImages parameter is consistent and logical.

Ensure that all calls to exportDataset in the codebase are updated to include the new allImages parameter.

Run the following script to verify the function usage:

Verification successful

Let's correct the previous script to properly search for the exportDataset function usage across TypeScript files.


Function Usage Verified: exportDataset Updated Correctly

The exportDataset function calls throughout the codebase have been updated to include the new allImages parameter, confirming consistency with the intended changes.

  • Instances of exportDataset in various prototypes and implementations include the allImages parameter.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `exportDataset` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'exportDataset'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify all function calls to `exportDataset` match the new signature.

# Use `fd` to find TypeScript files and `rg` to search for `exportDataset` within them.
fd -e ts -x rg 'exportDataset' -A 5

Length of output: 8916


1177-1190: LGTM! Verify the function usage in the codebase.

The addition of the allImages parameter is consistent and logical.

Ensure that all calls to exportDataset in the codebase are updated to include the new allImages parameter.

Run the following script to verify the function usage:

Verification successful

Function usage verified successfully.

The exportDataset function calls have been updated to include the allImages parameter consistently across the codebase. No discrepancies were found.

  • Files with updated function calls:
    • cvat-core/src/session-implementation.ts
    • cvat-core/src/server-proxy.ts
    • cvat-core/src/session.ts
    • cvat-core/src/annotations.ts
    • cvat-core/src/project-implementation.ts
    • cvat-core/src/project.ts
    • cvat-ui/src/actions/export-actions.ts
    • cvat-ui/src/components/export-dataset/export-dataset-modal.tsx
    • cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `exportDataset` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'exportDataset'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify all function calls to `exportDataset` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type-add 'ts:*.ts' --type ts -A 5 'exportDataset'

Length of output: 17929

cvat/apps/dataset_manager/formats/cvat.py (5)

1430-1436: LGTM! Verify the function usage in the codebase.

The addition of the all_images parameter is consistent and logical.

Ensure that all calls to _export_video in the codebase are updated to include the new all_images parameter.

Run the following script to verify the function usage:


Line range hint 1373-1394: LGTM! Verify the function usage in the codebase.

The addition of the all_images parameter is consistent and logical.

Ensure that all calls to dump_media_files in the codebase are updated to include the new all_images parameter.

Run the following script to verify the function usage:

Verification successful

Function Usage Verified

All instances of the dump_media_files function in the codebase have been updated to include the new all_images parameter, ensuring consistency with the updated function signature.

  • cvat/apps/dataset_manager/formats/cvat.py: Calls to dump_media_files include all_images.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `dump_media_files` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'dump_media_files'

Length of output: 71


Script:

#!/bin/bash
# Description: Verify all function calls to `dump_media_files` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 $'dump_media_files'

Length of output: 1510


1405-1410: LGTM! Verify the function usage in the codebase.

The addition of the all_images parameter is consistent and logical.

Ensure that all calls to _export_task_or_job in the codebase are updated to include the new all_images parameter.

Run the following script to verify the function usage:

Verification successful

Function Usage Verified:

All calls to _export_task_or_job in the codebase have been updated to include the all_images parameter, ensuring consistency with the new function signature.

  • Locations:
    • cvat/apps/dataset_manager/formats/cvat.py: Lines where _export_task_or_job is called.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `_export_task_or_job` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'_export_task_or_job'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify all function calls to `_export_task_or_job` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg -A 5 '_export_task_or_job'

Length of output: 1850


Line range hint 1415-1425: LGTM! Verify the function usage in the codebase.

The addition of the all_images parameter is consistent and logical.

Ensure that all calls to _export_project in the codebase are updated to include the new all_images parameter.

Run the following script to verify the function usage:

Verification successful

Function Usage Verified: _export_project

The _export_project function has been updated to include the all_images parameter, and all usages in the codebase reflect this change correctly.

  • The function is defined and used in cvat/apps/dataset_manager/formats/cvat.py.

No further updates are required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `_export_project` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'_export_project'

Length of output: 70


Script:

#!/bin/bash
# Description: Verify all function calls to `_export_project` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 $'_export_project'

Length of output: 4260


1439-1445: LGTM! Verify the function usage in the codebase.

The addition of the all_images parameter is consistent and logical.

Ensure that all calls to _export_images in the codebase are updated to include the new all_images parameter.

Run the following script to verify the function usage:

Verification successful

Function Usage Verified: Consistent Signature Across Codebase

The _export_images function includes the all_images parameter consistently across its definitions and usages in the codebase. No discrepancies were found.

  • cvat/apps/dataset_manager/formats/pointcloud.py
  • cvat/apps/dataset_manager/formats/velodynepoint.py
  • cvat/apps/dataset_manager/formats/cvat.py
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `_export_images` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'_export_images'

Length of output: 69


Script:

#!/bin/bash
# Description: Verify all function calls to `_export_images` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --glob '*.py' -A 5 '_export_images'

Length of output: 1940

cvat-core/src/server-proxy.ts (2)

41-41: Addition of all_images in Params type is appropriate.

The all_images parameter is added as an optional boolean, which aligns with the intended functionality.


Line range hint 809-822: Inclusion of allImages parameter in exportDataset is correct.

The allImages parameter is correctly integrated into the function signature and used in the params object.

Ensure that all calls to exportDataset are updated to include the new allImages parameter.

Run the following script to verify the function usage:

Verification successful

Inclusion of allImages parameter in exportDataset is verified.

The allImages parameter is correctly integrated into the exportDataset function and is consistently used across the codebase.

  • Files with verified usage:
    • cvat-ui/src/components/export-dataset/export-dataset-modal.tsx
    • cvat-core/src/session.ts
    • cvat-core/src/project.ts
    • cvat-core/src/annotations.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `exportDataset` include the `allImages` parameter.

# Test: Search for the function usage. Expect: Occurrences of the new parameter.
rg --type typescript -A 5 $'exportDataset'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify all function calls to `exportDataset` include the `allImages` parameter.

# Test: Search for the function usage. Expect: Occurrences of the new parameter.
rg --type ts -A 5 $'exportDataset'

Length of output: 17908

cvat/apps/dataset_manager/bindings.py (3)

1500-1500: Inclusion of all_images parameter in CvatTaskOrJobDataExtractor is correct.

The all_images parameter is appropriately added to the constructor, aligning with the intended functionality.


1567-1568: Usage of all_images in conditional check is appropriate.

The all_images parameter is correctly used to control the inclusion of items in the dataset.


1677-1684: Inclusion of all_images parameter in GetCVATDataExtractor is correct.

The all_images parameter is correctly integrated into the function signature and passed to the extractor classes.

cvat/apps/engine/views.py (3)

314-320: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to get_export_callback match the new signature.

Run the following script to verify the function usage:

Verification successful

Function usage verified and consistent with the new signature.

The function get_export_callback is used correctly with the new parameters save_images and all_images in the codebase.

  • cvat/apps/engine/mixins.py: The function is called with both parameters as expected.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `get_export_callback` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'get_export_callback'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify all function calls to `get_export_callback` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg -A 5 'get_export_callback'

Length of output: 2250


1325-1331: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to get_export_callback match the new signature.

Run the following script to verify the function usage:

Verification successful

Function usage verified successfully.

The function get_export_callback is used correctly with the updated signature in the codebase.

  • cvat/apps/engine/mixins.py: The function calls include both save_images and all_images parameters.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `get_export_callback` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'get_export_callback'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify all function calls to `get_export_callback` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 $'get_export_callback'

Length of output: 2260


2028-2034: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to get_export_callback match the new signature.

Run the following script to verify the function usage:

Verification successful

Function usage verified successfully.

The get_export_callback function calls in the codebase have been updated to match the new signature with save_images and all_images parameters. No issues were found.

  • cvat/apps/engine/mixins.py: Correct usage of get_export_callback with the new parameters.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `get_export_callback` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'get_export_callback'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify all function calls to `get_export_callback` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type py -A 5 $'get_export_callback'

Length of output: 2260

cvat/schema.yml (3)

2549-2554: Addition of all_images parameter is appropriate.

The all_images parameter is correctly added to provide flexibility in exporting datasets. The default value of false aligns with the existing behavior.


3974-3979: Addition of all_images parameter is appropriate.

The all_images parameter is correctly added to provide flexibility in exporting datasets. The default value of false aligns with the existing behavior.


5923-5928: Addition of all_images parameter is appropriate.

The all_images parameter is correctly added to provide flexibility in exporting datasets. The default value of false aligns with the existing behavior.

Copy link
Contributor

@zhiltsov-max zhiltsov-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add at least some tests for the updated functionality.

@zhiltsov-max
Copy link
Contributor

This is a useful addition when creating and adding to datasets.

If you have some automation for task creation, so you know was it a dataset originally, you can upload only empty images or upload everything and mark the extra images as deleted.

@bschultz96
Copy link
Author

bschultz96 commented Aug 28, 2024

Please add at least some tests for the updated functionality.

I'm getting a bunch of tests failing due to an APIException with the following error message: "TypeError: _export_task_orjob() got an unexpected keyword argument all_images." It traces back to the cvat.py format file which does indeed have the parameter all_images within all necessary functions. Interestingly enough, if I change the test to use a different format it works fine. Just wondering if you might know why specifically for cvat format I get this exception? Screenshot linked with the output I get.

Screenshot 2024-08-28 100947

@zhiltsov-max
Copy link
Contributor

Maybe you need to rebuild the containers before running tests.

@bschultz96 bschultz96 closed this Sep 6, 2024
@bschultz96 bschultz96 deleted the export-images-option branch September 6, 2024 00:47
@KTXKIKI
Copy link

KTXKIKI commented Sep 9, 2024

@ bschultz96 Hello brother, have you made any progress? Perhaps there are other ideas for implementation?

@bschultz96
Copy link
Author

@ bschultz96 Hello brother, have you made any progress? Perhaps there are other ideas for implementation?

I couldn't figure out why the tests I added to test the new functionality aren't returning the results I expect. When I run the tests the endpoint is always downloading either all or no images and behavior doesn't change for whichever all_images is set to. Manually testing the endpoint works fine, so I think I'm missing something in the testing environment backend but after spending a few hours couldn't find make any headway.

@zhiltsov-max
Copy link
Contributor

I couldn't figure out why the tests I added to test the new functionality aren't returning the results I expect. When I run the tests the endpoint is always downloading either all or no images and behavior doesn't change for whichever all_images is set to. Manually testing the endpoint works fine, so I think I'm missing something in the testing environment backend but after spending a few hours couldn't find make any headway.

Have you tried pytest --rebuild tests/python?

Eldies and others added 17 commits September 12, 2024 09:40
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->
fixing cvat-ai#7783
also fixing related problem - some jobs from the issue can not be opened
in ui due to missing shapes

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [ ] I submit my changes into the `develop` branch
- [ ] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->
- [ ] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary

([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),

[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and

[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))

### License

- [ ] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced data integrity in annotation processing by adding filtering
steps before sorting.
- New entries for "many jobs skeleton tracks with missing shapes" and
"many jobs skeleton" added to the dataset, improving job tracking
capabilities and complex job definitions.
- Introduced a new static method for annotation creation, improving code
modularity and reusability.

- **Bug Fixes**
- Improved error handling in annotation functions to prevent runtime
errors when accessing potentially undefined variables.

- **Tests**
- Expanded the testing framework with new tests for annotation creation
scenarios, ensuring comprehensive coverage.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This has several goals:

* Remove `LambdaType.UNKNOWN`. Functions with this non-type are useless
  and should not be presented to the user.

* Don't return 404 from the list endpoint if one function cannot be
  loaded. This prevents one bad function from essentially disabling the
  entire serverless function feature. Instead, log the error and ignore
  the function.

* Don't return 404 from other endpoints either when the problem is a bad
  function. This is not a client problem. Raise an exception and let
  Django log it and return a 500.

* Remove HTTP codes from `LambdaFunction`, to improve separation of
  concerns.
This is consistent with other user-controllable objects, and when you're
triggering the API manually, makes it easier to determine which ID to
use.
This enum is used for a field named `kind` in a resource located at
`/api/lambda/function`, so it seems pretty clear that it should be named
`FunctionKind`. (Or perhaps `LambdaFunctionKind`, but I omitted the
"lambda" for consistency with views and serializers.)

In addition to renaming, move it to `models`, so that it can be used by
serializers. No such serializers currently exist, but I'd like to add
them later. Turn it into a Django choice enum as well, so that `__str__`
works out of the box.
Due to how `WebhookPermission.get_scopes` is written, any unhandled endpoint
will result in an empty list being returned, and thus no access control
being performed. This is the right thing for `/api/webhooks/events`, but not
so much for every other endpoint.
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [ ] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->
- [ ] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary

([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),

[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and

[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Documentation**
- Updated the backup and restoration guide for CVAT data to clarify the
use of Docker volumes.
- Renamed the volume from `cvat_events` to `cvat_events_db` for better
accuracy regarding its function.
- Streamlined instructions by removing references to Elasticsearch,
focusing solely on Clickhouse database backups.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
With almost all of the `get_scopes` methods, an unknown (action, method)
combination will result in an array like `[None]` being returned
(sometimes with other elements as well). If that happens, the OPA input
will then have `"scope": null`, and so the policy evaluation will fail,
unless the user is an admin.

Because of this, it's really easy to accidentally make a view
admin-only, by forgetting to add/update an entry in `get_scopes` when
making changes.

`TaskPermission`, `MembershipPermission` and `WebhookPermission` are
even worse, because they will just return an empty list of scopes, which
will later translate to an empty list of permissions, which means that
everyone will be permitted to perform the action. This can lead to
vulnerabilities like CVE-2024-45393.

Fix this by replacing all `.get` calls with indexing, which will cause a
crash if the (action, method) combo is unknown. This breaks one endpoint
(`/api/webhooks/events`), which is supposed to be publicly accessible;
fix that by disabling authorization for it.
…7459)

This is a followup to cvat-ai#7442. I didn't realize there were so many
outdated actions. 🙂

This should update every remaining action with a Node 12/16 dependency.
Copy link

sonarcloud bot commented Sep 12, 2024

@@ -254,6 +256,10 @@ def export(
if not local_downloading:
query_params["filename"] = str(filename)

if save_images and only_annotated:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How these 2 parameters are related?

Comment on lines +171 to +172
if only_annotated:
dataset_type += "-annotated_only"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update parse_export_file_path to support this?

if save_images and not only_annotated:
return dm.views.export_project_as_dataset
elif save_images:
return dm.views.export_project_as_dataset_only_annotated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a new function was needed here? It doesn't look like a new use case.

@@ -148,6 +149,34 @@ def test_can_export_dataset(
request=request,
cloud_storages=cloud_storages,
)

@pytest.mark.parametrize("format_name", ("CVAT for images 1.1",))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • It makes sense to test this with all formats, not only one
  • This functionality if not specific to SDK, so it's better to move it either into server API tests or server unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.