Template for using Yolo PyTorch models for image detection.
- About
- Getting Started
- Using a Pre-Trained Model
- Making, Training, and Using a Custom Data Set
- Documentation
This project aims to simplify the process of image detection in YOLOv8
, enabling more people to label, train, and use an image detection model.
- Clone or download this directory.
- Navigate to this directory in the command prompt.
- Run
pip install -r requirements.txt
(this installs all the Python packages required). - Try the
demo.ipynb
notebook to get an understanding of image detection.
If you have a pre-trained model (.pt file), you can pass in the relative path to the model when initializing a YOLO
or a Detector
object. An example of this is found in the demo.ipynb
file.
Label your dataset by "drawing" boxes around the objects you want to detect and classifying them into categories ("Excavator", "Lighthouse", etc.). Separate the images into training, validation, and test sets. We recommend using Roboflow
. Our own Gravemaskin dataset is available here: Roboflow - Gravemaskin Dataset.
Train the model using a powerful GPU
. In Google Colab
, you can take advantage of their built-in GPU
. A full tutorial is available here.
After training, you obtain a PyTorch
file (.pt). You can run your model as with any pre-trained models. See the tutorial under "Exporting the model".
Detector.py
simplifies the YOLO
methods in Ultralytics
, making them easier to use but with some limitations. For detailed analysis, use the YOLO
methods directly (as shown in the end of demo.ipynb
).
Detector(model_path)
: Initializes a detection object with a trained model in.pt PyTorch
format.find_objects_image(image, conf, show_all, save_image, save_filename)
: Detects objects in an image, with customizable parameters.