You Solely Look As soon as คือ Realtime Object Detection Mannequin
หลักการคือ ถ้ามีบอลอยู่ด้านหลังแบบในภาพ มันก็จะพยายาม rectangle object เหล่านั้นไว้ (โดยหาจุดกึ่งกลางของแต่ละ object แล้วค่อยครอบ field เอาไว้) และบอกออกมาว่าสิ่งนั้นคืออะไร
- Set up YOLOv10 ขั้นตอนการติดตั้ง yolo
!pip set up -q git+https://github.com/THU-MIG/yolov10.git
2. ติดตั้ง supervision และ roboflow เพื่อเรียกใช้ Customized Dataset
!pip set up -q supervision roboflow
3. Obtain pre-trained weights ของ YOLOv10 ซึ่งมีทั้งหมด 6 ขนาด
!mkdir -p {HOME}/weights
!wget -P {HOME}/weights -q https://github.com/THU-MIG/yolov10/releases/obtain/v1.1/yolov10n.pt
!wget -P {HOME}/weights -q https://github.com/THU-MIG/yolov10/releases/obtain/v1.1/yolov10s.pt
!wget -P {HOME}/weights -q https://github.com/THU-MIG/yolov10/releases/obtain/v1.1/yolov10m.pt
!wget -P {HOME}/weights -q https://github.com/THU-MIG/yolov10/releases/obtain/v1.1/yolov10b.pt
!wget -P {HOME}/weights -q https://github.com/THU-MIG/yolov10/releases/obtain/v1.1/yolov10x.pt
!wget -P {HOME}/weights -q https://github.com/THU-MIG/yolov10/releases/obtain/v1.1/yolov10l.pt
!ls -lh {HOME}/weights
4. Obtain Customized dataset ของเราเอง ผ่านการ Making ready Dataset
!pip set up roboflowfrom roboflow import Roboflow
rf = Roboflow(api_key="uuQAzftTYhIEPvz3a8Z1")
mission = rf.workspace("worakan").mission("abu-dooaa")
model = mission.model(4)
dataset = model.obtain("yolov8")Obtain dataset from Roboflow Universe
5. เตรียม Information.yaml เพื่อใช้สำหรับ Prepare yolo
names:
- blue
- purple
nc: 2
roboflow:
license: CC BY 4.0
mission: preprocessed_blueball
url: https://universe.roboflow.com/worakan/preprocessed_blueball/dataset/1
model: 1
workspace: worakan
check: ../check/pictures
prepare: Preprocessed_blueBall-1/prepare/pictures
val: Preprocessed_blueBall-1/legitimate/pictures
6. Customized Coaching
!yolo process=detect mode=prepare epochs=100 batch=32 plots=True
mannequin={HOME}/weights/yolov10n.pt
information=/content material/ABU-4/information.yaml
เลือก Activity = detect เพราะ Yolo มีหลากหลาย Activity ( classify detect pose phase )
กำหนด epochs เพื่อระบุจำนวนครั้งที่ต้องการให้เรียนรู้
Epoch GPU_mem box_om cls_om dfl_om box_oo cls_oo dfl_oo Cases Measurement
98/100 6.17G 0.3384 0.2128 0.7736 0.3703 0.1648 0.771 44 640: 100% 13/13 [00:03<00:00, 4.21it/s]
Class Photographs Cases Field(P R mAP50 mAP50-95): 100% 2/2 [00:00<00:00, 4.63it/s]
all 79 727 0.983 0.98 0.992 0.941Epoch GPU_mem box_om cls_om dfl_om box_oo cls_oo dfl_oo Cases Measurement
99/100 6.15G 0.3428 0.2136 0.7766 0.375 0.1612 0.7717 46 640: 100% 13/13 [00:03<00:00, 4.21it/s]
Class Photographs Cases Field(P R mAP50 mAP50-95): 100% 2/2 [00:00<00:00, 4.64it/s]
all 79 727 0.975 0.989 0.992 0.942
Epoch GPU_mem box_om cls_om dfl_om box_oo cls_oo dfl_oo Cases Measurement
100/100 6.17G 0.3339 0.2117 0.7722 0.3645 0.1626 0.7699 43 640: 100% 13/13 [00:03<00:00, 4.26it/s]
Class Photographs Cases Field(P R mAP50 mAP50-95): 100% 2/2 [00:00<00:00, 4.36it/s]
all 79 727 0.982 0.984 0.992 0.941
100 epochs accomplished in 0.287 hours.
Optimizer stripped from runs/detect/train2/weights/final.pt, 5.8MB
Optimizer stripped from runs/detect/train2/weights/greatest.pt, 5.8MB
Validating runs/detect/train2/weights/greatest.pt...
Ultralytics YOLOv8.1.34 🚀 Python-3.10.12 torch-2.3.0+cu121 CUDA:0 (NVIDIA L4, 22700MiB)
YOLOv10n abstract (fused): 285 layers, 2695196 parameters, 0 gradients, 8.2 GFLOPs
Class Photographs Cases Field(P R mAP50 mAP50-95): 100% 2/2 [00:00<00:00, 4.07it/s]
all 79 727 0.976 0.988 0.992 0.942
purple 79 455 0.985 0.984 0.994 0.933
pink 79 272 0.966 0.993 0.99 0.951
Pace: 0.1ms preprocess, 1.9ms inference, 0.0ms loss, 0.0ms postprocess per picture
Outcomes saved to runs/detect/train2
💡 Be taught extra at https://docs.ultralytics.com/modes/prepare
เมื่อสิ้นสุดการ Prepare จะขึ้นแบบด้านบนเป็นการสรุปผลของชุด Prepare set และ Validation sat ที่เรานำให้โมเดลเรียนรู้
7. เราสามารถตรวจสอบ confusion_matrix หรือกราฟอื่นๆของผลการเรียนรู้ได้
from IPython.show import PicturePicture(filename=f'/content material/runs/detect/train2/confusion_matrix.png', width=600)