C.W.K.
Stream
Lesson 03 of 06 · published

Object detection — YOLOv8

~8 min · keras-cv

Level 0Keras 도제
0 XP0/97 lessons0/20 achievements
0/120 XP to next level120 XP to go0% complete

Detection = box + label, label 만 아냐

classification 은 '이 이미지에 뭐가 있냐' 에 답해. detection 은 '뭐가 있고, *어디에* 있냐' 에 답해 — 찾은 객체마다 bounding box + class 를 반환, 한 frame 에 수십 개일 수도. 더 어려운 문제고, 옛날엔 TensorFlow Object Detection API 나 서드파티 YOLO repo 랑 씨름하는 일이었어. KerasCV 는 이걸 네가 이미 아는 from_preset 관용구 안에 접어 넣었어.

여기 일꾼은 YOLOV8 — single-stage real-time detector 로 production detection 의 기본값이 됐어. model = YOLOV8Detector.from_preset('yolo_v8_xs_pascalvoc') 한 줄로 사전학습 weight 로드, predict 하면 box / class ID / confidence 의 dict 반환. Non-max suppression (같은 객체의 겹친 box 합치기) 은 자동.

size 고르기

YOLOV8 은 5 size — xs (제일 빠름) / s / m / l / xl (제일 정확) — 앞 lesson backbone 이랑 똑같은 latency/accuracy 다이얼. 변변찮은 하드웨어의 real-time video 면 xs/s, offline batch 정확도면 l/xl. 자기 class 로 fine-tune 하려면 backbone freeze 하고 detection head 만 학습 — 그게 다음 lesson 의 pipeline.

Code

YOLOV8 로드 + detection inference·python
# Load YOLOV8 with COCO pretrained weights
detector = keras_cv.models.YOLOV8Detector.from_preset(
    "yolo_v8_m_coco",  # xs, s, m, l, xl sizes
)

# Run inference
predictions = detector.predict(images)
# predictions["boxes"] → bounding box coordinates
# predictions["classes"] → class IDs
# predictions["confidence"] → confidence scores

External links

Exercise

PASCAL VOC pretrained YOLOv8s 로드. test image 5 개 predict 하고 box (class + confidence 같이) 를 matplotlib 또는 keras_cv.visualization.plot_bounding_box_gallery 로 그려. 그 다음 confidence threshold 를 일부러 낮춰서 false positive 가 튀어나오는 걸 봐 — false positive 1 개, missed detection 1 개 메모하고 각각 왜 그랬는지 추론 (가림? 특이한 scale? VOC 의 20 class 에 없는 객체?).
Hint
VOC 는 class 가 20 개뿐 — 'missed' detection 은 그냥 label set 에 없는 객체인 경우 많아. confidence threshold 가 precision/recall 트레이드오프의 제일 큰 레버 — 딴 거 손대기 전에 이것부터 sweep.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.