Open jamesparkskku opened 4 months ago
👋 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:
Ensure you have the latest version of Ultralytics packages: Before proceeding, please verify that you are using the latest versions of the Ultralytics packages. You can update them using pip:
pip install --upgrade ultralytics
Dependencies: Make sure you have the necessary dependencies installed, including PyTorch and any other required libraries.
Custom YAML File: Ensure your custom YAML file is correctly formatted and includes all necessary configurations. Your provided YAML file looks good for defining the model architecture.
Data Configuration: Ensure your data.yaml
file is correctly set up with paths to your training and validation datasets.
Here is a step-by-step guide to initiate the training process using your custom settings:
YOLO
class from the Ultralytics library to initialize your model with the custom YAML file.train
method to start the training process with your specified parameters.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)
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.
👋 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 ⭐
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