Coder Social home page Coder Social logo

Comments (10)

github-actions avatar github-actions commented on September 8, 2024

👋 Hello @jackwolfey, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Requirements

Python>=3.8.0 with all requirements.txt installed including PyTorch>=1.8. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Introducing YOLOv8 🚀

We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀!

Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects.

Check out our YOLOv8 Docs for details and get started with:

pip install ultralytics

from yolov5.

glenn-jocher avatar glenn-jocher commented on September 8, 2024

Hello,

Thank you for bringing this to our attention and for your thoughtful suggestion! The issue of label names and confidence thresholds running outside the image boundary is indeed a valid concern, especially for improving the clarity of detection results.

To address your query:

  1. Feature Proposal: Expanding the image or adjusting the label placement to ensure visibility is a valuable feature. It can enhance the user experience by ensuring that all relevant information is clearly visible. Introducing a command-line parameter to enable or disable this feature would provide flexibility to users who may or may not need this functionality.

  2. Implementation: If you are willing to contribute, we would greatly appreciate a Pull Request (PR) with this enhancement. You could consider implementing a mechanism that checks the position of the label and adjusts it accordingly if it is too close to the image boundary. Alternatively, expanding the image canvas slightly to accommodate the labels could also be a solution.

Here's a basic idea of how you might start implementing this:

# Pseudo-code for adjusting label position
def adjust_label_position(label, image_width, image_height):
    label_x, label_y = label.position
    label_width, label_height = label.size

    if label_x + label_width > image_width:
        label_x = image_width - label_width
    if label_y + label_height > image_height:
        label_y = image_height - label_height

    return label_x, label_y

Feel free to refine this approach and integrate it into the detect.py script. We encourage you to submit a PR, and our team will be happy to review it.

If you have any further questions or need assistance with the implementation, please don't hesitate to ask. We appreciate your willingness to contribute to the YOLOv5 project!

from yolov5.

jackwolfey avatar jackwolfey commented on September 8, 2024

Hi @glenn-jocher , thanks for your reply. I am happy to do some contribute to this project. After carefully reading the source code, I found that in the current version of the code, the logic of drawing the rectangle box and labels is implemented in ultralytics.utils.Annotator.box_label(). Should I try to contribute code in ultralytics instead of this project?

from yolov5.

glenn-jocher avatar glenn-jocher commented on September 8, 2024

Hello @jackwolfey,

Thank you for your enthusiasm and willingness to contribute to the YOLOv5 project! We truly appreciate your support and initiative.

You are correct that the logic for drawing the rectangle box and labels is implemented in the ultralytics.utils.Annotator.box_label() function. If you are looking to enhance the visualization by ensuring that labels and confidence thresholds do not run outside the image boundary, this would indeed be the appropriate place to make your changes.

To proceed, you can fork the YOLOv5 repository, make your modifications, and then submit a Pull Request (PR) for review. Here are some steps to guide you:

  1. Fork the Repository: Fork the YOLOv5 repository to your GitHub account.
  2. Clone the Repository: Clone your fork to your local machine.
  3. Create a New Branch: Create a new branch for your feature.
  4. Implement the Changes: Modify the ultralytics.utils.Annotator.box_label() function to adjust label positions or expand the image canvas as needed.
  5. Test Your Changes: Ensure that your changes work as expected and do not introduce any new issues.
  6. Submit a PR: Push your changes to your fork and submit a PR to the main YOLOv5 repository.

Here's a basic example of how you might adjust the label position within the box_label function:

def box_label(self, box, label='', color=(128, 128, 128), txt_color=(255, 255, 255)):
    # Existing code to draw the box and label
    # ...

    # Adjust label position if it is too close to the image boundary
    label_x, label_y = box[:2]
    label_width, label_height = self.get_text_size(label)
    
    if label_x + label_width > self.img.shape[1]:
        label_x = self.img.shape[1] - label_width
    if label_y + label_height > self.img.shape[0]:
        label_y = self.img.shape[0] - label_height

    # Draw the adjusted label
    self.draw_text((label_x, label_y), label, txt_color, color)

Feel free to refine this approach based on your understanding and the specific requirements.

If you encounter any issues or need further assistance, please don't hesitate to ask. We look forward to your contribution and thank you again for helping improve the YOLOv5 project!

from yolov5.

jackwolfey avatar jackwolfey commented on September 8, 2024

@glenn-jocher I understand, but the source code of ultralytics.utils.Annotator.box_label() is not in this repository, ultralytics is a dependency library of this project. Do you mean i should rewrite the Annotator class and put it in this repository then replace the one which currently used in detect.py?

from yolov5.

glenn-jocher avatar glenn-jocher commented on September 8, 2024

Hello @jackwolfey,

Thank you for your insightful question and for your willingness to contribute to the YOLOv5 project!

You are correct that the ultralytics.utils.Annotator.box_label() function is part of the ultralytics library, which is a dependency of the YOLOv5 project. Given this, it would be more appropriate to contribute your enhancements directly to the ultralytics repository rather than modifying the YOLOv5 repository itself.

Here’s how you can proceed:

  1. Fork the Ultralytics Repository: Fork the Ultralytics repository to your GitHub account.
  2. Clone the Repository: Clone your fork to your local machine.
  3. Create a New Branch: Create a new branch for your feature.
  4. Implement the Changes: Modify the Annotator class, specifically the box_label method, to ensure that labels and confidence thresholds do not run outside the image boundary.
  5. Test Your Changes: Ensure that your changes work as expected and do not introduce any new issues.
  6. Submit a PR: Push your changes to your fork and submit a Pull Request (PR) to the main Ultralytics repository.

Here’s a basic example of how you might adjust the label position within the box_label function:

def box_label(self, box, label='', color=(128, 128, 128), txt_color=(255, 255, 255)):
    # Existing code to draw the box and label
    # ...

    # Adjust label position if it is too close to the image boundary
    label_x, label_y = box[:2]
    label_width, label_height = self.get_text_size(label)
    
    if label_x + label_width > self.img.shape[1]:
        label_x = self.img.shape[1] - label_width
    if label_y + label_height > self.img.shape[0]:
        label_y = self.img.shape[0] - label_height

    # Draw the adjusted label
    self.draw_text((label_x, label_y), label, txt_color, color)

By contributing directly to the ultralytics repository, your improvements will benefit all projects that depend on this library, including YOLOv5.

If you encounter any issues or need further assistance, please don't hesitate to ask. We look forward to your contribution and thank you again for helping improve the Ultralytics ecosystem!

from yolov5.

jackwolfey avatar jackwolfey commented on September 8, 2024

@glenn-jocher Thanks for your reply, related pr see ultralytics/ultralytics#13959 (comment)

from yolov5.

glenn-jocher avatar glenn-jocher commented on September 8, 2024

Hello @jackwolfey,

Thank you for your proactive engagement and for referencing the related PR. We appreciate your initiative to contribute to the project!

To ensure we can effectively address the issue, could you please provide a minimum reproducible code example? This will help us understand the context and reproduce the bug on our end. You can find guidelines for creating a minimum reproducible example here. This step is crucial for us to investigate and resolve the issue accurately.

Additionally, please verify that you are using the latest versions of torch and the YOLOv5 repository. Sometimes, updating to the latest versions can resolve unexpected issues.

Thank you again for your contribution and for helping us improve the YOLOv5 project. If you have any further questions or need additional assistance, feel free to ask. We're here to help!

from yolov5.

jackwolfey avatar jackwolfey commented on September 8, 2024

Closing this issue as it has been resolved.

from yolov5.

glenn-jocher avatar glenn-jocher commented on September 8, 2024

Hello @jackwolfey,

Thank you for your proactive engagement and for referencing the related PR. We appreciate your initiative to contribute to the project!

To ensure we can effectively address the issue, could you please provide a minimum reproducible code example? This will help us understand the context and reproduce the bug on our end. You can find guidelines for creating a minimum reproducible example here. This step is crucial for us to investigate and resolve the issue accurately.

Additionally, please verify that you are using the latest versions of torch and the YOLOv5 repository. Sometimes, updating to the latest versions can resolve unexpected issues.

Thank you again for your contribution and for helping us improve the YOLOv5 project. If you have any further questions or need additional assistance, feel free to ask. We're here to help!

from yolov5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.