Ultralytics YOLO 종합 튜토리얼
Ultralytics YOLO 가이드는 학습과 예측부터 배포까지 비전 AI 프로젝트의 모든 단계를 다룹니다. PyTorch를 기반으로 구축된 YOLO는 속도와 정확도를 결합해 실시간 객체 감지 및 기타 비전 작업을 수행합니다.
딥러닝 초보자부터 전문가까지, 이 튜토리얼은 컴퓨터 비전 프로젝트에 YOLO를 구현하고 최적화하는 실용적인 지침을 제공합니다.
시청: Ultralytics YOLO26 가이드 개요
가이드#
가이드는 환경 설정과 데이터 준비부터 학습, 평가, 배포까지 프로젝트 단계별로 그룹화되어 있어, 현재 진행 중인 단계로 바로 이동할 수 있습니다.
시작하기 및 계획 수립#
- Conda 빠른 시작: Ultralytics용 Conda 환경을 설정하는 단계별 가이드입니다. Conda를 사용해 Ultralytics 패키지를 효율적으로 설치하고 사용하는 방법을 알아보세요.
- Docker 빠른 시작: Docker를 사용해 Ultralytics YOLO 모델을 설정하고 사용하는 완벽한 가이드입니다. Docker 설치, GPU 지원 관리, 일관된 개발 및 배포를 위해 격리된 컨테이너에서 YOLO 모델을 실행하는 방법을 알아보세요.
- 컴퓨터 비전 프로젝트 목표 정의하기: 컴퓨터 비전 프로젝트의 명확하고 측정 가능한 목표를 효과적으로 정의하는 방법을 살펴봅니다. 잘 정의된 문제 진술의 중요성과 이것이 프로젝트 로드맵을 만드는 방법을 알아보세요.
- 컴퓨터 비전 프로젝트 단계: 목표 정의, 모델 선택, 데이터 준비, 결과 평가를 비롯해 컴퓨터 비전 프로젝트에 필요한 주요 단계를 알아보세요.
- YOLO 아키텍처 설명: 백본, 넥, 탐지 헤드 전반에서 YOLOv3부터 YOLO26까지 YOLO 아키텍처가 발전한 과정을 살펴보고, C2f, C3k2, C2PSA 어텐션, 앵커 프리 및 NMS 프리 설계를 다룹니다.
데이터 준비#
- 데이터 수집 및 어노테이션: 컴퓨터 비전 모델에 사용할 고품질 입력 데이터를 만들기 위한 데이터 수집 및 어노테이션 도구, 기법, 모범 사례를 살펴보세요.
- 어노테이션된 데이터 전처리: 이미지 크기 조정, 정규화, 데이터셋 분할, 데이터 증강, 탐색적 데이터 분석(EDA)을 포함해 YOLO26을 사용하는 컴퓨터 비전 데이터 전처리를 알아보세요.
- YOLO 데이터 증강: 기본 변환부터 모델의 견고성과 성능을 향상하는 고급 전략까지, YOLO의 다양한 데이터 증강 기법을 살펴보세요.
- COCO에서 YOLO로 변환: 학습을 위해 COCO JSON 어노테이션을 YOLO 형식으로 변환하는 완벽한 가이드입니다. 클래스 ID 매핑과 일반적인 변환 오류를 비롯해 탐지, 세그멘테이션, 키포인트를 다룹니다.
- COCO JSON 학습: 사용자 정의 데이터셋 클래스와 트레이너를 사용해 COCO JSON 어노테이션을 YOLO 형식으로 변환하지 않고 YOLO를 직접 학습시키세요.
학습 및 파인튜닝#
- 고해상도 타일링: 모든 비전 작업에서 고정 타일링을 적용해 고해상도 이미지로 학습, 검증 및 예측을 수행합니다.
- 모델 학습 팁: 배치 크기 최적화, 혼합 정밀도 사용, 사전 학습 가중치 적용 등을 통해 컴퓨터 비전 모델을 더 효과적으로 학습하는 방법을 살펴보세요.
- 사용자 데이터로 YOLO26 파인튜닝: 사전 학습 가중치를 사용해 사용자 정의 데이터셋으로 YOLO26을 파인튜닝하는 완벽한 가이드입니다. 전이 학습, 레이어 동결, 옵티마이저 선택, 2단계 학습, 문제 해결을 다룹니다.
- YOLO26 학습 레시피: COCO에서 공식 YOLO26 기본 체크포인트를 학습하는 데 사용되는 하이퍼파라미터, 증강 파이프라인, 옵티마이저 설정을 자세히 설명하고 실용적인 파인튜닝 지침을 제공합니다.
- 하이퍼파라미터 튜닝: Tuner 클래스와 유전 알고리즘을 사용해 하이퍼파라미터를 파인튜닝하고 YOLO 모델을 최적화하는 방법을 알아보세요.
- 지식 증류: 특징 기반 증류를 사용해 더 큰 교사 모델의 지식을 더 작은 학생 모델로 전달하여 모델 성능을 개선하는 방법을 알아보세요.
- K-겹 교차 검증: K-겹 교차 검증 기법을 사용해 모델 일반화 성능을 향상하는 방법을 알아보세요.
- 트레이너 사용자 지정: YOLO 트레이너를 서브클래싱하여 사용자 정의 메트릭을 기록하고, 클래스 가중치 손실을 추가하고, 모델 저장 방식을 사용자 지정하고, 백본을 동결하거나 동결 해제하고, 레이어별 학습률을 설정하는 방법을 알아보세요.
- 모델 YAML 구성 가이드: Ultralytics 모델 아키텍처 정의를 자세히 살펴봅니다. YAML 형식을 탐색하고, 모듈 해석 시스템을 이해하며, 사용자 지정 모듈을 통합하는 방법을 알아보세요.
평가 및 문제 해결#
- YOLO 성능 메트릭 ⭐ 필수: YOLO 모델 성능 평가에 사용되는 mAP, IoU, F1 점수와 같은 주요 메트릭을 알아보세요. 탐지 정확도와 속도를 개선하는 방법에 대한 실용적인 예제와 팁도 포함되어 있습니다.
- 모델 평가 및 파인튜닝 인사이트: mAP 및 IoU와 같은 메트릭으로 컴퓨터 비전 모델을 평가한 다음, 메트릭에서 드러난 내용을 바탕으로 탐지 정확도를 개선하세요.
- 모델 테스트: 배포 전에 미학습 데이터로 컴퓨터 비전 모델을 테스트하고, YOLO26 모델을 검증하고, 과적합, 과소적합, 데이터 누수를 발견하는 방법을 알아보세요.
- YOLO의 일반적인 문제 ⭐ 권장: Ultralytics YOLO 모델 사용 중 자주 발생하는 문제에 대한 실용적인 해결책과 문제 해결 팁을 제공합니다.
- 컴퓨터 비전 모델 유지 관리: 정확도를 유지하고 이상 징후를 찾아내며 데이터 드리프트를 완화하기 위해 컴퓨터 비전 모델을 모니터링, 유지 관리, 문서화하는 주요 실무 방법을 알아보세요.
배포 및 서빙#
- 모델 배포 옵션: ONNX, OpenVINO, TensorRT와 같은 YOLO 모델 배포 형식을 개괄하고, 배포 전략 수립에 도움이 되도록 각 형식의 장단점을 설명합니다.
- 모델 배포 모범 사례: 최적화, 문제 해결, 보안에 중점을 두고 컴퓨터 비전 프로젝트에서 모델을 효율적으로 배포하기 위한 팁과 모범 사례를 살펴봅니다.
- 비-YOLO 모델 내보내기: Ultralytics 독립형 내보내기 유틸리티를 사용해 모든
torch.nn.Module(timm, torchvision, 사용자 정의)을 TorchScript, ONNX, OpenVINO, CoreML, Core AI, TensorFlow SavedModel, PaddlePaddle, MNN, NCNN, ExecuTorch로 변환하세요. - 엔드투엔드 탐지: NMS 또는 NMS 프리 추론을 선택하고 출력 형식과 내보내기 호환성을 이해하세요.
- YOLO 스레드 안전 추론: 스레드 안전성을 유지하면서 YOLO 모델로 추론을 수행하는 지침입니다. 스레드 안전성의 중요성과 경쟁 조건을 방지하고 일관된 예측을 보장하는 모범 사례를 알아보세요.
- OpenVINO 지연 시간 및 처리량 모드: YOLO 추론 성능을 극대화하기 위한 지연 시간 및 처리량 최적화 기법을 알아보세요.
- 세그멘테이션 객체 분리: Ultralytics 세그멘테이션 모델로 이미지에서 객체를 추출하고 분리하는 단계별 레시피입니다.
- 터미널에서 추론 이미지 보기: Remote Tunnel 또는 SSH 세션을 사용할 때 VS Code 통합 터미널에서 추론 결과를 확인하세요.
NVIDIA Jetson, Raspberry Pi, NVIDIA Triton, Google Vertex AI와 같은 특정 하드웨어, 서빙 스택 및 클라우드 플랫폼 관련 가이드는 Integrations에 나와 있습니다.
가이드에 기여하기#
커뮤니티의 기여를 환영합니다! 아직 가이드에서 다루지 않은 Ultralytics YOLO의 특정 분야에 능숙하시다면 전문 지식을 공유해 주세요. 가이드를 작성하면 커뮤니티에 기여하고 문서를 더욱 포괄적이고 사용하기 쉽게 만드는 데 도움이 됩니다.
시작하려면 기여 가이드를 읽고 Pull Request(PR)를 여는 방법에 관한 지침을 확인해 주세요. 새 가이드를 추가할 때는 위에서 프로젝트 단계에 맞는 카테고리를 선택하고, 단계별 튜토리얼, 작업 중심 사용법 안내, 레퍼런스 중 한 가지 유형으로 작성해 주세요. 이렇게 하면 가이드 모음이 늘어나도 쉽게 탐색할 수 있습니다. 여러분의 기여를 기다리겠습니다.
자주 묻는 질문#
Ultralytics YOLO로 사용자 지정 객체 감지 모델을 간편하게 학습할 수 있습니다. 먼저 데이터셋을 올바른 형식으로 준비하고 Ultralytics 패키지를 설치합니다. 다음 코드를 사용해 학습을 시작하세요.
예제from ultralytics import YOLO model = YOLO("yolo26n.pt") # 사전 학습된 YOLO 모델 로드 model.train(data="path/to/dataset.yaml", epochs=50) # 사용자 정의 데이터셋으로 학습YOLO 모델 성능을 평가하는 것은 모델의 효과를 이해하는 데 매우 중요합니다. 주요 메트릭에는 평균 정밀도(mAP), 교집합 대비 합집합(IoU), F1 점수가 포함됩니다. 이러한 메트릭은 객체 탐지 작업의 정확도와 정밀도를 평가하는 데 도움이 됩니다. 이러한 메트릭과 모델 개선 방법에 관한 자세한 내용은 YOLO 성능 메트릭 가이드에서 확인할 수 있습니다.
Ultralytics Platform은 데이터셋 어노테이션, 실험 추적, 클라우드 학습, 내보내기, YOLO 모델 전용 추론 엔드포인트를 제공하는 엔드투엔드 노코드 작업 공간으로, 초보자와 전문가 모두에게 적합합니다.
YOLO 모델 학습 중 흔히 발생하는 문제에는 데이터 형식 오류, 모델 아키텍처 불일치, 학습 데이터 부족 등이 있습니다. 이러한 문제를 해결하려면 데이터셋 형식이 올바른지 확인하고, 호환되는 모델 버전을 점검하고, 학습 데이터를 증강하세요. 해결 방법 전체 목록은 YOLO의 일반적인 문제 가이드를 참조하세요.
NVIDIA Jetson 및 Raspberry Pi와 같은 엣지 디바이스에 YOLO 모델을 배포하려면 모델을 TensorRT 또는 LiteRT와 같은 호환 형식으로 변환해야 합니다. 엣지 하드웨어에서 실시간 객체 감지를 시작하려면 NVIDIA Jetson 및 Raspberry Pi 배포 단계별 가이드를 참조하세요. 이 가이드에서는 설치, 구성, 성능 최적화를 다룹니다.
댓글30
질문을 하거나 결과를 공유하거나 다른 사람을 도와주세요.
safdarhamid64-cpu
i have done everything using your docker method everything , using AI chatbots , but still i am unable to run the yolo , plzz provide me a solution that will work for every Raspberry Pi4 because its really so much frustrating
tutorialsyolo
Hi, I am trying to improve the convolutional layers in the nn module like in conv.py or block.py as novelty for my research. The location is like "ultralytics/ultralytics/nn/modules/conv.py. Could you please tell me where else i should update/call the new block which I improved? Because it gives me error when I am adding those blocks in the cfg/.yaml files for training in a custom dataset. Thank you
Ishfaz
Hello,
I'm using YOLOv8 for object detection, and I have only three classes in my dataset. However, when I generate the confusion matrix after training or validation, I notice that it shows a 4x4 matrix instead of the expected 3x3.
It seems like an extra class, possibly a "background" or "null" class, is being added automatically.
How can I remove this extra background class so that my confusion matrix only reflects the three actual classes I have trained on?
AashishThakur1321
can you tell the path, where downloaded model weights are stored as i manually want to add the weights to the folder as i don't have internet access on server
Glenn JocherUltralytics@AashishThakur1321 the default location where Ultralytics models are stored depends on your operating system, but it's typically within a directory in your user's home folder; you can find more specific details by checking the "Settings" section when you run
from ultralytics import settings; print(settings).1
ghost
Hello, I am working on a project to detect different types of cells. I already have a trained model, thanks to Ultralytics! I want to increase my dataset and tried using the auto-annotate function. The function works well but annotates objects in polygons. I need annotation in rectangular bounding boxes. Can you please help with this problem? https://docs.ultralytics.com/reference/data/annotator/
Glenn JocherUltralytics@kartmyco thank you for your message! While the auto-annotate function currently outputs polygon annotations, you can convert them to rectangular bounding boxes using tools like
cvatorlabelme, or you can write a custom script to approximate polygons into rectangular boxes. For details on data annotation tools, you can refer to our guide on data collection and annotation. Let us know if you have additional questions!ghost
Hello Glenn, Thank you so much for your reply. I will try to approximate the polygons in rectangular bounding boxes.
jdonza
I decided to make a different thread here as it is related to a different topic. But I wanted to know if you guys had documentation that went into the specifics of how the YOLO models are created. I am interested to learn more about CNN's, how they work, and how it relates to the image processing of YOLO.
Glenn JocherUltralytics@jdonza for detailed information on how YOLO models are created and how CNNs work in relation to YOLO, please refer to our comprehensive guides at https://docs.ultralytics.com/guides/. These resources cover various aspects of YOLO, including its architecture and image processing techniques.
jdonza
Hello,
Are there any tutorials showing how to train a YOLOv8 model using multiple devices for faster training? I read the instructions for YOLOv5 but got a bit lost. Step by step instructions would be greatly appreciated!
Thank you!
Glenn JocherUltralytics@jdonza hello,
For training YOLOv8 using multiple devices, please refer to our Multi-GPU Training guide. It provides step-by-step instructions to help you set up and run training across multiple GPUs.
Thank you!
jdonza
Thank you for the response! What I am still confused with is the following line of code.
results = model.train(data="coco8.yaml", epochs=100, imgsz=640, device=[0, 1])Here are a few questions I had.
- I have one GPU on my computer currently. If I had another device that also had the same GPU, how does YOLO know which computer is 0 and which is 1? Is there a physical connection of some sort that needs to occur?
- If you had a computer with multiple GPU's, the same questions arises. How does YOLO know which is 0 and which is 1?
Overall, I am confused with the set-up steps that need to occur before simply inputting "device=[0,1]".
Sorry if my questions appear trivial. I am a beginner and do not have much experience with network configurations like this!
Thanks!
Glenn JocherUltralytics@jdonza to address your questions:
- YOLOv8 does not support multi-device training across different computers. Each device ID (e.g., 0, 1) refers to GPUs within the same machine.
- For a computer with multiple GPUs, device IDs are assigned based on the order in which GPUs are detected by the system. You can verify GPU IDs using
nvidia-smi.
For more details, please refer to the Multi-GPU Training guide.
jdonza
Was this capability eliminated? The link you provided has a drop-down section labeled "Use Multiple Machines" which appears to provide some sort of framework to accomplish this.
Glenn JocherUltralytics@jdonza the capability for multi-machine training is not supported in YOLOv8. The "Use Multiple Machines" section in the documentation you referenced may pertain to older versions or different contexts. For multi-GPU training on a single machine, you can use the
device=[0,1]argument. If you have further questions, please refer to the Multi-GPU Training guide.jdonza
Okay thank you!
Glenn JocherUltralytics@jdonza you're welcome! For training YOLOv8 on multiple GPUs within a single machine, you can use the
device=[0,1]argument. Each GPU is identified by its ID, which you can check usingnvidia-smi. Multi-machine training is not supported. For more details, please refer to the Multi-GPU Training guide.Ephraim-Bryski
While not supported in YOLOv8, I did see reference to training across multiple computers in the YOLOv5 documentation:
(I believe this is what jdonza was referring to before). Does this allow for training across multiple computers for YOLOv5, but is no longer supported in YOLOv8? If so, would using YOLOv5 instead of v8 be recommended for this use case? Thanks!
Glenn JocherUltralyticsTraining across multiple computers is supported in YOLOv5 using DistributedDataParallel, but this feature is not available in YOLOv8. If multi-machine training is essential for your use case, using YOLOv5 would be recommended. For more details, please refer to the YOLOv5 documentation.
TanWeeKang
hi, i am doing a project about food detection. the detection results were great. however, there are some overlapping bboxes for some categories of food. some input images will have this category and some will have others. how can i apply nms to retrieve only the highest conf score of the detection and remove overlapping bboxes? i run inference on my best.pt model by giving it input images
Glenn JocherUltralytics(수정됨)Hi there! It's great to hear that your food detection project is yielding excellent results! 🎉
To address the issue of overlapping bounding boxes, you can apply Non-Maximum Suppression (NMS) to retain only the highest confidence score detections and remove the overlapping ones. YOLO models typically handle NMS internally, but you can customize the NMS settings during inference to better suit your needs.
Here's how you can do it:
Using Python
If you're running inference in a Python environment, you can set the
conf(confidence threshold) andiou(IoU threshold for NMS) parameters when calling thepredictmethod. Here's an example:from ultralytics import YOLO # Load your custom-trained model model = YOLO('path/to/best.pt') # Run inference with custom NMS settings results = model.predict(source='path/to/your/image.jpg', conf=0.25, iou=0.45) # Display results results[0].show()Using CLI
If you're using the command line interface, you can specify these parameters directly in your command:
yolo predict model=path/to/best.pt source='path/to/your/image.jpg' conf=0.25 iou=0.45Explanation
conf: This sets the minimum confidence threshold for detections. Detections with a confidence score below this value will be discarded.iou: This sets the IoU threshold for NMS. Detections with an IoU greater than this value will be considered overlapping, and only the one with the highest confidence score will be kept.
For more detailed information on inference and NMS settings, you can refer to the YOLO Predict Documentation.
If you encounter any issues or need further assistance, please ensure you're using the latest versions of
torchandultralytics. If the problem persists, providing a minimum reproducible example would be very helpful. You can find guidelines on creating one here: Minimum Reproducible Example.Happy coding, and best of luck with your project! 🚀
TanWeeKang
because the goal for now is to remove overlapping, if i set the iou threshold on the high side, the image doesnt differ much from the original detected image, where there are many overlappings. if i set to a low iou threshold, more overlappings will be removed.
TanWeeKang
another thing is that for my food detection i have 5 classes/categories of food. under these 5 categories i have variety of food for each category, but i label and train the model on these 5 classes, for simplicity sake i did not go into detail about what kind of food is that, lets say meat we have fish, pork etc. the model see either of those and classify as meat. although they are from same classes, they might have different prices. now how can i use segmentation( maybe from opencv) to distinguish the image i used to run inference on my best.pt model to identify the difference in meat like fish, pork to have different prices?
Glenn JocherUltralytics(수정됨)Hi there! Thanks for reaching out and providing detailed feedback on your experience with overlapping bounding boxes in your food detection project. It's fantastic to hear that your detection results are generally great! 🎉
To address the issue of overlapping bounding boxes, adjusting the IoU threshold is indeed a key factor. Here’s a more refined approach to help you achieve the best balance:
Fine-Tuning IoU Threshold
- High IoU Threshold: Retains more overlapping boxes, which might be useful if you want to ensure that no potential detections are missed.
- Low IoU Threshold: Removes more overlapping boxes, which can help in reducing redundancy but might risk missing some detections.
Practical Steps
- Experiment with Intermediate Values: Instead of setting the IoU threshold to extremes, try intermediate values (e.g., 0.3, 0.4, 0.5) to find a sweet spot that minimizes overlaps without losing important detections.
- Confidence Threshold: Adjust the confidence threshold (
conf) to filter out low-confidence detections, which can also help in reducing overlaps.
Example Code
Here’s how you can apply these settings in Python:
from ultralytics import YOLO # Load your custom-trained model model = YOLO('path/to/best.pt') # Run inference with custom NMS settings results = model.predict(source='path/to/your/image.jpg', conf=0.25, iou=0.45) # Display results results[0].show()And using the CLI:
yolo predict model=path/to/best.pt source='path/to/your/image.jpg' conf=0.25 iou=0.45Additional Resources
For more detailed guidance on optimizing your model and handling common issues, you might find the following guides helpful:
If you continue to experience issues, please ensure you are using the latest versions of
torchandultralytics. If the problem persists, providing a minimum reproducible example would be very helpful. You can find guidelines on creating one here: Minimum Reproducible Example.Feel free to reach out if you have any more questions or need further assistance. Happy coding! 🚀
TanWeeKang
another thing is that for my food detection i have 5 classes/categories of food. under these 5 categories i have variety of food for each category, but i label and train the model on these 5 classes, for simplicity sake i did not go into detail about what kind of food is that, lets say meat we have fish, pork etc. the model see either of those and classify as meat. although they are from same classes, they might have different prices. now how can i use segmentation( maybe from opencv) to distinguish the image i used to run inference on my best.pt model to identify the difference in meat like fish, pork to have different prices?
Glenn JocherUltralyticsHi there! It's fantastic to hear about your progress with food detection using YOLO. 😊
To distinguish between different types of food within the same category (like fish and pork under "meat"), you can leverage segmentation techniques. Here's a step-by-step approach to achieve this:
1. Segmentation with OpenCV
You can use OpenCV to perform image segmentation, which will help you isolate different types of food within the same category. Here's a basic example of how you might use OpenCV for segmentation:
import cv2 import numpy as np # Load the image image = cv2.imread('path/to/your/image.jpg') # Convert to grayscale gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # Apply GaussianBlur to reduce noise and improve contour detection blurred = cv2.GaussianBlur(gray, (5, 5), 0) # Use Canny edge detection edges = cv2.Canny(blurred, 50, 150) # Find contours contours, _ = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) # Draw contours on the original image cv2.drawContours(image, contours, -1, (0, 255, 0), 2) # Display the result cv2.imshow('Segmented Image', image) cv2.waitKey(0) cv2.destroyAllWindows()2. Combining YOLO Detection with Segmentation
You can combine the bounding boxes from your YOLO model with segmentation to further classify the detected objects. Here’s a conceptual approach:
- Run YOLO Inference: Use your trained YOLO model to detect the general categories (e.g., meat).
- Apply Segmentation: Within each detected bounding box, apply segmentation to isolate different types of food.
- Classify Segmented Regions: Use additional classification models or heuristics to distinguish between types like fish and pork.
3. Advanced Segmentation Techniques
For more precise segmentation, consider using advanced models like Mask R-CNN or leveraging pre-trained segmentation models available in frameworks like PyTorch or TensorFlow.
Example with YOLO and Segmentation
Here’s a more integrated example combining YOLO detection with OpenCV segmentation:
from ultralytics import YOLO import cv2 # Load your custom-trained YOLO model model = YOLO('path/to/best.pt') # Run inference results = model.predict(source='path/to/your/image.jpg', conf=0.25, iou=0.45) # Process each detected bounding box for result in results: for box in result.boxes: x1, y1, x2, y2 = map(int, box.xyxy[0]) cropped_img = result.orig_img[y1:y2, x1:x2] # Convert to grayscale and apply segmentation gray = cv2.cvtColor(cropped_img, cv2.COLOR_BGR2GRAY) blurred = cv2.GaussianBlur(gray, (5, 5), 0) edges = cv2.Canny(blurred, 50, 150) contours, _ = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) cv2.drawContours(cropped_img, contours, -1, (0, 255, 0), 2) # Display the segmented image cv2.imshow('Segmented Image', cropped_img) cv2.waitKey(0) cv2.destroyAllWindows()Further Reading
For more detailed guides and advanced techniques, you might find these resources helpful:
Feel free to experiment with these techniques and adjust the parameters to better suit your specific use case. If you have any more questions or need further assistance, don't hesitate to ask. Happy coding! 🚀
thisisqiuqiuqiu
Thank you very much for your letter. Your reply is very helpful to my experimental training. I understand how to set up the basic model training. I wish you all success in your future work.
------------------ 原始邮件 ------------------ 发件人: "ultralytics/ultralytics" @.>; 发送时间: 2024年5月20日(星期一) 中午12:11 @.>; @.@.>; 主题: Re: [ultralytics/ultralytics] zh/guides/ (Discussion #12787)
Hello! The number of epochs needed for training the YOLOv8 base model can vary depending on your specific dataset and the complexity of the task. While 500 epochs might be necessary for some scenarios to achieve optimal results, it's not a strict requirement for all cases.
A good practice is to monitor the training process for signs of convergence, such as stable validation loss and accuracy metrics. You can start with fewer epochs, like 100 or 200, and evaluate the model's performance. If the results are not satisfactory, you can continue training for more epochs or consider adjusting other hyperparameters.
Here's a simple example to start training with a specified number of epochs: yolo train data=coco128.yaml model=yolov8n.pt epochs=100
Adjust the epochs value as needed based on your observations. Happy training! 😊
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
thisisqiuqiuqiu
I would like to ask, does the yolov8 base model need to be trained to 500 epochs?
Glenn JocherUltralytics(수정됨)Hello! The number of epochs needed for training the YOLO base model can vary depending on your specific dataset and the complexity of the task. While 500 epochs might be necessary for some scenarios to achieve optimal results, it's not a strict requirement for all cases.
A good practice is to monitor the training process for signs of convergence, such as stable validation loss and accuracy metrics. You can start with fewer epochs, like 100 or 200, and evaluate the model's performance. If the results are not satisfactory, you can continue training for more epochs or consider adjusting other hyperparameters.
Here's a simple example to start training with a specified number of epochs:
yolo train data=coco128.yaml model=yolo26n.pt epochs=100Adjust the
epochsvalue as needed based on your observations. Happy training! 😊