-
Notifications
You must be signed in to change notification settings - Fork 0
Added crop by class about ISD data type #146
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
base: develop
Are you sure you want to change the base?
Conversation
Signed-off-by: Hun Jung <[email protected]>
Signed-off-by: Hun Jung <[email protected]>
Signed-off-by: Hun Jung <[email protected]>
Signed-off-by: Hun Jung <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @HunJ93, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request implements a significant new utility within the application, enabling the automated extraction and categorization of image regions based on their annotations. The primary goal is to streamline the process of creating class-specific image datasets from existing labeled data, which is crucial for machine learning workflows. This feature is integrated into the GUI for ease of use and includes robust handling for various scenarios, such as managing output directories and supporting only rectangular annotations.
Highlights
- New Feature: Crop Labels by Class: I've introduced a new feature that allows users to crop labeled objects from images and organize them into class-specific directories. This is particularly designed for the
ELStateDetection
data type, enabling automated dataset preparation for specific object classes. - UI Integration: A new 'Crop Classes' action has been added to the application's user interface, accessible via the 'Administrator' menu and the main toolbar. This provides a convenient way to trigger the new cropping functionality directly from the GUI.
- Dependency Update: The
opencv-python
library has been added as a new development dependency to support the image processing operations required for cropping.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a crop-by-class feature for ELStateDetection labels, organizing cropped images into class-specific folders.
- Introduces OpenCV for image processing
- Implements a new CLI tool to parse JSON annotations and crop images by class
- Integrates a "Crop Classes" action with a keyboard shortcut into the GUI
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
requirements-dev.txt | Added opencv-python for cropping functionality |
labelme/config/default_config.yaml | Added crop_classes keyboard shortcut |
labelme/cli/crop_label_class.py | New script to crop and organize images by class |
labelme/app.py | Integrated crop action into the GUI |
Comments suppressed due to low confidence (2)
labelme/cli/crop_label_class.py:20
- [nitpick] Consider renaming
allow_class
toallowed_classes
to clearly indicate this holds multiple class names.
self.allow_class = self.config['ELStateDetection']
labelme/cli/crop_label_class.py:50
- [nitpick] The method name
_created_class_dir
is past tense; rename it to_create_class_dirs
to reflect its action of creating directories.
def _created_class_dir(self, input_dir):
Signed-off-by: Hun Jung <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds a new feature to crop labeled objects from images based on their class. The implementation is a good start, but I've identified several critical and high-severity issues related to security, error handling, and application stability. My review includes suggestions to use yaml.safe_load
for security, improve error handling to prevent crashes, and replace sys.exit()
with proper exception handling to ensure a better user experience in the GUI application. Addressing these points will make the new feature much more robust and secure.
Signed-off-by: Hun Jung <[email protected]>
…ass-about-ISD Signed-off-by: Hun Jung <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
변경 내용 확인하였습니다! 고생하셨습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니다 고생하셨습니다
목적
내용
기능 동작 검증
로컬 개발 환경에서 테스트 완료
각 class별 디렉토리

디렉토리 안 crop된 이미지
