Bắt đầu

Dataset COCO-Seg

COCO 2017 Segmentation preview 1
COCO 2017 Segmentation preview 2
COCO 2017 Segmentation preview 3
COCO 2017 Segmentation preview 4
123,272
COCO 2017 Segmentation
ultralytics
PublicSegment

Everyday photos with per-instance object masks, Microsoft COCO's 2017 release and the standard instance-segmentation benchmark. Images were gathered from Flickr and outlined by crowdworkers, with dense, overlapping objects at widely varying scales; only train and val are included because test-dev labels are withheld. Source: Lin et al., "Microsoft COCO: Common Objects in Context," ECCV 2014; cocodataset.org.

80 classes11.6 GBOct 23, 2026
personbicyclecarmotorcycle+76
instance-segmentationcocococo2017+1

Dataset COCO-Seg cung cấp mask phân đoạn đối tượng của COCO (Các đối tượng phổ biến trong ngữ cảnh) — 118,287 ảnh huấn luyện và 5,000 ảnh xác thực với mask đa giác trên 80 danh mục đối tượng — theo định dạng nhãn Ultralytics YOLO. Dataset sử dụng ảnh gốc và chú giải phân đoạn nguyên bản của COCO, được chuyển đổi để huấn luyện YOLO, nhờ đó trở thành tài nguyên tiêu chuẩn cho các nhà nghiên cứu và nhà phát triển làm việc với tác vụ phân đoạn đối tượng.

Model Pretrained COCO-Seg#

Modelkích thước
(pixel)
mAPbox50-95
(e2e)
mAPmask50-95
(e2e)
Tốc độ
CPU ONNX
(ms)
Tốc độ
T4 TensorRT10
(ms)
params
(M)
FLOPs
(B)
YOLO26n-seg64039.633.953.3 ± 0.52.1 ± 0.02.79.3
YOLO26s-seg64047.340.0118.4 ± 0.93.3 ± 0.010.434.5
YOLO26m-seg64052.544.1328.2 ± 2.46.7 ± 0.123.6121.7
YOLO26l-seg64054.445.5387.0 ± 3.78.0 ± 0.128.0140.1
YOLO26x-seg64056.547.0787.0 ± 6.816.4 ± 0.162.8314.0

Tính năng chính#

  • COCO-Seg cung cấp mask instance segmentation cho 123.287 ảnh COCO train2017/val2017 được gán nhãn (118.287 ảnh huấn luyện + 5.000 ảnh xác thực), trong tổng số khoảng ~330K ảnh của bản phát hành COCO rộng hơn.
  • Dataset bao gồm cùng 80 danh mục object như dataset COCO gốc.
  • Annotation cung cấp mask instance segmentation theo định dạng nhãn polygon YOLO.
  • COCO-Seg cung cấp các chỉ số mAP và mAR được chuẩn hóa để đánh giá hiệu năng instance segmentation, giúp so sánh hiệu quả hiệu năng của model.
  • Kích thước tải xuống: ~20.3 GB khi sử dụng lần đầu (train2017.zip + val2017.zip + nhãn). File test2017.zip dung lượng 7 GB không được tự động tải xuống, vì các ảnh này không công khai ground truth và chỉ cần thiết cho bài nộp test-dev2017.

Cấu trúc dataset#

Bộ dữ liệu COCO-Seg được chia thành ba tập con:

  1. Train2017: 118.287 ảnh dùng để huấn luyện các model phân đoạn đối tượng.
  2. Val2017: 5.000 ảnh dùng để đánh giá trong quá trình phát triển model.
  3. Test-dev2017: 20.288 trong số 40.670 ảnh test2017, dùng để benchmark. Nhãn ground truth của tập con này không được công khai, vì vậy phải gửi dự đoán đến máy chủ đánh giá COCO để chấm điểm.

Để thử nghiệm với quy mô nhỏ hơn, hãy xem các tập con COCO128-Seg (128 ảnh) và COCO8-Seg (8 ảnh).

Ứng dụng#

COCO-Seg được sử dụng rộng rãi để huấn luyện và đánh giá model deep learning trên tác vụ phân đoạn đối tượng, chẳng hạn như các model YOLO. Số lượng lớn ảnh được chú giải, sự đa dạng của các danh mục đối tượng và các chỉ số đánh giá được tiêu chuẩn hóa khiến dataset này trở thành tài nguyên tiêu chuẩn cho các nhà nghiên cứu và chuyên gia thị giác máy tính. Bạn cũng có thể duyệt và quản lý toàn bộ chú giải COCO-Seg trên Nền tảng Ultralytics.

YAML của dataset#

Tệp YAML được dùng để xác định cấu hình bộ dữ liệu. Tệp này chứa thông tin về đường dẫn, lớp và các thông tin liên quan khác của bộ dữ liệu. Với bộ dữ liệu COCO-Seg, tệp coco.yaml được duy trì tại https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco.yaml.

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

# COCO 2017 dataset https://cocodataset.org by Microsoft
# Documentation: https://docs.ultralytics.com/datasets/detect/coco
# Example usage: yolo train data=coco.yaml
# parent
# ├── ultralytics
# └── datasets
#     └── coco ← downloads here (20.3 GB)

# 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: coco # dataset root dir
train: train2017.txt # train images (relative to 'path') 118287 images
val: val2017.txt # val images (relative to 'path') 5000 images
test: test-dev2017.txt # 20288 of 40670 images, submit via https://cocodataset.org/#detection-eval

# 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: |
  from pathlib import Path

  from ultralytics.utils import ASSETS_URL
  from ultralytics.utils.downloads import download

  # Download labels
  segments = True  # segment or box labels
  dir = Path(yaml["path"])  # dataset root dir
  urls = [ASSETS_URL + ("/coco2017labels-segments.zip" if segments else "/coco2017labels.zip")]  # labels
  download(urls, dir=dir.parent)

  # Download data (test2017.zip excluded: ground truth is withheld, only used for the eval-server test-dev split)
  urls = [
      "http://images.cocodataset.org/zips/train2017.zip",  # 19G, 118k images
      "http://images.cocodataset.org/zips/val2017.zip",  # 1G, 5k images
  ]
  download(urls, dir=dir / "images", threads=3)

Cách sử dụng#

Để huấn luyện model YOLO26n-seg trên dataset COCO-Seg trong 100 epoch với kích thước ảnh 640, bạn có thể dùng các đoạn code sau.

Ví dụ huấn luyện
from ultralytics import YOLO

# Tải model
model = YOLO("yolo26n-seg.pt")  # tải model đã huấn luyện trước (được khuyến nghị khi huấn luyện)

# Huấn luyện model
results = model.train(data="coco.yaml", epochs=100, imgsz=640)

Hình ảnh mẫu và annotation#

COCO-Seg có cùng các ảnh đa dạng, danh mục đối tượng và cảnh phức tạp như COCO, đồng thời cung cấp mask phân đoạn đối tượng ở định dạng nhãn YOLO. Dưới đây là một số ảnh trong bộ dữ liệu cùng với các mask phân đoạn đối tượng tương ứng:

Lưới ảnh mosaic của batch huấn luyện bộ dữ liệu phân đoạn COCO

  • Ảnh ghép mosaic: Ảnh này minh họa một batch huấn luyện gồm các ảnh trong bộ dữ liệu được ghép mosaic. Ghép mosaic là kỹ thuật được sử dụng trong quá trình huấn luyện, kết hợp nhiều ảnh thành một ảnh duy nhất để tăng độ đa dạng của đối tượng và cảnh trong mỗi batch huấn luyện. Kỹ thuật này giúp model khái quát hóa tốt hơn với các kích thước đối tượng, tỷ lệ khung hình và ngữ cảnh khác nhau.

Trích dẫn và lời cảm ơn#

Nếu sử dụng bộ dữ liệu COCO-Seg trong nghiên cứu hoặc công việc phát triển, vui lòng trích dẫn bài báo COCO gốc và ghi nhận phần mở rộng COCO-Seg:

Trích dẫn
@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}
}

Chúng tôi xin cảm ơn COCO Consortium đã tạo và duy trì tài nguyên quý giá này cho cộng đồng thị giác máy tính.

Câu hỏi thường gặp#

  • COCO-Seg là gói dữ liệu theo định dạng Ultralytics YOLO chứa các mask phân đoạn đối tượng nguyên bản của COCO (Các đối tượng phổ biến trong ngữ cảnh) cho cùng 118,287 ảnh train2017 và 5,000 ảnh val2017. Chú giải COCO ban đầu đã bao gồm các mask đa giác này cho toàn bộ 80 danh mục đối tượng; COCO-Seg chuyển đổi chúng sang định dạng nhãn YOLO dùng để huấn luyện phân đoạn đối tượng.

  • Để huấn luyện model YOLO26n-seg trên bộ dữ liệu COCO-Seg trong 100 epoch với kích thước ảnh 640, bạn có thể dùng các đoạn mã sau. Để xem danh sách chi tiết các tham số huấn luyện hiện có, hãy tham khảo trang Huấn luyện model.

    Ví dụ huấn luyện
    from ultralytics import YOLO
    
    # Tải model
    model = YOLO("yolo26n-seg.pt")  # tải model đã huấn luyện trước (được khuyến nghị khi huấn luyện)
    
    # Huấn luyện model
    results = model.train(data="coco.yaml", epochs=100, imgsz=640)
  • Bộ dữ liệu COCO-Seg có một số tính năng chính:

    • Cung cấp mask phân đoạn đối tượng cho 123.287 ảnh COCO train2017/val2017 được gán nhãn (118.287 train + 5.000 val).
    • Gán nhãn cho cùng 80 danh mục đối tượng có trong COCO gốc.
    • Cung cấp mask phân đoạn đối tượng ở định dạng nhãn đa giác YOLO.
    • Sử dụng các chỉ số đánh giá được tiêu chuẩn hóa như Độ chính xác trung bình (mAP) và Độ bao phủ trung bình (mAR) cho các tác vụ phân đoạn đối tượng.
  • Bộ dữ liệu COCO-Seg hỗ trợ nhiều model phân đoạn YOLO26 pretrained với các chỉ số hiệu năng khác nhau. Dưới đây là tóm tắt các model hiện có và những chỉ số chính:

    Modelkích thước
    (pixel)
    mAPbox50-95
    (e2e)
    mAPmask50-95
    (e2e)
    Tốc độ
    CPU ONNX
    (ms)
    Tốc độ
    T4 TensorRT10
    (ms)
    params
    (M)
    FLOPs
    (B)
    YOLO26n-seg64039.633.953.3 ± 0.52.1 ± 0.02.79.3
    YOLO26s-seg64047.340.0118.4 ± 0.93.3 ± 0.010.434.5
    YOLO26m-seg64052.544.1328.2 ± 2.46.7 ± 0.123.6121.7
    YOLO26l-seg64054.445.5387.0 ± 3.78.0 ± 0.128.0140.1
    YOLO26x-seg64056.547.0787.0 ± 6.816.4 ± 0.162.8314.0

    Các model này trải dài từ YOLO26n-seg nhẹ cho đến YOLO26x-seg có độ chính xác cao hơn, cung cấp nhiều mức đánh đổi giữa tốc độ và độ chính xác để đáp ứng các yêu cầu ứng dụng khác nhau.

  • Bộ dữ liệu COCO-Seg được chia thành ba tập con để đáp ứng các nhu cầu huấn luyện và đánh giá cụ thể:

    1. Train2017: Gồm 118.287 ảnh, chủ yếu dùng để huấn luyện các model phân đoạn đối tượng.
    2. Val2017: Gồm 5,000 ảnh được dùng để xác thực trong quá trình huấn luyện.
    3. Test-dev2017: Gồm 20,288 trong số 40,670 ảnh test2017 được dành cho việc kiểm thử và đánh giá chuẩn các model đã huấn luyện. Lưu ý rằng chú giải ground truth cho tập con này không được công khai; kết quả hiệu năng được gửi đến máy chủ đánh giá COCO để chấm điểm.

    Để thử nghiệm với quy mô nhỏ hơn, bạn cũng có thể cân nhắc bộ dữ liệu COCO128-Seg (128 ảnh) hoặc bộ dữ liệu COCO8-Seg, phiên bản nhỏ gọn chỉ gồm 8 ảnh từ tập COCO train 2017.

Bình luận10

Đặt câu hỏi, chia sẻ kết quả hoặc giúp đỡ người khác.

  1. liujieKermitGitHub

    what the label format if I want to train my custom dataset, please give the solution step by step like label, train, val, export, predict

    1. Glenn JocherUltralytics(đã chỉnh sửa)

      @liujieKermit for custom segmentation training with YOLO26, follow these steps:

      1. Label Format: Use YOLO segmentation format - one text file per image with class index and normalized polygon coordinates (minimum 3 points per object). Example:
        <class> <x1> <y1> <x2> <y2> ... <xn> <yn>

      2. Dataset YAML: Create a YAML file (example data.yaml):

      path: /path/to/dataset
      train: images/train
      val: images/val
      names:
        0: class1
        1: class2
      1. Train:
      from ultralytics import YOLO
      model = YOLO('yolo26n-seg.pt')
      model.train(data='data.yaml', epochs=100, imgsz=640)
      1. Export/Predict:
      model.export(format='onnx')  # export
      model.predict('image.jpg')  # predict

      For full details see our Dataset Format Guide and Auto-Annotation Tools. For commercial use, review our license terms.

  2. YingdiZhangGitHub

    Thanks for the great work. I am new to YOLO and AI. How to download the COCO dataset? is just running python coco.yaml?

    1. Glenn JocherUltralytics(đã chỉnh sửa)

      @YingdiZhang to download the COCO dataset, you can run yolo segment train data=coco.yaml in your terminal. This will automatically download the dataset for you. For more details, you can visit the Ultralytics documentation.

  3. SacherTorte280GitHub

    Dear developpers, I need to build a much simpler case where I'll only need <=5 labels, can I remove the others that i'll never use ?

    1. Paula DerrengerUltralytics(đã chỉnh sửa)

      @SacherTorte280 yes, you can customize the dataset to include only the labels you need. To do this, modify the coco.yaml file to include only the desired classes in the names section and adjust the dataset paths accordingly. Also make sure the class indices in your label files are remapped to match the new names (0 to N-1) and remove labels of the dropped classes. This will allow you to train your model with a simplified set of labels. For more details on configuring the dataset, please refer to the COCO-Seg documentation.

    1. Paula DerrengerUltralytics

      Hi there! It looks like you're encountering a list index out of range error with the convert_coco function. This can often happen if the script is trying to access an element that doesn't exist in a list. To help you resolve this issue, please ensure that:

      1. The data paths in your coco.yaml config file are correctly set and point to valid files.
      2. The COCO dataset is correctly downloaded and structured as expected by the script.

      If the paths and dataset structure are correct, it might be helpful to check if the specific segment of data causing the error is formatted correctly or missing elements.

      Here's a quick check you can perform:

      try:
          # Assuming convert_coco is called here
          convert_coco()
      except IndexError as e:
          print("An index error occurred: ", e)
          # You can add more debugging information here to understand which part of the data is causing the problem

      This snippet will catch the IndexError and print it, potentially providing more insight on what's going wrong. If you need further assistance, please don't hesitate to share a snippet of the data or more details on the error!

  4. mohamed-ladjalGitHub

    Greetings, I possess medical imagery depicting bone lesions. These images comprise 3D volumes of dimensions (256, 256, 128), with each volume containing 128 slices. Corresponding masks of identical dimensions are available. My objective is to either fine-tune or train a model using these slices to accurately segment the lesions mohamed mohamed.laadjel2019@gmail.com

    1. Glenn JocherUltralytics(đã chỉnh sửa)

      Hello Mohamed,

      Great to hear about your project on segmenting bone lesions from medical imagery! For your 3D volumes, you can approach this by treating each slice as a separate 2D image for segmentation.

      Given your setup, you might consider using our YOLO26-seg models, which are well-suited for segmentation tasks. Here’s a basic example of how you could set up your training with YOLO26:

      from ultralytics import YOLO
      
      # Load a pretrained segmentation model
      model = YOLO('yolo26n-seg.pt')  # Choose the appropriate model size
      
      # Prepare your dataset in a compatible format
      # Ensure your dataset directory structure and annotations are correctly set up
      
      # Train the model
      results = model.train(data='your_dataset_config.yaml', epochs=100, imgsz=640)

      Make sure your dataset is annotated similarly to how COCO-Seg annotations are structured, with masks corresponding to each slice. You might need to adjust the your_dataset_config.yaml to correctly point to your training, validation, and test images along with their annotations.

      For more detailed guidance on preparing your dataset and annotations, you can refer to our documentation on COCO-Seg Dataset.

      If you have any more questions or need further assistance, feel free to ask. Happy training! 🚀