-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YOLOv10 model using a custom YAML file #764
Comments
👋 Hello @jamesparkskku, 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! |
@jamesparkskku hello, Thank you for reaching out and for your detailed inquiry! I'm glad to assist you with training a YOLOv10 model using your custom YAML file. Here are the steps and guidelines to help you get started: Prerequisites and Dependencies
Integrating Your YAML File with YOLOv10
Example Commands and ScriptsHere is a step-by-step guide to initiate the training process using your custom settings:
Here is a complete example script based on your provided details: import torch
from ultralytics import YOLO
import yaml
# Clear GPU memory
torch.cuda.empty_cache()
# Check if GPU is available
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print(f'Using device: {device}')
# Read data.yaml file
with open('C:/Users/user/yolov8_dataset/data.yaml', 'r') as file:
data_config = yaml.safe_load(file)
# Dataset paths and hyperparameters
train_path = data_config['train']
val_path = data_config['val']
batch_size = 1 # Reduce batch size if needed
epochs = 1000
img_size = 256 # Reduce image size if needed
# Initialize the model with custom YAML
model = YOLO('C:/Users/user/yolov10-new.yaml')
# Move model to GPU
model.model.to(device)
# Train the model
model.train(data='C:/Users/user/yolov8_dataset/data.yaml', epochs=epochs, batch_size=batch_size, imgsz=img_size, device=device, verbose=True) Additional Tips and Best Practices
For more detailed information and additional resources, please refer to the Ultralytics HUB documentation. If you encounter any issues or have further questions, feel free to raise them here or join our Discord community for more interactive discussions. |
Search before asking
Question
Dear
I hope this message finds you well.
I am writing to inquire about the process of training a YOLOv10 model using a custom YAML file that I have created. I would appreciate it if you could provide me with detailed instructions or guidelines on how to properly configure and initiate the training process with my custom settings.
Specifically, I would like to understand the following:
The necessary steps to integrate my YAML file with YOLOv10.
Any prerequisites or dependencies required before starting the training.
Example commands or scripts that could help in launching the training process.
Any additional tips or best practices for optimizing the training process using a custom configuration.
Your assistance in this matter would be greatly appreciated as it will help streamline my workflow and ensure that the training process is conducted efficiently.
Thank you in advance for your support and guidance. I look forward to your response.
Best regards,
Parameters
nc: 1 # number of classes, 실제 클래스 수로 변경
scales: # model compound scaling constants
x: [0.33, 0.50, 256] # [depth, width, max_channels]
YOLOv8.0n backbone
backbone:
YOLOv8.0n head
head:
[-1, 1, nn.Upsample, [None, 2, "nearest"]]
[[-1, 6], 1, Concat, [1]]
[-1, 2, C2fCIB, [512, True]] # 512
[-1, 1, C3TR, [512, 8, 4, 512]]
[-1, 1, nn.Upsample, [None, 2, "nearest"]]
[[-1, 4], 1, Concat, [1]]
[-1, 2, C2fCIB, [256, True]] # 256
[-1, 1, C3TR, [256, 8, 4, 256]]
[-1, 1, Conv, [256, 3, 2]]
[[-1, 13], 1, Concat, [1]]
[-1, 2, C2fCIB, [512, True]] # 512
[-1, 1, C3TR, [512, 8, 4, 512]]
[-1, 1, SCDown, [512, 3, 2]]
[[-1, 10], 1, Concat, [1]]
[-1, 3, C2fCIB, [1024, True]] # 1024
[-1, 1, C3TR, [1024, 8, 4, 1024]]
[[16, 19, 22], 1, v10Detect, [nc]]
import torch
from ultralytics import YOLO
import yaml
GPU 메모리 초기화
torch.cuda.empty_cache()
GPU 사용 여부 확인
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print(f'Using device: {device}')
data.yaml 파일 읽기
with open('C:/Users/user/yolov8_dataset/data.yaml', 'r') as file:
data_config = yaml.safe_load(file)
데이터셋 경로 및 하이퍼파라미터 설정
train_path = data_config['train']
val_path = data_config['val']
batch_size = 1 # 배치 크기 더 줄이기
epochs = 1000
img_size = 256 # 이미지 크기 줄이기
모델 초기화
model = YOLO('C:/Users/user/yolov10-new.yaml')
모델을 GPU로 이동
model.model.to(device)
모델 훈련
model.train(data='C:/Users/user/yolov8_dataset/data.yaml', epochs=epochs, batch_size=batch_size, imgsz=img_size, device=device, verbose=True)
Additional
No response
The text was updated successfully, but these errors were encountered: