Closed Ayame4 closed 1 year ago
π Hello @Ayame4, 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.
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
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
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.
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
The problem was that the DetectionModel doesn't load the weights from ckpt as input, rather the weights needed to be loaded like this:
from models.yolo import DetectionModel
if pt: # PyTorch
model = torch.load(w, map_location='cpu')['model'].float()
@Ayame4 hi there,
Thank you for sharing your findings. Indeed, the DetectionModel
loads the weights a bit differently from the Ensemble. Your solution to load the weights directly using torch.load
is correct, and it should yield the same predictions as using the Ensemble.
Your diligence and adaptability in finding this solution are commendable. If you have further questions or need additional assistance, feel free to ask!
Search before asking
Question
Hello,
As I have thus far understood:
In detection (
detect.py
) with yolov5s.pt as weights, first DetectMultiBackend is calledwhich then creates an Ensemble where the model weights of the Detection Model are loaded.
Now since only one model is used in the Ensemble, I am trying to replace the Ensemble with the DetectionModel directly:
however the prediction of the second way yields almost no results.
Could you help me understand what is the difference between the Ensemble with one model and the model itself? Is it possible to use the DetectionModel directly and obtain the same predictions?
I don't have a lot of experience, so I would be grateful for some help.
Additional
Note: in order to use the DetectionModel I moved DetectMultiBackend to a new file to avoid circular dependencies.