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

Fix automatic tag annotation support #7839

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

Conversation

omerferhatt
Copy link

@omerferhatt omerferhatt commented May 2, 2024

Motivation and context

Since the lambda function's return objectType is always assumed to be SHAPE, the tag object cannot be passed, and it throws an error like in #6220 (comment).

Adding "objectType": "tag" next to "type": "tag" key-value pair to the lambda function fixed this problem.

How has this been tested?

Classifier serverless function PR will be sent too.

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 annotation tools to support different object types, improving flexibility in object detection tasks.

Copy link
Contributor

coderabbitai bot commented May 2, 2024

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

Commits Files that changed from the base of the PR and between f5a4251 and 4925b43.
Files selected for processing (1)
  • changelog.d/20240528_180958_omer.sarioglu_semi_auto_tag_annotation.md (1 hunks)
 ____________________________________________________________________
< Sometimes, I feel like a code reviewer in a world of copy-pasters. >
 --------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Walkthrough

The recent changes introduce the ObjectType to the DetectedShape interface in the lambda-manager.ts file and modify the ToolsControlComponent in the tools-control.tsx file to set the objectType property using data.objectType or default to ObjectType.SHAPE. These adjustments enhance the flexibility and specificity of object type handling within the CVAT application.

Changes

File Path Change Summary
cvat-core/src/lambda-manager.ts Added ObjectType to imports and included objectType in DetectedShape interface.
cvat-ui/src/components/annotation-page/standard-workspace/... Modified ToolsControlComponent to assign objectType using data.objectType or default to SHAPE.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant ToolsControlComponent
    participant DetectedShape

    User ->> ToolsControlComponent: Selects a tool
    ToolsControlComponent ->> DetectedShape: Creates/Updates shape with objectType
    DetectedShape ->> ToolsControlComponent: Shape created/updated with objectType
    ToolsControlComponent ->> User: Displays updated shape

In fields of code, where logic sways,
A Shape now finds its varied ways.
With ObjectType it’s set to be,
More precise for eyes to see.
In CVAT’s core, the change is made,
A better tool, our goals conveyed.


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 full the 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 Configration 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.

@omerferhatt omerferhatt changed the title [WiP] Semi-auto tag annotation support Fix automatic `tag' annotation support May 2, 2024
@omerferhatt omerferhatt changed the title Fix automatic `tag' annotation support Fix automatic tag annotation support May 2, 2024
@omerferhatt omerferhatt marked this pull request as ready for review May 2, 2024 21:17
@bsekachev
Copy link
Member

bsekachev commented May 7, 2024

May you please add changelog entry? scriv create --edit

Fixed

  • Wrong object type and shape used when a user runs detector online to classify images

Example files may be found here: https://github.com/cvat-ai/cvat/tree/develop/changelog.d

@omerferhatt
Copy link
Author

@bsekachev changelog entry added

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: 2

Outside diff range and nitpick comments (2)
cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/tools-control.tsx (2)

Line range hint 75-75: Specify explicit types instead of any.

Consider replacing any types with more specific types to improve type safety and code maintainability. TypeScript's any type defeats the purpose of using TypeScript in the first place, as it does not enforce any checking. Here are some lines where any is used:

  • Line 75
  • Line 76
  • Line 138
  • Line 157
  • Line 189
  • Line 441
  • Line 497
  • Line 534
  • Line 596
  • Line 678
  • Line 787
  • Line 830
  • Line 841
  • Line 900
  • Line 976
  • Line 1273
  • Line 1328
  • Line 1333

Also applies to: 76-76, 138-138, 157-157, 189-189, 441-441, 497-497, 534-534, 596-596, 678-678, 787-787, 830-830, 841-841, 900-900, 976-976, 1273-1273, 1328-1328, 1333-1333


Line range hint 5-6: Remove unused imports.

- import React, { ReactPortal } from 'react';
+ import React from 'react';

The ReactPortal import is only used as a type and should be imported in a type-specific manner to avoid confusion and potential side effects in the bundle size.

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 841323d and f5a4251.
Files selected for processing (2)
  • changelog.d/20240528_180958_omer.sarioglu_semi_auto_tag_annotation.md (1 hunks)
  • cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/tools-control.tsx (1 hunks)
Additional Context Used
Markdownlint (2)
changelog.d/20240528_180958_omer.sarioglu_semi_auto_tag_annotation.md (2)

1: Expected: 0 or 2; Actual: 1
Trailing spaces


4: null
Bare URL used

Biome (20)
cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/tools-control.tsx (20)

75-75: Unexpected any. Specify a different type.


76-76: Unexpected any. Specify a different type.


138-138: Unexpected any. Specify a different type.


157-157: Unexpected any. Specify a different type.


189-189: Unexpected any. Specify a different type.


189-189: Unexpected any. Specify a different type.


441-441: Unexpected any. Specify a different type.


497-497: Unexpected any. Specify a different type.


534-534: Unexpected any. Specify a different type.


596-596: Unexpected any. Specify a different type.


678-678: Unexpected any. Specify a different type.


787-787: Unexpected any. Specify a different type.


830-830: Unexpected any. Specify a different type.


841-841: Unexpected any. Specify a different type.


900-900: Unexpected any. Specify a different type.


976-976: Unexpected any. Specify a different type.


1273-1273: Unexpected any. Specify a different type.


1328-1328: Unexpected any. Specify a different type.


1333-1333: Unexpected any. Specify a different type.


5-6: Some named imports are only used as types.

omerferhatt and others added 2 commits May 28, 2024 18:19
…tion.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.

None yet

2 participants