Comments (4)
👋 Hello @dat-nguyenvn, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.
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.
Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.
Install
Pip install the ultralytics
package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.
pip install ultralytics
Environments
YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
- Notebooks with free GPU:
- Google Cloud Deep Learning VM. See GCP Quickstart Guide
- Amazon Deep Learning AMI. See AWS Quickstart Guide
- Docker Image. See Docker Quickstart Guide
Status
If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.
from ultralytics.
@dat-nguyenvn hi Dat,
Thank you for your question! Let's address your queries step-by-step:
-
Re-training 3 subclasses in COCO dataset using pre-trained weights on your data:
To re-train a model on specific classes from the COCO dataset using pre-trained weights, you can filter the classes during training. However, the
classes
argument is not directly applicable in thetrain
method. Instead, you should create a custom dataset configuration file that includes only the classes you are interested in. Here's how you can do it:-
Create a custom dataset YAML file:
# custom_coco.yaml path: ../datasets/coco # path to your dataset train: images/train2017 # train images (relative to 'path') val: images/val2017 # val images (relative to 'path') test: # test images (optional) nc: 3 # number of classes names: ['zebra', 'elephant', 'giraffe'] # class names
-
Filter your dataset:
You will need to filter the COCO dataset to include only the images containing your classes of interest. This can be done using a script to process the COCO annotations and create a new dataset with only the specified classes. -
Train the model:
from ultralytics import YOLO # Load a pre-trained model model = YOLO('yolov8n.pt') # Train the model on your custom dataset results = model.train(data='custom_coco.yaml', epochs=100, imgsz=640)
-
-
Using the
classes
argument in training:
Theclasses
argument is used for filtering predictions during inference, not for training. For training, you should use a custom dataset configuration file as shown above. -
Downloading and splitting the COCO dataset:
If you prefer, you can download the entire COCO dataset, filter out the images containing only the classes of interest, and then mix them with your custom data. This approach ensures that you have a balanced dataset for training.Here's a brief outline of the steps:
- Download the COCO dataset.
- Filter the dataset to include only images with
zebra
,elephant
, andgiraffe
. - Combine this filtered dataset with your custom data.
- Create a custom dataset YAML file as shown above.
- Train the model using the combined dataset.
I hope this helps! If you encounter any issues or need further assistance, feel free to ask. Happy training! 🚀
from ultralytics.
Thank for your feed back!
Do you have any quick tips/code to download and filter CoCo dataset as you mention?
Dat
from ultralytics.
Related Issues (20)
- Confusion metrix HOT 2
- 'list' object has no attribute 'masks' HOT 6
- Dataset not found ⚠️, missing path HOT 6
- Trying to show the XY value for detecting objects on real-time
- Request for mAP of different scale HOT 8
- FATAL ERROR! reclaim_blob_allocator get wild allocator in Jetson Nano with NCNN Inference HOT 2
- data lable wrong when train yoloworld HOT 7
- Trained YOLOv8 model converted to CoreML doesn't give any predictions HOT 4
- About glean-t and yolov9-t HOT 4
- When I install torch_image, imgsz doesn't work. HOT 1
- Oriented Bounding box health check HOT 3
- [YoloV8] Torch compile model shows metrics degradation on the coco128 dataset HOT 4
- Address Discord badge error HOT 1
- How to reduce the number of target contour points predicted by YOLOv8-Sseg HOT 3
- val step slow down during training HOT 3
- Batch inference speed same than looping through a bunch of imgs HOT 1
- Using YOLOv8(seg) with SHAP HOT 5
- yolov8 object_counting in and out doesn't differentiate for defined line HOT 4
- how to set `verbose:false` so that model can predict the batches without printing anything in the terminal HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ultralytics.