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

Enhanced labels mapping on client #8251

Merged
merged 9 commits into from
Aug 8, 2024
Merged

Conversation

bsekachev
Copy link
Member

@bsekachev bsekachev commented Aug 1, 2024

Motivation and context

Resolved #8213

image

How has this 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

    • Enhanced the labels mapping feature to support attributes for skeleton points, providing greater flexibility in annotation.
    • Introduced a new property, containerTitle, to the ObjectMapperComponent for improved usability.
  • Bug Fixes

    • Improved the mapping logic to ensure updates preserve existing mappings, enhancing overall functionality.
  • Style

    • Added new styling classes for better visual hierarchy and consistency across components.
  • Documentation

    • Updated changelog to reflect these enhancements and changes.

Copy link
Contributor

coderabbitai bot commented Aug 1, 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 enhance the CVAT application by improving the labels mapping feature, particularly for skeleton annotations. New functionalities enable users to assign attributes to skeleton points, while the UI and underlying logic of the labels mapper and object mapper components have been refined. These adjustments streamline the mapping process and improve usability, ensuring a more flexible and visually coherent user experience.

Changes

File Path Change Summary
changelog.d/20240801_154204_boris_enhanced_labels_mapping.md Introduced support for attributes in skeleton points within the labels mapping feature.
cvat-ui/src/components/model-runner-modal/labels-mapper.tsx Enhanced LabelsMapperComponent with new helper functions, updated type definitions, and refactored logic for mappings.
cvat-ui/src/components/model-runner-modal/object-mapper.tsx Added containerTitle prop to ObjectMapperComponent for dynamic container labeling.
cvat-ui/src/components/model-runner-modal/styles.scss Introduced .tree-display class for improved styling and updated existing styles for alignment and consistency.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as CVAT UI
    participant Mapper as LabelsMapperComponent
    participant Model as ModelFunction

    User->>UI: Initiate mapping
    UI->>Mapper: Request mapping details
    Mapper-->>UI: Provide updated mapping
    User->>Model: Submit skeleton with attributes
    Model-->>Mapper: Return skeleton with sublabel attributes
    Mapper-->>UI: Update UI with new mappings
Loading

Assessment against linked issues

Objective Addressed Explanation
Support attributes for skeleton sublabels ( #8213 )
Ensure nuclio functions return skeleton attributes ( #8213 )

🐰✨
In the garden where bunnies hop,
Labels dance and never stop.
Skeletons now wear a crown,
With attributes, they'll never frown!
Mapping made easy, what a delight,
CVAT shines, oh so bright! 🌟🥕


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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f3dcc3e and 94e1fcc.

Files selected for processing (4)
  • changelog.d/20240801_154204_boris_enhanced_labels_mapping.md (1 hunks)
  • cvat-ui/src/components/model-runner-modal/labels-mapper.tsx (9 hunks)
  • cvat-ui/src/components/model-runner-modal/object-mapper.tsx (4 hunks)
  • cvat-ui/src/components/model-runner-modal/styles.scss (3 hunks)
Additional comments not posted (12)
changelog.d/20240801_154204_boris_enhanced_labels_mapping.md (2)

1-1: LGTM!

The new section "Added" is correctly added to the changelog.


3-4: LGTM!

The changelog entry clearly describes the new feature and provides a link to the relevant pull request.

cvat-ui/src/components/model-runner-modal/styles.scss (3)

17-34: LGTM!

The .tree-display class is well-defined and consistent with the intended design. It includes relative positioning, a left border, and a pseudo-element for non-first children.


Line range hint 35-53: LGTM!

The .cvat-runner-label-mapper class extends .tree-display for consistent styling and includes additional styles for text alignment and overflow management.


57-65: LGTM!

The .cvat-runner-attribute-mapper class extends .tree-display for consistent styling and includes additional styles for margin and padding management.

cvat-ui/src/components/model-runner-modal/object-mapper.tsx (2)

23-23: LGTM!

The new prop containerTitle is correctly added to the Props interface and is of type string.


74-76: LGTM!

The containerTitle prop is correctly integrated within the component and ensures consistent styling with other text elements.

cvat-ui/src/components/model-runner-modal/labels-mapper.tsx (5)

88-97: LGTM!

The getMappingItem function is well-implemented and enhances the readability and maintainability of the code.


99-121: LGTM!

The updateSublabelAttributesMapping function is well-implemented and ensures that sublabel attributes are correctly mapped without resetting existing mappings.


123-138: LGTM!

The updateSublabelsMapping function is well-implemented and ensures that sublabels are correctly mapped without resetting existing mappings.


39-42: LGTM! Verify the usage of LabelType constants.

The updated logic for label compatibility looks good. Ensure that the LabelType constants are correctly defined and used throughout the codebase.


Line range hint 178-191:
LGTM! Verify the integration of helper functions.

The updates to the LabelsMapperComponent enhance its functionality and maintainability. Ensure that the new helper functions are correctly integrated and tested.

Verification successful

Let's correct the file type specification and re-run the script to verify the integration of the helper functions.


LGTM! The helper functions are correctly integrated within the LabelsMapperComponent.

The functions getMappingItem, updateSublabelAttributesMapping, and updateSublabelsMapping are used appropriately within cvat-ui/src/components/model-runner-modal/labels-mapper.tsx.

  • The functions are utilized to manage mappings between model labels and task labels, including sublabels and attributes.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of helper functions within the `LabelsMapperComponent`.

# Test: Search for the usage of helper functions. Expect: Correct integration in relevant files.
rg --type tsx -A 5 $'getMappingItem|updateSublabelAttributesMapping|updateSublabelsMapping'

Length of output: 120


Script:

#!/bin/bash
# Description: Verify the integration of helper functions within the `LabelsMapperComponent`.

# Test: Search for the usage of helper functions. Expect: Correct integration in relevant files.
rg --type ts -A 5 'getMappingItem|updateSublabelAttributesMapping|updateSublabelsMapping'

Length of output: 6583

@codecov-commenter
Copy link

codecov-commenter commented Aug 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.36%. Comparing base (4a21352) to head (4d98ea4).
Report is 3 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8251      +/-   ##
===========================================
- Coverage    83.38%   83.36%   -0.02%     
===========================================
  Files          389      389              
  Lines        41526    41526              
  Branches      3856     3856              
===========================================
- Hits         34626    34620       -6     
- Misses        6900     6906       +6     
Components Coverage Δ
cvat-ui 79.64% <ø> (-0.04%) ⬇️
cvat-server 86.68% <ø> (+<0.01%) ⬆️

Copy link

sonarcloud bot commented Aug 8, 2024

@bsekachev bsekachev merged commit 478f670 into develop Aug 8, 2024
33 checks passed
@bsekachev bsekachev deleted the bs/enhanced_labels_mapping branch August 9, 2024 11:49
@cvat-bot cvat-bot bot mentioned this pull request Aug 13, 2024
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.

LambdaFunction does not map attrs of skeleton sublabels
2 participants