COCO8-Grayscale 데이터셋

소개#

Ultralytics COCO8-Grayscale 데이터셋은 간결한 객체 탐지 데이터셋으로, COCO train 2017 세트의 처음 8개 이미지를 그레이스케일 형식으로 변환한 이미지(학습용 4개, 검증용 4개)로 구성됩니다. 이 데이터셋은 YOLO 그레이스케일 모델과 학습 파이프라인을 빠르게 테스트하고 디버깅하며 실험하도록 특별히 설계되었습니다. 크기가 작아 관리하기 쉽고, 다양성이 있어 더 큰 데이터셋으로 확장하기 전에 효과적인 정상 작동 확인용으로 사용할 수 있습니다.



시청: 흑백 및 다중 스펙트럼 데이터셋으로 Ultralytics YOLO를 학습하는 방법 | 다중 채널 VisionAI 🚀

데이터셋 구조#

COCO8-Grayscale은 COCO8과 동일하게 COCO train 2017 세트의 첫 8개 이미지로 구성되며, 학습용 4장과 검증용 4장으로 나뉘고 80개의 COCO 클래스 이름으로 레이블링되어 있습니다. 다만 각 이미지는 YOLO 레이블 형식에 따라 단일 채널 channels: 1 그레이스케일 이미지로 저장됩니다:

coco8-grayscale/
├── images/
│   ├── train/   # 4 images
│   └── val/     # 4 images
└── labels/
    ├── train/
    └── val/

Ultralytics Platform에서 COCO8-Grayscale 살펴보기를 통해 어노테이션 오버레이가 포함된 각 이미지를 확인하고, Charts 탭에서 클래스 분포와 바운딩 박스 히트맵을 살펴보고, 데이터셋을 복제해 클라우드에서 자체 모델을 학습할 수 있습니다.

데이터셋 YAML#

COCO8-Grayscale 데이터셋 구성은 데이터셋 경로, 클래스 이름 및 기타 필수 메타데이터를 지정하는 YAML 파일에 정의되어 있습니다. 공식 coco8-grayscale.yaml 파일은 Ultralytics GitHub 저장소에서 확인할 수 있습니다.

참고

RGB 이미지를 그레이스케일로 학습하려면 데이터셋 YAML 파일에 channels: 1을 추가하세요. 이렇게 하면 학습 중 모든 이미지가 그레이스케일로 변환되므로 별도의 그레이스케일 데이터셋이 필요하지 않습니다.

ultralytics/cfg/datasets/coco8-grayscale.yaml
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

# COCO8-Grayscale dataset (first 8 images from COCO train2017) by Ultralytics
# Documentation: https://docs.ultralytics.com/datasets/detect/coco8-grayscale
# Example usage: yolo train data=coco8-grayscale.yaml
# parent
# ├── ultralytics
# └── datasets
#     └── coco8-grayscale ← downloads here (1 MB)

# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: coco8-grayscale # dataset root dir
train: images/train # train images (relative to 'path') 4 images
val: images/val # val images (relative to 'path') 4 images
test: # test images (optional)

channels: 1

# Classes
names:
  0: person
  1: bicycle
  2: car
  3: motorcycle
  4: airplane
  5: bus
  6: train
  7: truck
  8: boat
  9: traffic light
  10: fire hydrant
  11: stop sign
  12: parking meter
  13: bench
  14: bird
  15: cat
  16: dog
  17: horse
  18: sheep
  19: cow
  20: elephant
  21: bear
  22: zebra
  23: giraffe
  24: backpack
  25: umbrella
  26: handbag
  27: tie
  28: suitcase
  29: frisbee
  30: skis
  31: snowboard
  32: sports ball
  33: kite
  34: baseball bat
  35: baseball glove
  36: skateboard
  37: surfboard
  38: tennis racket
  39: bottle
  40: wine glass
  41: cup
  42: fork
  43: knife
  44: spoon
  45: bowl
  46: banana
  47: apple
  48: sandwich
  49: orange
  50: broccoli
  51: carrot
  52: hot dog
  53: pizza
  54: donut
  55: cake
  56: chair
  57: couch
  58: potted plant
  59: bed
  60: dining table
  61: toilet
  62: tv
  63: laptop
  64: mouse
  65: remote
  66: keyboard
  67: cell phone
  68: microwave
  69: oven
  70: toaster
  71: sink
  72: refrigerator
  73: book
  74: clock
  75: vase
  76: scissors
  77: teddy bear
  78: hair drier
  79: toothbrush

# Download script/URL (optional)
download: https://github.com/ultralytics/assets/releases/download/v0.0.0/coco8-grayscale.zip

사용법#

COCO8-Grayscale 데이터셋(1 MB)은 학습을 처음 시작할 때 자동으로 다운로드됩니다. 다음 예제를 사용하면 이미지 크기 640으로 COCO8-Grayscale에서 100 에포크 동안 YOLO26n 모델을 학습할 수 있습니다.

학습 예제
from ultralytics import YOLO

# 사전 학습된 YOLO26n 모델 로드
model = YOLO("yolo26n.pt")

# COCO8-Grayscale에서 모델 학습
results = model.train(data="coco8-grayscale.yaml", epochs=100, imgsz=640)

샘플 이미지 및 어노테이션#

다음은 COCO8-Grayscale 데이터셋의 모자이크 학습 배치 예입니다:

COCO8 grayscale dataset mosaic training batch
  • 모자이크 이미지: 이 이미지는 모자이크 증강을 사용하여 여러 데이터셋 이미지를 결합한 학습 배치를 보여줍니다. 모자이크 증강은 각 배치에 포함된 객체와 장면의 다양성을 높여 모델이 다양한 객체 크기, 종횡비, 배경에 더 잘 일반화하도록 돕습니다.

이 기법은 COCO8-Grayscale처럼 작은 데이터셋에서 특히 유용하며, 학습 중 각 이미지의 활용도를 극대화합니다.

인용 및 감사의 글#

연구 또는 개발 과정에서 COCO 데이터셋을 사용하는 경우 다음 논문을 인용해 주세요:

인용
@misc{lin2015microsoft,
      title={Microsoft COCO: Common Objects in Context},
      author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
      year={2015},
      eprint={1405.0312},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

지속적으로 컴퓨터 비전 커뮤니티에 기여해 주시는 COCO 컨소시엄에 특별히 감사드립니다.

자주 묻는 질문#

  • Ultralytics COCO8-Grayscale 데이터셋은 객체 탐지 모델을 신속하게 테스트하고 디버깅하도록 설계되었습니다. 이미지가 8개(학습용 4개, 검증용 4개)뿐이므로 대규모 데이터셋으로 확장하기 전에 YOLO 학습 파이프라인을 검증하고 모든 것이 예상대로 작동하는지 확인하는 데 적합합니다.

  • Python 또는 CLI를 사용해 COCO8-Grayscale에서 YOLO26 모델을 학습할 수 있습니다:

    학습 예제
    from ultralytics import YOLO
    
    # 사전 학습된 YOLO26n 모델 로드
    model = YOLO("yolo26n.pt")
    
    # COCO8-Grayscale에서 모델 학습
    results = model.train(data="coco8-grayscale.yaml", epochs=100, imgsz=640)

    추가 학습 옵션은 YOLO 학습 문서를 참조하세요.

  • COCO8-Grayscale 학습에 사용되는 모자이크 증강은 각 배치에서 여러 이미지를 하나로 결합합니다. 이를 통해 객체와 배경의 다양성이 늘어나 YOLO 모델이 새로운 상황에 더 잘 일반화할 수 있습니다. 모자이크 증강은 특히 소규모 데이터셋에 유용하며, 각 학습 단계에서 활용 가능한 정보를 극대화합니다.

  • COCO8-Grayscale에서 학습한 후 YOLO26 모델을 검증하려면 Python 또는 CLI에서 모델 검증 명령을 사용하세요. 이 명령은 표준 지표를 사용해 모델 성능을 평가합니다. 단계별 지침은 YOLO 검증 문서에서 확인하세요.

댓글7

질문을 하거나 결과를 공유하거나 다른 사람을 도와주세요.

  1. shkim-lpGitHub

    Dear Ultralytics, Hello. I am a learner and a user of Ultralytics-YOLO Software. I am writing this post to ask questions about tracking Livestream color videos in grayscale.

    At the moment, I am using Ultralytics for Classification/Segmentation/Tracking of my Livestream video. My livestream video contains 4 different types of connectors, which are moved by robots.

    I have used the software well so far to classify/segment/track the 4 connectors in Livestream color video I tracked the Livestream video with results = model.track(source="0", show=Trune, save=True), which displayed live results with "0" window. I was happy with the result.

    Now, I want to test the performance for a real scenario, where the Livestream camera will aceept only B/W images (The equipment has not been installed yet and I am trying to emulate future situation). I learned how to train models in B/W images with simple addition of channels = 1 . However, I still don't know how to track a Livestream video (where images are imported in color) in B/W scales and output them in B/W in "0" window.
    Would there be an easy method to invoke results = model.track(source="0", show=Ture, save=True) , but classify/segment/track in B/W scale and output them in B/W as well?

    Thank you for your assistance!

    1. Glenn JocherUltralytics

      There’s no built-in switch in model.track(source=0, ...) to force grayscale preprocessing for a webcam stream, so the simplest way to emulate a B/W camera is to read frames with OpenCV, convert to grayscale, then replicate back to 3 channels (GRAY2BGR) so it works with any YOLO model, and display/save the result (training-side grayscale is covered on the COCO8-Grayscale dataset page).

      import cv2
      from ultralytics import YOLO
      
      model = YOLO("best.pt")  # your det/seg model
      cap = cv2.VideoCapture(0)
      
      while True:
          ok, frame = cap.read()
          if not ok:
              break
      
          gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
          frame_bw3 = cv2.cvtColor(gray, cv2.COLOR_GRAY2BGR)  # BW content, kept 3-channel
      
          results = model.track(source=frame_bw3, persist=True, verbose=False)
          annotated = results[0].plot()  # BGR
          annotated_gray = cv2.cvtColor(annotated, cv2.COLOR_BGR2GRAY)
      
          cv2.imshow("0", annotated_gray)
          if cv2.waitKey(1) == 27:  # ESC to quit
              break
      
      cap.release()
      cv2.destroyAllWindows()
      1
    2. Glenn JocherUltralytics

      Glad it helped—if you end up training a channels: 1 model you can usually skip GRAY2BGR and feed the grayscale frame directly as (H, W) or (H, W, 1) (the loader will expand 2D grayscale to 1 channel), and feel free to drop any follow-up questions here so the Ultralytics team sees them (see the COCO8-Grayscale dataset docs).

  2. zjjzengGitHub

    Hello, I did not notice this page before, so I trained my model on default rgb 3 channels and then predicted. Actually, all my native dataset images are gray images, I used a numpy operation to manually transfer it before training. I wonder that if I change channels to 1, will I be able to gain any improvements on my model. And do I need to modify both data.yaml and my customized yolo11n.yaml, right?

    1. Glenn JocherUltralytics

      Great question—set channels: 1 in your dataset YAML and train; you don’t need to modify your custom yolo11n.yaml as the model’s first layer adapts automatically; if you previously replicated grayscale to 3 channels, accuracy differences are usually small while 1-channel can save memory, so a quick A/B run is the best way to confirm; for more on multi-channel handling, see the COCO8-Multispectral dataset page.