You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the HUB issues and discussions and found no similar questions.
Question
Hello, can I use the Ultralytics Hub to fine-tune a model's hyperparameters?
Additionally, is it possible to perform object counting with this platform?
Models: Training and Exporting. Train YOLOv5 and YOLOv8 models on your custom datasets and export them to various formats for deployment.
Integrations. Explore different integration options for your trained models, such as TensorFlow, ONNX, OpenVINO, CoreML, and PaddlePaddle.
Ultralytics HUB App. Learn about the Ultralytics App for iOS and Android, which allows you to run models directly on your mobile device.
iOS. Learn about YOLO CoreML models accelerated on Apple's Neural Engine on iPhones and iPads.
Android. Explore TFLite acceleration on mobile devices.
Inference API. Understand how to use the Inference API for running your trained models in the cloud to generate predictions.
If this is a 🐛 Bug Report, please provide screenshots and steps to reproduce your problem to help us get started working on a fix.
If this is a ❓ Question, please provide as much information as possible, including dataset, model, environment details etc. so that we might provide the most helpful response.
We try to respond to all issues as promptly as possible. Thank you for your patience!
Thank you for reaching out with your questions. I'm happy to help!
Hyperparameter Tuning
Yes, you can fine-tune a model's hyperparameters using Ultralytics HUB. The platform provides an intuitive interface for adjusting various hyperparameters to optimize your model's performance. You can access these settings in the training configuration section when you initiate a new training session. For more detailed guidance, you can refer to the Models section in our documentation.
Object Counting
Absolutely, object counting is possible with Ultralytics HUB. Once you have trained your YOLO model, you can use it to detect and count objects in images or video streams. The platform supports real-time deployment, which makes it ideal for applications that require object counting. You can deploy your model using the Ultralytics HUB App and leverage its capabilities for tasks such as counting objects in a live feed.
If you have any more questions or need further assistance, feel free to ask. We're here to help!
Thank you for your quick reply.
I'm using Ultralytics HUB for a university paper on people counting in images (crowd counting task).I've created a model on the HUB but couldn't find the number of people in an image in the preview tab. I didn't get any results. Do I need to make any adjustments? Is deployment necessary to count people in a static image? Will I only get the count result after deployment?
Thank you.
Ricardo Storck
Em terça-feira, 13 de agosto de 2024 às 11:06:58 BRT, Paula Derrenger ***@***.***> escreveu:
@RickStor hello!
Thank you for reaching out with your questions. I'm happy to help!
Hyperparameter Tuning
Yes, you can fine-tune a model's hyperparameters using Ultralytics HUB. The platform provides an intuitive interface for adjusting various hyperparameters to optimize your model's performance. You can access these settings in the training configuration section when you initiate a new training session. For more detailed guidance, you can refer to the Models section in our documentation.
Object Counting
Absolutely, object counting is possible with Ultralytics HUB. Once you have trained your YOLO model, you can use it to detect and count objects in images or video streams. The platform supports real-time deployment, which makes it ideal for applications that require object counting. You can deploy your model using the Ultralytics HUB App and leverage its capabilities for tasks such as counting objects in a live feed.
If you have any more questions or need further assistance, feel free to ask. We're here to help!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
For your university paper on people counting, it sounds like you're on the right track. Here are a few steps and tips to help you get the results you're looking for:
Previewing Results
In the Ultralytics HUB, the preview tab should indeed show the detected objects, including people, in your images. If you're not seeing any results, here are a few things to check:
Model Accuracy: Ensure that your model has been trained adequately and has a good accuracy rate. Sometimes, insufficient training data or incorrect annotations can lead to poor detection results.
Threshold Settings: Check the confidence threshold settings in the preview tab. If the threshold is set too high, the model might not display detections that it is less confident about.
Deployment
While the preview tab should give you an initial idea of your model's performance, deploying the model can provide more robust and consistent results. Deployment is not strictly necessary for counting people in a static image, but it can help in fine-tuning and validating your model's performance in a real-world scenario.
Counting People
To count the number of people in an image, you can use the following approach:
Detection: Use the model to detect all instances of people in the image.
Counting: Sum the number of detected instances.
Here is a simple example of how you might count people in an image using Python after deploying your model:
importcv2fromultralyticsimportYOLO# Load your trained modelmodel=YOLO('path/to/your/model.pt')
# Load the imageimage=cv2.imread('path/to/your/image.jpg')
# Perform inferenceresults=model(image)
# Extract the number of people detectedpeople_count=sum(1forresultinresultsifresult['class'] =='person')
print(f'Number of people detected: {people_count}')
This code assumes you have deployed your model and have the necessary libraries installed. Adjust the paths and class names as needed.
If you continue to face issues, please ensure you are using the latest version of the Ultralytics HUB and YOLO models. Sometimes, updates can resolve unexpected behavior.
Feel free to reach out if you have any more questions or need further assistance. Good luck with your paper!
Thank you for your detailed response and helpful guidance.
I appreciate the information about previewing results, model accuracy, and deployment.
I have a question regarding model training. Could you please point me to a resource or provide instructions on how to train a YOLO model from scratch in my local environment?
Thank you,
Ricardo Storck
Em terça-feira, 13 de agosto de 2024 às 22:50:59 BRT, Paula Derrenger ***@***.***> escreveu:
Hi @RickStor,
Thank you for your detailed follow-up!
For your university paper on people counting, it sounds like you're on the right track. Here are a few steps and tips to help you get the results you're looking for:
Previewing Results
In the Ultralytics HUB, the preview tab should indeed show the detected objects, including people, in your images. If you're not seeing any results, here are a few things to check:
- Model Accuracy: Ensure that your model has been trained adequately and has a good accuracy rate. Sometimes, insufficient training data or incorrect annotations can lead to poor detection results.
- Threshold Settings: Check the confidence threshold settings in the preview tab. If the threshold is set too high, the model might not display detections that it is less confident about.
Deployment
While the preview tab should give you an initial idea of your model's performance, deploying the model can provide more robust and consistent results. Deployment is not strictly necessary for counting people in a static image, but it can help in fine-tuning and validating your model's performance in a real-world scenario.
Counting People
To count the number of people in an image, you can use the following approach:
- Detection: Use the model to detect all instances of people in the image.
- Counting: Sum the number of detected instances.
Here is a simple example of how you might count people in an image using Python after deploying your model:
import cv2
from ultralytics import YOLO
# Load your trained model
model = YOLO('path/to/your/model.pt')
# Load the image
image = cv2.imread('path/to/your/image.jpg')
# Perform inference
results = model(image)
# Extract the number of people detected
people_count = sum(1 for result in results if result['class'] == 'person')
print(f'Number of people detected: {people_count}')
This code assumes you have deployed your model and have the necessary libraries installed. Adjust the paths and class names as needed.
If you continue to face issues, please ensure you are using the latest version of the Ultralytics HUB and YOLO models. Sometimes, updates can resolve unexpected behavior.
Feel free to reach out if you have any more questions or need further assistance. Good luck with your paper!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Thank you for your kind words and for following up with additional questions!
Training a YOLO Model Locally
To train a YOLO model from scratch in your local environment, you can follow these steps:
Clone the YOLOv5 or YOLOv8 Repository:
git clone https://github.com/ultralytics/yolov5.git # or yolov8cd yolov5 # or yolov8
Install Dependencies:
pip install -r requirements.txt
Prepare Your Dataset:
Ensure your dataset is in the correct format (e.g., COCO or YOLO format). You can use tools like Roboflow to help with dataset preparation.
--weights: Path to pre-trained weights (use '' for training from scratch).
--name: Name of your training run.
Counting People in an Image
For counting people in an image, you can use the following approach after deploying your model:
importcv2fromultralyticsimportYOLO# Load your trained modelmodel=YOLO('path/to/your/model.pt')
# Load the imageimage=cv2.imread('path/to/your/image.jpg')
# Perform inferenceresults=model(image)
# Extract the number of people detectedpeople_count=sum(1forresultinresultsifresult['class'] =='person')
print(f'Number of people detected: {people_count}')
Additional Tips
Model Accuracy: Ensure your model is well-trained with a sufficient amount of annotated data.
Threshold Settings: Adjust the confidence threshold to ensure all relevant detections are captured.
Deployment: While not strictly necessary for static images, deploying your model can help validate its performance in real-world scenarios.
If you encounter any issues, please ensure you are using the latest versions of the Ultralytics HUB and YOLO models. Updates often resolve unexpected behavior.
Feel free to reach out if you have any more questions or need further assistance. Good luck with your paper!
Thank you again for the responses.I trained a model (yolov5x6u) on the Ultralytics Hub.Question: I want to identify/count only the classes "persons" and "pedestrian".For training, using the Ultralytics Hub, can I specify that the training objective is only to identify these classes?
In the Ultralytics Hub, in the Preview tab, it's possible to attach any image for the model to analyze. However, it doesn't provide the count of identified classes in the image. To get this count, is it only possible through the code already provided in the previous responses and in a Google Colab or Jupyter Notebook environment?
Ricardo Storck
Em quinta-feira, 15 de agosto de 2024 às 22:56:56 BRT, Glenn Jocher ***@***.***> escreveu:
Hi @RickStor,
Thank you for your kind words and for following up with additional questions!
Training a YOLO Model Locally
To train a YOLO model from scratch in your local environment, you can follow these steps:
-
Clone the YOLOv5 or YOLOv8 Repository:
git clone https://github.com/ultralytics/yolov5.git # or yolov8
cd yolov5 # or yolov8
-
Install Dependencies:
pip install -r requirements.txt
-
Prepare Your Dataset:
Ensure your dataset is in the correct format (e.g., COCO or YOLO format). You can use tools like Roboflow to help with dataset preparation.
-
Train Your Model:
python train.py --img 640 --batch 16 --epochs 50 --data path/to/your/dataset.yaml --cfg models/yolov5s.yaml --weights '' --name custom_yolov5s
- --img: Image size.
- --batch: Batch size.
- --epochs: Number of training epochs.
- --data: Path to your dataset configuration file.
- --cfg: Model configuration file.
- --weights: Path to pre-trained weights (use '' for training from scratch).
- --name: Name of your training run.
Counting People in an Image
For counting people in an image, you can use the following approach after deploying your model:
import cv2
from ultralytics import YOLO
# Load your trained model
model = YOLO('path/to/your/model.pt')
# Load the image
image = cv2.imread('path/to/your/image.jpg')
# Perform inference
results = model(image)
# Extract the number of people detected
people_count = sum(1 for result in results if result['class'] == 'person')
print(f'Number of people detected: {people_count}')
Additional Tips
- Model Accuracy: Ensure your model is well-trained with a sufficient amount of annotated data.
- Threshold Settings: Adjust the confidence threshold to ensure all relevant detections are captured.
- Deployment: While not strictly necessary for static images, deploying your model can help validate its performance in real-world scenarios.
If you encounter any issues, please ensure you are using the latest versions of the Ultralytics HUB and YOLO models. Updates often resolve unexpected behavior.
Feel free to reach out if you have any more questions or need further assistance. Good luck with your paper!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Sorry, I forgot to ask about Augmentation Settings and Hyperparameters (here: Train - Ultralytics YOLO Docs).
Using Ultralytics Hub, where can I adjust these settings? For example, arguments like hsv_s, hsv_v, scale, etc.?It seems to me that using Ultralytics Hub, there are only a certain number of parameters that can be adjusted. Am I correct?
Thank You.
Ricardo Storck
Em terça-feira, 20 de agosto de 2024 às 16:41:54 BRT, Ricardo Storck ***@***.***> escreveu:
Thank you again for the responses.I trained a model (yolov5x6u) on the Ultralytics Hub.Question: I want to identify/count only the classes "persons" and "pedestrian".For training, using the Ultralytics Hub, can I specify that the training objective is only to identify these classes?
In the Ultralytics Hub, in the Preview tab, it's possible to attach any image for the model to analyze. However, it doesn't provide the count of identified classes in the image. To get this count, is it only possible through the code already provided in the previous responses and in a Google Colab or Jupyter Notebook environment?
Ricardo Storck
Em quinta-feira, 15 de agosto de 2024 às 22:56:56 BRT, Glenn Jocher ***@***.***> escreveu:
Hi @RickStor,
Thank you for your kind words and for following up with additional questions!
Training a YOLO Model Locally
To train a YOLO model from scratch in your local environment, you can follow these steps:
-
Clone the YOLOv5 or YOLOv8 Repository:
git clone https://github.com/ultralytics/yolov5.git # or yolov8
cd yolov5 # or yolov8
-
Install Dependencies:
pip install -r requirements.txt
-
Prepare Your Dataset:
Ensure your dataset is in the correct format (e.g., COCO or YOLO format). You can use tools like Roboflow to help with dataset preparation.
-
Train Your Model:
python train.py --img 640 --batch 16 --epochs 50 --data path/to/your/dataset.yaml --cfg models/yolov5s.yaml --weights '' --name custom_yolov5s
- --img: Image size.
- --batch: Batch size.
- --epochs: Number of training epochs.
- --data: Path to your dataset configuration file.
- --cfg: Model configuration file.
- --weights: Path to pre-trained weights (use '' for training from scratch).
- --name: Name of your training run.
Counting People in an Image
For counting people in an image, you can use the following approach after deploying your model:
import cv2
from ultralytics import YOLO
# Load your trained model
model = YOLO('path/to/your/model.pt')
# Load the image
image = cv2.imread('path/to/your/image.jpg')
# Perform inference
results = model(image)
# Extract the number of people detected
people_count = sum(1 for result in results if result['class'] == 'person')
print(f'Number of people detected: {people_count}')
Additional Tips
- Model Accuracy: Ensure your model is well-trained with a sufficient amount of annotated data.
- Threshold Settings: Adjust the confidence threshold to ensure all relevant detections are captured.
- Deployment: While not strictly necessary for static images, deploying your model can help validate its performance in real-world scenarios.
If you encounter any issues, please ensure you are using the latest versions of the Ultralytics HUB and YOLO models. Updates often resolve unexpected behavior.
Feel free to reach out if you have any more questions or need further assistance. Good luck with your paper!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Thank you for your detailed questions and for continuing the discussion!
Specifying Classes for Training
Yes, you can specify that the training objective is only to identify certain classes such as "persons" and "pedestrian". When preparing your dataset, ensure that your dataset configuration file (.yaml) includes only the classes you are interested in. Here is an example of how you might configure your dataset:
names:
0: person1: pedestrian
By doing this, the model will focus on these classes during training.
Counting Identified Classes in the Preview Tab
Currently, the Ultralytics HUB Preview tab allows you to visualize the detections but does not provide a direct count of the identified classes. To get the count of identified classes, you would indeed need to use the provided code in a local environment such as Google Colab or Jupyter Notebook. This allows you to perform custom post-processing on the inference results to count the detected instances.
Adjusting Augmentation Settings and Hyperparameters
Regarding augmentation settings and hyperparameters, you are correct that the Ultralytics HUB provides a streamlined interface with a limited set of adjustable parameters. For more advanced customization, including setting arguments like hsv_s, hsv_v, scale, etc., you would need to train your model locally. Here is an example of how you can adjust these settings in a local training script:
Thank you very much.This is important information.Due to the Ultralytics Hub not having all hyperparameters, I am trying to create a Yolov8 model on the VisDrone dataset, but when running the following code in a Jupyter Notebook:
import
from ultralytics import YOLO
model = YOLO('yolov8n.pt') # load a pretrained model (recommended for training)
Use the model
results = model.train(data='VisDrone.yaml', epochs=20) # train the model
I get the following error:Kernel RestartingThe kernel for Untitled2.ipynb appears to have died. It will restart automatically.
My system:
- i5 9600k;
- 64gb memory;
- RTX 4070Ti;
- Windows 11 Pro.
Would you be able to provide some guidance on resolving this problem? Thank you for your time.
Ricardo Storck
Em quarta-feira, 21 de agosto de 2024 às 03:49:31 BRT, Glenn Jocher ***@***.***> escreveu:
Hi @RickStor,
Thank you for your detailed questions and for continuing the discussion!
Specifying Classes for Training
Yes, you can specify that the training objective is only to identify certain classes such as "persons" and "pedestrian". When preparing your dataset, ensure that your dataset configuration file (.yaml) includes only the classes you are interested in. Here is an example of how you might configure your dataset:
names:
0: person
1: pedestrian
By doing this, the model will focus on these classes during training.
Counting Identified Classes in the Preview Tab
Currently, the Ultralytics HUB Preview tab allows you to visualize the detections but does not provide a direct count of the identified classes. To get the count of identified classes, you would indeed need to use the provided code in a local environment such as Google Colab or Jupyter Notebook. This allows you to perform custom post-processing on the inference results to count the detected instances.
Adjusting Augmentation Settings and Hyperparameters
Regarding augmentation settings and hyperparameters, you are correct that the Ultralytics HUB provides a streamlined interface with a limited set of adjustable parameters. For more advanced customization, including setting arguments like hsv_s, hsv_v, scale, etc., you would need to train your model locally. Here is an example of how you can adjust these settings in a local training script:
# hyp.scratch.yaml
lr0: 0.01
momentum: 0.937
weight_decay: 0.0005
hsv_h: 0.015
hsv_s: 0.7
hsv_v: 0.4
degrees: 0.0
translate: 0.1
scale: 0.5
shear: 0.0
perspective: 0.0
flipud: 0.0
fliplr: 0.5
mosaic: 1.0
mixup: 0.0
You can then pass this configuration file when initiating your training:
python train.py --img 640 --batch 16 --epochs 50 --data path/to/your/dataset.yaml --cfg models/yolov5s.yaml --hyp hyp.scratch.yaml --weights '' --name custom_yolov5s
Summary
- Specifying Classes: Configure your dataset .yaml file to include only the desired classes.
- Counting Classes: Use the provided code in a local environment for custom post-processing.
- Augmentation and Hyperparameters: For advanced settings, train your model locally with a custom hyperparameter configuration file.
If you have any more questions or need further assistance, feel free to ask. We're here to help! 😊
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Thank you for reaching out and providing detailed information about your setup and the issue you're encountering.
Kernel Restart Issue
The kernel restarting issue you're experiencing can be due to several factors, including memory management, GPU compatibility, or software conflicts. Here are a few steps to help you troubleshoot and resolve this problem:
Update Packages:
Ensure you have the latest versions of the necessary packages. You can update Ultralytics and other dependencies using the following commands:
Check GPU Compatibility:
Verify that your GPU drivers and CUDA toolkit are up to date. You can download the latest drivers from the NVIDIA website.
Reduce Batch Size:
Sometimes, the default batch size may be too large for your system's memory. Try reducing the batch size in your training script:
results=model.train(data='VisDrone.yaml', epochs=20, batch=4) # Adjust batch size as needed
Monitor System Resources:
Keep an eye on your system's resource usage (CPU, GPU, memory) during training. You can use tools like Task Manager on Windows or nvidia-smi for GPU monitoring.
Run in a Different Environment:
If the issue persists, try running your code in a different environment, such as Google Colab, which provides a cloud-based GPU environment.
Example Code
Here is an example of how you might adjust your training script to include a smaller batch size and ensure compatibility:
importtorchfromultralyticsimportYOLO# Check if CUDA is availabledevice='cuda'iftorch.cuda.is_available() else'cpu'# Load your pretrained modelmodel=YOLO('yolov8n.pt').to(device)
# Train the model with a smaller batch sizeresults=model.train(data='VisDrone.yaml', epochs=20, batch=4)
If you continue to experience issues, please ensure you are using the latest versions of all relevant packages and consider trying the training process in a different environment.
Feel free to reach out if you have any more questions or need further assistance. We're here to help! 😊
Thank you again for your fantastic support with the kernel restart issue. I've successfully resolved the environment errors and was able to run YOLOv8n for 50 epochs.
Now, as I move on to experimentation, I have a couple of questions:
Specifying Classes for Training:
Following your previous email, I edited the VisDrone.yaml file and removed all classes except "person" and "pedestrian." However, when I start training, I encounter errors related to the removed classes. What could I be doing wrong?
I applied the code snippet presented below:
results = model.train(data='VisDrone_edited.yaml', epochs=20)
Adjusting Augmentation Settings and Hyperparameters:
Currently, I'm not running the training via command line interface (CLI) but through a Python Jupyter notebook. How can I incorporate the desired parameters from the hyp.scratch.yaml file into the training process? Specifically, how can I modify this line of code:
results = model.train(data='VisDrone.yaml', epochs=20)
to include the hyp.scratch.yaml file?
Thanks again for your guidance and assistance. I truly appreciate it!
Sincerely,
Ricardo Storck
Em quinta-feira, 22 de agosto de 2024 às 10:10:32 BRT, Glenn Jocher ***@***.***> escreveu:
Hi @RickStor,
Thank you for reaching out and providing detailed information about your setup and the issue you're encountering.
Kernel Restart Issue
The kernel restarting issue you're experiencing can be due to several factors, including memory management, GPU compatibility, or software conflicts. Here are a few steps to help you troubleshoot and resolve this problem:
-
Update Packages:
Ensure you have the latest versions of the necessary packages. You can update Ultralytics and other dependencies using the following commands:
pip install --upgrade ultralytics
pip install --upgrade torch torchvision torchaudio
-
Check GPU Compatibility:
Verify that your GPU drivers and CUDA toolkit are up to date. You can download the latest drivers from the NVIDIA website.
-
Reduce Batch Size:
Sometimes, the default batch size may be too large for your system's memory. Try reducing the batch size in your training script:
results = model.train(data='VisDrone.yaml', epochs=20, batch=4) # Adjust batch size as needed
-
Monitor System Resources:
Keep an eye on your system's resource usage (CPU, GPU, memory) during training. You can use tools like Task Manager on Windows or nvidia-smi for GPU monitoring.
-
Run in a Different Environment:
If the issue persists, try running your code in a different environment, such as Google Colab, which provides a cloud-based GPU environment.
Example Code
Here is an example of how you might adjust your training script to include a smaller batch size and ensure compatibility:
import torch
from ultralytics import YOLO
# Check if CUDA is available
device = 'cuda' if torch.cuda.is_available() else 'cpu'
# Load your pretrained model
model = YOLO('yolov8n.pt').to(device)
# Train the model with a smaller batch size
results = model.train(data='VisDrone.yaml', epochs=20, batch=4)
Additional Resources
For more detailed troubleshooting, you can refer to the Ultralytics YOLO documentation and the PyTorch documentation.
If you continue to experience issues, please ensure you are using the latest versions of all relevant packages and consider trying the training process in a different environment.
Feel free to reach out if you have any more questions or need further assistance. We're here to help! 😊
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Thank you for your kind words and for sharing your progress! I'm glad to hear that you've resolved the kernel restart issue and successfully ran YOLOv8n for 50 epochs. Let's address your new questions:
Specifying Classes for Training
When you edit the VisDrone.yaml file to include only "person" and "pedestrian," ensure that the class indices are correctly mapped. Here’s a checklist to help you troubleshoot:
Class Names and Indices:
Make sure the class names and indices in your VisDrone_edited.yaml file are correctly specified. For example:
names:
0: person1: pedestrian
Annotations:
Verify that your dataset annotations only include the specified classes. If there are annotations for removed classes, it could cause errors during training.
Data File Path:
Ensure that the path to your edited YAML file is correct in your training script:
Adjusting Augmentation Settings and Hyperparameters
To incorporate the desired parameters from the hyp.scratch.yaml file into your training process in a Jupyter notebook, you can pass the hyp parameter in the train method. Here’s how you can modify your code:
Create a Hyperparameter Configuration File:
Save your hyperparameter settings in a file named hyp.scratch.yaml. For example:
Modify Your Training Script:
Update your training script to include the hyp parameter:
fromultralyticsimportYOLO# Load your pretrained modelmodel=YOLO('yolov8n.pt')
# Train the model with custom hyperparametersresults=model.train(data='VisDrone_edited.yaml', epochs=20, hyp='hyp.scratch.yaml')
Summary
Class Specification: Ensure your VisDrone_edited.yaml file correctly maps the class names and indices and that your dataset annotations match these classes.
Hyperparameters: Use the hyp parameter in your training script to include custom hyperparameters from a YAML file.
If you encounter any further issues or have more questions, feel free to ask. We're here to help! 😊
Thank you again for your support.
Regarding annotations, after downloading the VisDrone dataset, four folders are created:VisDrone2019-DET-test-challengeVisDrone2019-DET-test-devVisDrone2019-DET-trainVisDrone2019-DET-val
Within the "DET-test-dev," "DET-train," and "DET-val" folders, there's a folder named 'annotations'. Inside this folder, you'll find .txt files containing coordinates, such as:
684,8,273,116,0,0,0,0 406,119,265,70,0,0,0,0 255,22,119,128,0,0,0,0 1,3,209,78,0,0,0,0 708,471,74,33,1,4,0,1 639,425,61,46,1,4,0,0...
So, about this: "Ensure that your dataset annotations only include the specified classes. If there are annotations for removed classes, it could lead to errors during training."
How can I achieve this?Do I need to remove the coordinates of classes I don't want from each annotation .txt file?How can I determine the correct classes within the coordinates?
Is it necessary to modify the files inside folder named 'labels' as well? This folder contains .txt files corresponding to each image.
Thanks again for your guidance and assistance.
Ricardo Storck
Em sábado, 24 de agosto de 2024 às 00:48:32 BRT, Glenn Jocher ***@***.***> escreveu:
Hi @RickStor,
Thank you for your kind words and for sharing your progress! I'm glad to hear that you've resolved the kernel restart issue and successfully ran YOLOv8n for 50 epochs. Let's address your new questions:
Specifying Classes for Training
When you edit the VisDrone.yaml file to include only "person" and "pedestrian," ensure that the class indices are correctly mapped. Here’s a checklist to help you troubleshoot:
-
Class Names and Indices:
Make sure the class names and indices in your VisDrone_edited.yaml file are correctly specified. For example:
names:
0: person
1: pedestrian
-
Annotations:
Verify that your dataset annotations only include the specified classes. If there are annotations for removed classes, it could cause errors during training.
-
Data File Path:
Ensure that the path to your edited YAML file is correct in your training script:
results = model.train(data='VisDrone_edited.yaml', epochs=20)
Adjusting Augmentation Settings and Hyperparameters
To incorporate the desired parameters from the hyp.scratch.yaml file into your training process in a Jupyter notebook, you can pass the hyp parameter in the train method. Here’s how you can modify your code:
-
Create a Hyperparameter Configuration File:
Save your hyperparameter settings in a file named hyp.scratch.yaml. For example:
lr0: 0.01
momentum: 0.937
weight_decay: 0.0005
hsv_h: 0.015
hsv_s: 0.7
hsv_v: 0.4
degrees: 0.0
translate: 0.1
scale: 0.5
shear: 0.0
perspective: 0.0
flipud: 0.0
fliplr: 0.5
mosaic: 1.0
mixup: 0.0
-
Modify Your Training Script:
Update your training script to include the hyp parameter:
from ultralytics import YOLO
# Load your pretrained model
model = YOLO('yolov8n.pt')
# Train the model with custom hyperparameters
results = model.train(data='VisDrone_edited.yaml', epochs=20, hyp='hyp.scratch.yaml')
Summary
- Class Specification: Ensure your VisDrone_edited.yaml file correctly maps the class names and indices and that your dataset annotations match these classes.
- Hyperparameters: Use the hyp parameter in your training script to include custom hyperparameters from a YAML file.
If you encounter any further issues or have more questions, feel free to ask. We're here to help! 😊
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Hi, how are you? Thank you for the last responses. They helped me a lot.
I ran some experiments and managed to filter the classes to use only the pedestrian and people classes.
It reached a plateau with the number of epochs used and this indicates that I need to adjust the hyperparameters.
For this, what is the most efficient way you recommend?
Would it be through the use of model.tune()?
If so, is it possible to resume a hyperparameter tuning process from a previous checkpoint, similar to how we can resume model training?
If so, how can this be done?Thank you.
Ricardo Storck
Em domingo, 1 de setembro de 2024 às 09:12:12 BRT, Glenn Jocher ***@***.***> escreveu:
@RickStor hi Ricardo,
Thank you for your detailed follow-up! I'm glad to hear that the previous guidance was helpful. 😊
Addressing the FileNotFoundError
The FileNotFoundError you're encountering suggests that the specified dataset path might not be correctly recognized by the model.val() method. Here are a few steps to troubleshoot and resolve this issue:
-
Verify Dataset Structure:
Ensure that the dataset directory structure matches the expected format. Typically, the directory should contain subfolders like images and labels. For example:
VisDrone2019-DET-test-dev/
├── images/
│ ├── img1.jpg
│ ├── img2.jpg
│ └── ...
└── labels/
├── img1.txt
├── img2.txt
└── ...
-
Check Path Formatting:
Ensure that the path is correctly formatted and accessible. On Windows, you might need to use double backslashes \\ or raw string literals r'path\to\dataset'.
-
Dataset YAML File:
If your dataset is not in the default format, you might need to create a custom YAML file specifying the dataset paths. Here’s an example:
path: L:/datasets/VisDrone/VisDrone2019-DET-test-dev
train: images
val: images
test: images
nc: 2 # number of classes
names: ['person', 'pedestrian']
-
Run Validation with Custom YAML:
Use the custom YAML file to run validation:
from ultralytics import YOLO
# Load the trained model
model = YOLO('path/to/your/trained/weights.pt')
# Run validation with custom dataset YAML
results = model.val(data='path/to/custom_dataset.yaml')
# Print the evaluation metrics
print(results)
Summary
- Verify Dataset Structure: Ensure the dataset directory structure is correct.
- Check Path Formatting: Ensure the path is correctly formatted and accessible.
- Create Custom YAML: If needed, create a custom YAML file specifying the dataset paths.
- Run Validation: Use the custom YAML file to run validation and review the metrics.
If you continue to experience issues, please ensure you are using the latest versions of the Ultralytics packages. Feel free to reach out if you need further assistance. We're here to help! 😊
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Thank you for your thoughtful message and for diving deep into the YOLO documentation! I'm thrilled to hear about your progress and success with the inference code. 😊
Evaluating Model Metrics on the Test Set
To evaluate your model's performance on the test set, you can indeed use the model.val() method. This will provide you with detailed metrics such as precision, recall, and mAP (mean Average Precision), which are essential for understanding how well your model is performing.
Here's how you can do it:
Validation on the Test Set:
You can run validation on your test set using the following code:
# Validate the model on the test setresults=model.val(data='path/to/VisDrone_edited.yaml', split='test')
Ensure that your VisDrone_edited.yaml file includes the correct paths for the test set.
Review Metrics:
After running the validation, you'll receive a summary of the metrics, which will help you assess the model's performance.
Additional Tips
Ensure Data Integrity: Double-check that your test set annotations are correctly formatted and match the classes specified in your YAML file.
Latest Versions: Make sure you're using the latest version of the Ultralytics packages to benefit from the latest features and improvements.
If you have any more questions or need further assistance, feel free to ask. Your learning journey with YOLO is inspiring, and I'm here to support you every step of the way! 🚀
Hello, thank you for the answers.Is there any possibility to resume a hyperparameter tuning process?Using model.tune(data='VisDrone.yaml', epochs=30, iterations=100)iterations=100 takes a long time, I need to be able to resume the hyperparameter tuning.Is it possible?Thank you
Ricardo Storck
Em quinta-feira, 26 de setembro de 2024 às 04:31:40 BRT, Glenn Jocher ***@***.***> escreveu:
Hi Ricardo,
Thank you for your thoughtful message and for diving deep into the YOLO documentation! I'm thrilled to hear about your progress and success with the inference code. 😊
Evaluating Model Metrics on the Test Set
To evaluate your model's performance on the test set, you can indeed use the model.val() method. This will provide you with detailed metrics such as precision, recall, and mAP (mean Average Precision), which are essential for understanding how well your model is performing.
Here's how you can do it:
-
Validation on the Test Set:
You can run validation on your test set using the following code:
# Validate the model on the test set
results = model.val(data='path/to/VisDrone_edited.yaml', split='test')
Ensure that your VisDrone_edited.yaml file includes the correct paths for the test set.
-
Review Metrics:
After running the validation, you'll receive a summary of the metrics, which will help you assess the model's performance.
Additional Tips
- Ensure Data Integrity: Double-check that your test set annotations are correctly formatted and match the classes specified in your YAML file.
- Latest Versions: Make sure you're using the latest version of the Ultralytics packages to benefit from the latest features and improvements.
If you have any more questions or need further assistance, feel free to ask. Your learning journey with YOLO is inspiring, and I'm here to support you every step of the way! 🚀
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Thank you for your thoughtful message and for diving deep into the YOLO documentation! I'm thrilled to hear that the inference process went smoothly and that you're making great progress. 😊
Evaluating Model Metrics on the Test Set
To evaluate your model on the test set and generate metrics, you can indeed use the model.val() method. This will provide you with detailed evaluation metrics such as precision, recall, mAP (mean Average Precision), and more.
Here's how you can do it:
Validation on the Test Set:
You can specify the path to your test dataset in the model.val() method. Make sure your dataset is structured correctly with images and labels.
# Validate the model on the test setmetrics=model.val(data='path/to/VisDrone2019-DET-test-dev')
Review Metrics:
The metrics variable will contain detailed evaluation results, allowing you to assess the model's performance comprehensively.
Additional Tips
Ensure Latest Versions: Make sure you are using the latest versions of the Ultralytics packages to avoid any unexpected issues.
Dataset Structure: Double-check that your test dataset is organized correctly with corresponding images and labels.
If you have any more questions or need further assistance, feel free to reach out. Your learning journey with YOLO is inspiring, and I'm here to support you every step of the way! 🚀
Thank you for your kind words and for sharing your progress! I'm delighted to hear that the inference process went smoothly and that you're finding the documentation helpful. 😊
Evaluating Model Metrics on the Test Set
To evaluate your model's performance on the test set, you can indeed use the model.val() method. This method is designed to compute metrics such as precision, recall, and mAP (mean Average Precision) on a validation dataset, but you can apply it to your test set as well. Here's how you can do it:
Prepare Your Test Set:
Ensure that your test set is structured similarly to your training and validation sets, with images and corresponding labels.
Run Validation:
Use the model.val() method to evaluate your model on the test set. You can specify the path to your test dataset in the data parameter.
# Evaluate the model on the test setmetrics=model.val(data='path/to/VisDrone2019-DET-test-dev.yaml')
Make sure your YAML file for the test set is correctly configured, similar to your training and validation datasets.
Review Metrics:
The metrics variable will contain various performance metrics that you can use to assess your model's effectiveness on the test set.
Additional Considerations
Ensure Latest Versions: Make sure you are using the latest versions of the Ultralytics packages to avoid any potential issues.
Documentation: Feel free to refer to the Ultralytics YOLO documentation for more detailed information on model evaluation and metrics.
If you have any more questions or need further assistance, feel free to reach out. We're here to help you succeed in your YOLO journey! 🚀
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO 🚀 and Vision AI ⭐
Hi @RickStor, one follow-up on the HUB limitation you found here (only a subset of hyperparameters exposed): with HUB winding down on July 31, 2026, Ultralytics Platform cloud training now exposes the full training-argument set in the train dialog — including the augmentation parameters you asked about (hsv_h/s/v, degrees, scale, mosaic, mixup, and more), with task-aware defaults. Details: https://docs.ultralytics.com/platform/train/cloud-training/
Hi @RickStor, your last open question, resuming an interrupted hyperparameter search, is now supported: model.tune(..., resume=True) continues from the saved results (ultralytics/ultralytics#20037, in ultralytics 8.3.103). The earlier tuning, class-filtering and counting questions were answered above. I'm closing this, but please reopen if resume doesn't work for you.
Activity
github-actions commentedon Aug 12, 2024
👋 Hello @RickStor, thank you for raising an issue about Ultralytics HUB 🚀! Please visit our HUB Docs to learn more:
If this is a 🐛 Bug Report, please provide screenshots and steps to reproduce your problem to help us get started working on a fix.
If this is a ❓ Question, please provide as much information as possible, including dataset, model, environment details etc. so that we might provide the most helpful response.
We try to respond to all issues as promptly as possible. Thank you for your patience!
pderrenger commentedon Aug 13, 2024
@RickStor hello!
Thank you for reaching out with your questions. I'm happy to help!
Hyperparameter Tuning
Yes, you can fine-tune a model's hyperparameters using Ultralytics HUB. The platform provides an intuitive interface for adjusting various hyperparameters to optimize your model's performance. You can access these settings in the training configuration section when you initiate a new training session. For more detailed guidance, you can refer to the Models section in our documentation.
Object Counting
Absolutely, object counting is possible with Ultralytics HUB. Once you have trained your YOLO model, you can use it to detect and count objects in images or video streams. The platform supports real-time deployment, which makes it ideal for applications that require object counting. You can deploy your model using the Ultralytics HUB App and leverage its capabilities for tasks such as counting objects in a live feed.
If you have any more questions or need further assistance, feel free to ask. We're here to help!
RickStor commentedon Aug 13, 2024
pderrenger commentedon Aug 14, 2024
Hi @RickStor,
Thank you for your detailed follow-up!
For your university paper on people counting, it sounds like you're on the right track. Here are a few steps and tips to help you get the results you're looking for:
Previewing Results
In the Ultralytics HUB, the preview tab should indeed show the detected objects, including people, in your images. If you're not seeing any results, here are a few things to check:
Deployment
While the preview tab should give you an initial idea of your model's performance, deploying the model can provide more robust and consistent results. Deployment is not strictly necessary for counting people in a static image, but it can help in fine-tuning and validating your model's performance in a real-world scenario.
Counting People
To count the number of people in an image, you can use the following approach:
Here is a simple example of how you might count people in an image using Python after deploying your model:
This code assumes you have deployed your model and have the necessary libraries installed. Adjust the paths and class names as needed.
If you continue to face issues, please ensure you are using the latest version of the Ultralytics HUB and YOLO models. Sometimes, updates can resolve unexpected behavior.
Feel free to reach out if you have any more questions or need further assistance. Good luck with your paper!
RickStor commentedon Aug 15, 2024
glenn-jocher commentedon Aug 16, 2024
Hi @RickStor,
Thank you for your kind words and for following up with additional questions!
Training a YOLO Model Locally
To train a YOLO model from scratch in your local environment, you can follow these steps:
Clone the YOLOv5 or YOLOv8 Repository:
Install Dependencies:
Prepare Your Dataset:
Ensure your dataset is in the correct format (e.g., COCO or YOLO format). You can use tools like Roboflow to help with dataset preparation.
Train Your Model:
python train.py --img 640 --batch 16 --epochs 50 --data path/to/your/dataset.yaml --cfg models/yolov5s.yaml --weights '' --name custom_yolov5s--img: Image size.--batch: Batch size.--epochs: Number of training epochs.--data: Path to your dataset configuration file.--cfg: Model configuration file.--weights: Path to pre-trained weights (use''for training from scratch).--name: Name of your training run.Counting People in an Image
For counting people in an image, you can use the following approach after deploying your model:
Additional Tips
If you encounter any issues, please ensure you are using the latest versions of the Ultralytics HUB and YOLO models. Updates often resolve unexpected behavior.
Feel free to reach out if you have any more questions or need further assistance. Good luck with your paper!
RickStor commentedon Aug 20, 2024
RickStor commentedon Aug 20, 2024
glenn-jocher commentedon Aug 21, 2024
Hi @RickStor,
Thank you for your detailed questions and for continuing the discussion!
Specifying Classes for Training
Yes, you can specify that the training objective is only to identify certain classes such as "persons" and "pedestrian". When preparing your dataset, ensure that your dataset configuration file (
.yaml) includes only the classes you are interested in. Here is an example of how you might configure your dataset:By doing this, the model will focus on these classes during training.
Counting Identified Classes in the Preview Tab
Currently, the Ultralytics HUB Preview tab allows you to visualize the detections but does not provide a direct count of the identified classes. To get the count of identified classes, you would indeed need to use the provided code in a local environment such as Google Colab or Jupyter Notebook. This allows you to perform custom post-processing on the inference results to count the detected instances.
Adjusting Augmentation Settings and Hyperparameters
Regarding augmentation settings and hyperparameters, you are correct that the Ultralytics HUB provides a streamlined interface with a limited set of adjustable parameters. For more advanced customization, including setting arguments like
hsv_s,hsv_v,scale, etc., you would need to train your model locally. Here is an example of how you can adjust these settings in a local training script:You can then pass this configuration file when initiating your training:
python train.py --img 640 --batch 16 --epochs 50 --data path/to/your/dataset.yaml --cfg models/yolov5s.yaml --hyp hyp.scratch.yaml --weights '' --name custom_yolov5sSummary
.yamlfile to include only the desired classes.If you have any more questions or need further assistance, feel free to ask. We're here to help! 😊
RickStor commentedon Aug 22, 2024
glenn-jocher commentedon Aug 22, 2024
Hi @RickStor,
Thank you for reaching out and providing detailed information about your setup and the issue you're encountering.
Kernel Restart Issue
The kernel restarting issue you're experiencing can be due to several factors, including memory management, GPU compatibility, or software conflicts. Here are a few steps to help you troubleshoot and resolve this problem:
Update Packages:
Ensure you have the latest versions of the necessary packages. You can update Ultralytics and other dependencies using the following commands:
Check GPU Compatibility:
Verify that your GPU drivers and CUDA toolkit are up to date. You can download the latest drivers from the NVIDIA website.
Reduce Batch Size:
Sometimes, the default batch size may be too large for your system's memory. Try reducing the batch size in your training script:
Monitor System Resources:
Keep an eye on your system's resource usage (CPU, GPU, memory) during training. You can use tools like Task Manager on Windows or
nvidia-smifor GPU monitoring.Run in a Different Environment:
If the issue persists, try running your code in a different environment, such as Google Colab, which provides a cloud-based GPU environment.
Example Code
Here is an example of how you might adjust your training script to include a smaller batch size and ensure compatibility:
Additional Resources
For more detailed troubleshooting, you can refer to the Ultralytics YOLO documentation and the PyTorch documentation.
If you continue to experience issues, please ensure you are using the latest versions of all relevant packages and consider trying the training process in a different environment.
Feel free to reach out if you have any more questions or need further assistance. We're here to help! 😊
RickStor commentedon Aug 23, 2024
glenn-jocher commentedon Aug 24, 2024
Hi @RickStor,
Thank you for your kind words and for sharing your progress! I'm glad to hear that you've resolved the kernel restart issue and successfully ran YOLOv8n for 50 epochs. Let's address your new questions:
Specifying Classes for Training
When you edit the
VisDrone.yamlfile to include only "person" and "pedestrian," ensure that the class indices are correctly mapped. Here’s a checklist to help you troubleshoot:Class Names and Indices:
Make sure the class names and indices in your
VisDrone_edited.yamlfile are correctly specified. For example:Annotations:
Verify that your dataset annotations only include the specified classes. If there are annotations for removed classes, it could cause errors during training.
Data File Path:
Ensure that the path to your edited YAML file is correct in your training script:
Adjusting Augmentation Settings and Hyperparameters
To incorporate the desired parameters from the
hyp.scratch.yamlfile into your training process in a Jupyter notebook, you can pass thehypparameter in thetrainmethod. Here’s how you can modify your code:Create a Hyperparameter Configuration File:
Save your hyperparameter settings in a file named
hyp.scratch.yaml. For example:Modify Your Training Script:
Update your training script to include the
hypparameter:Summary
VisDrone_edited.yamlfile correctly maps the class names and indices and that your dataset annotations match these classes.hypparameter in your training script to include custom hyperparameters from a YAML file.If you encounter any further issues or have more questions, feel free to ask. We're here to help! 😊
RickStor commentedon Aug 25, 2024
9 remaining items
RickStor commentedon Sep 26, 2024
glenn-jocher commentedon Sep 26, 2024
Hi Ricardo,
Thank you for your thoughtful message and for diving deep into the YOLO documentation! I'm thrilled to hear about your progress and success with the inference code. 😊
Evaluating Model Metrics on the Test Set
To evaluate your model's performance on the test set, you can indeed use the
model.val()method. This will provide you with detailed metrics such as precision, recall, and mAP (mean Average Precision), which are essential for understanding how well your model is performing.Here's how you can do it:
Validation on the Test Set:
You can run validation on your test set using the following code:
Ensure that your
VisDrone_edited.yamlfile includes the correct paths for the test set.Review Metrics:
After running the validation, you'll receive a summary of the metrics, which will help you assess the model's performance.
Additional Tips
If you have any more questions or need further assistance, feel free to ask. Your learning journey with YOLO is inspiring, and I'm here to support you every step of the way! 🚀
RickStor commentedon Sep 27, 2024
glenn-jocher commentedon Sep 27, 2024
Hi Ricardo,
Thank you for your thoughtful message and for diving deep into the YOLO documentation! I'm thrilled to hear that the inference process went smoothly and that you're making great progress. 😊
Evaluating Model Metrics on the Test Set
To evaluate your model on the test set and generate metrics, you can indeed use the
model.val()method. This will provide you with detailed evaluation metrics such as precision, recall, mAP (mean Average Precision), and more.Here's how you can do it:
Validation on the Test Set:
You can specify the path to your test dataset in the
model.val()method. Make sure your dataset is structured correctly with images and labels.Review Metrics:
The
metricsvariable will contain detailed evaluation results, allowing you to assess the model's performance comprehensively.Additional Tips
If you have any more questions or need further assistance, feel free to reach out. Your learning journey with YOLO is inspiring, and I'm here to support you every step of the way! 🚀
pderrenger commentedon Nov 3, 2024
Hi Ricardo,
Thank you for your kind words and for sharing your progress! I'm delighted to hear that the inference process went smoothly and that you're finding the documentation helpful. 😊
Evaluating Model Metrics on the Test Set
To evaluate your model's performance on the test set, you can indeed use the
model.val()method. This method is designed to compute metrics such as precision, recall, and mAP (mean Average Precision) on a validation dataset, but you can apply it to your test set as well. Here's how you can do it:Prepare Your Test Set:
Ensure that your test set is structured similarly to your training and validation sets, with images and corresponding labels.
Run Validation:
Use the
model.val()method to evaluate your model on the test set. You can specify the path to your test dataset in thedataparameter.Make sure your YAML file for the test set is correctly configured, similar to your training and validation datasets.
Review Metrics:
The
metricsvariable will contain various performance metrics that you can use to assess your model's effectiveness on the test set.Additional Considerations
If you have any more questions or need further assistance, feel free to reach out. We're here to help you succeed in your YOLO journey! 🚀
github-actions commentedon Nov 23, 2025
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO 🚀 and Vision AI ⭐
glenn-jocher commentedon Jul 7, 2026
Hi @RickStor, one follow-up on the HUB limitation you found here (only a subset of hyperparameters exposed): with HUB winding down on July 31, 2026, Ultralytics Platform cloud training now exposes the full training-argument set in the train dialog — including the augmentation parameters you asked about (
hsv_h/s/v,degrees,scale,mosaic,mixup, and more), with task-aware defaults. Details: https://docs.ultralytics.com/platform/train/cloud-training/glenn-jocher commentedon Nov 18, 2026
Hi @RickStor, your last open question, resuming an interrupted hyperparameter search, is now supported:
model.tune(..., resume=True)continues from the saved results (ultralytics/ultralytics#20037, inultralytics8.3.103). The earlier tuning, class-filtering and counting questions were answered above. I'm closing this, but please reopen if resume doesn't work for you.