[YOLO] Model Training 모델 훈련
AI, ML, DL 2026. 2. 9. 22:59 |반응형
학습 데이터를 준비하고 YOLO 모델을 트레이닝해 보자.

학습할 안드로이드 인형 사진을 준비하고 Roboflow 에서 라벨링 및 데이터셋 준비 작업을 진행한다.

My First Project.v1-roboflow-instant-1--eval-.yolo26.zip
3.74MB
Roboflow에서 준비한 데이터셋
준비된 데이터셋을 프로젝트 폴더에 넣고 학습을 진행한다.
from ultralytics import YOLO
model = YOLO("yolo26n.pt")
results = model.train(data="data.yaml", epochs=100, imgsz=640)
yolo26n.pt 모델이 프로젝트에 없는 경우 자동으로 다운로드한다.
epochs를 10 정도로 하면 거의 학습이 되지 않는다. 진행은 되지만 검증 결과를 확인해 보면 아무것도 검출하지 못한다.

학습이 완료되었으면 run 폴더에서 검증 결과를 확인해 보자.

from ultralytics import YOLO
model = YOLO("best.pt")
results = model("IMG_1.jpg")
for result in results:
boxes = result.boxes # Boxes object for bounding box outputs
masks = result.masks # Masks object for segmentation masks outputs
keypoints = result.keypoints # Keypoints object for pose outputs
probs = result.probs # Probs object for classification outputs
obb = result.obb # Oriented boxes object for OBB outputs
result.show() # display to screen
result.save(filename="result.jpg") # save to disk
학습 결과로 생성된 'best.pt' 모델을 이용하여 IMG_1.jpg 파일을 테스트해 보자.


정확하게 android와 android-red를 검출했다.
반응형
'AI, ML, DL' 카테고리의 다른 글
| [YOLO] Instance Segmentation 객체 분할 (0) | 2026.02.10 |
|---|---|
| [YOLO] Multi-Object Tracking 물체 추적 (0) | 2026.02.10 |
| [YOLO] with OpenCV (0) | 2026.02.08 |
| [YOLO] YOLO models to ONNX 파일 변환 (0) | 2026.02.08 |
| [YOLO] Pose Estimation 포즈 추정 (0) | 2026.02.07 |
