ultralytics/yolov5

Code doubts about the model in the detection process

Closed this issue ยท 2 comments

Search before asking

Question

In the non training detection process of the model, "class Detect" needs to perform additional processing on the output results of three (or four) branches of the network in the detection header class of yolo. py. But when dealing with conf and class in the code, merging them together and writing them as "conf" is not too rigorous, although the logic of the code is not a problem.
1713956080567

Additional

No response

๐Ÿ‘‹ Hello @ayitime, 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

@ayitime hello ๐Ÿ‘‹,

Thanks for reaching out and doing your due diligence before asking your question! It sounds like you're diving deep into the specifics of the YOLOv5 detection process, particularly around how confidence and class predictions are handled post-detection.

Indeed, in the Detect layer, the model outputs are passed through several processing steps, including combining the confidence (objectness) scores with class probabilities to calculate the final class confidence scores. This merging step simplifies subsequent operations like Non-Maximum Suppression (NMS), by having a single confidence score that reflects both the presence of an object and its class.

The code represents this operation by overwriting conf with the combined confidence-class score, which might seem a bit unconventional but is efficient for the task at hand. This approach optimizes for speed and clarity within the context of the detection process.

Remember, clarity and efficiency often require compromises, especially in high-performance computing tasks like object detection. However, your feedback is invaluable for continuous improvement. Feel free to contribute ideas or code enhancements through a pull request or further discussions!

For more detailed information on YOLOv5's structure and methodologies, I encourage you to check our documentation at https://docs.ultralytics.com/yolov5/.

Happy coding! ๐Ÿš€