Skip to content

Register now for

# COCO8-Multispectral Dataset

## Introduction

The Ultralytics COCO8-Multispectral dataset is an advanced variant of the original COCO8 dataset, designed to facilitate experimentation with multispectral object detection models. It consists of the same 8 images from the COCO train 2017 set—4 for training and 4 for validation—but with each image transformed into a 10-channel multispectral format. By expanding beyond standard RGB channels, COCO8-Multispectral enables the development and evaluation of models that can leverage richer spectral information.

COCO8-Multispectral is fully compatible with Ultralytics HUB and YOLO11, ensuring seamless integration into your computer vision workflows.

Watch: How to Train Ultralytics YOLO11 on Multispectral Datasets | Multi-Channel VisionAI 🚀

## Dataset Generation

The multispectral images in COCO8-Multispectral were created by interpolating the original RGB images across 10 evenly spaced spectral channels within the visible spectrum. The process includes:

- Wavelength Assignment: Assigning nominal wavelengths to the RGB channels—Red: 650 nm, Green: 510 nm, Blue: 475 nm.
- Interpolation: Using linear interpolation to estimate pixel values at intermediate wavelengths between 450 nm and 700 nm, resulting in 10 spectral channels.
- Extrapolation: Applying extrapolation with SciPy's `interp1d` function to estimate values beyond the original RGB wavelengths, ensuring a complete spectral representation.

This approach simulates a multispectral imaging process, providing a more diverse set of data for model training and evaluation. For further reading on multispectral imaging, see the Multispectral Imaging Wikipedia article.

## Dataset YAML

The COCO8-Multispectral dataset is configured using a YAML file, which defines dataset paths, class names, and essential metadata. You can review the official `coco8-multispectral.yaml` file in the Ultralytics GitHub repository.

ultralytics/cfg/datasets/coco8-multispectral.yaml

    # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

    # COCO8-Multispectral dataset (COCO8 images interpolated across 10 channels in the visual spectrum) by Ultralytics
    # Documentation: https://docs.ultralytics.com/datasets/detect/coco8-multispectral/
    # Example usage: yolo train data=coco8-multispectral.yaml
    # parent
    # ├── ultralytics
    # └── datasets
    #     └── coco8-multispectral ← downloads here (20.2 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-multispectral # 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)

    # Number of multispectral image channels
    channels: 10

    # 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-multispectral.zip

Note

Prepare your TIFF images in `(channel, height, width)` order and saved with `.tiff` or `.tif` extension for use with Ultralytics:

    import cv2
    import numpy as np

    # Create and write 10-channel TIFF
    image = np.ones((10, 640, 640), dtype=np.uint8)  # CHW-order
    cv2.imwritemulti("example.tiff", image)

    # Read TIFF
    success, frames_list = cv2.imreadmulti("example.tiff")
    image = np.stack(frames_list, axis=2)
    print(image.shape)  # (640, 640, 10)  HWC-order for training and inference

## Usage

To train a YOLO11n model on the COCO8-Multispectral dataset for 100 epochs with an image size of 640, use the following examples. For a comprehensive list of training options, refer to the YOLO Training documentation.

Train Example

Python CLI

    from ultralytics import YOLO

    # Load a pretrained YOLO11n model
    model = YOLO("yolo11n.pt")

    # Train the model on COCO8-Multispectral
    results = model.train(data="coco8-multispectral.yaml", epochs=100, imgsz=640)

    # Train YOLO11n on COCO8-Multispectral using the command line
    yolo detect train data=coco8-multispectral.yaml model=yolo11n.pt epochs=100 imgsz=640

For more details on model selection and best practices, explore the Ultralytics YOLO model documentation and the YOLO Model Training Tips guide.

## Sample Images and Annotations

Below is an example of a mosaiced training batch from the COCO8-Multispectral dataset:

- Mosaiced Image: This image demonstrates a training batch where multiple dataset images are combined using mosaic augmentation. Mosaic augmentation increases the diversity of objects and scenes within each batch, helping the model generalize better to various object sizes, aspect ratios, and backgrounds.

This technique is especially valuable for small datasets like COCO8-Multispectral, as it maximizes the utility of each image during training.

## Citations and Acknowledgments

If you use the COCO dataset in your research or development, please cite the following paper:

BibTeX

    @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}
    }

Special thanks to the COCO Consortium for their ongoing contributions to the computer vision community.

## FAQ

### What Is the Ultralytics COCO8-Multispectral Dataset Used For?

The Ultralytics COCO8-Multispectral dataset is designed for rapid testing and debugging of multispectral object detection models. With only 8 images (4 for training, 4 for validation), it is ideal for verifying your YOLO training pipelines and ensuring everything works as expected before scaling to larger datasets. For more datasets to experiment with, visit the Ultralytics Datasets Catalog.

### How Does Multispectral Data Improve Object Detection?

Multispectral data provides additional spectral information beyond standard RGB, enabling models to distinguish objects based on subtle differences in reflectance across wavelengths. This can enhance detection accuracy, especially in challenging scenarios. Learn more about multispectral imaging and its applications in advanced computer vision.

### Is COCO8-Multispectral Compatible With Ultralytics HUB and YOLO Models?

Yes, COCO8-Multispectral is fully compatible with Ultralytics HUB and all YOLO models, including the latest YOLO11. This allows you to easily integrate the dataset into your training and validation workflows.

### Where Can I Find More Information on Data Augmentation Techniques?

For a deeper understanding of data augmentation methods such as mosaic and their impact on model performance, refer to the YOLO Data Augmentation Guide and the Ultralytics Blog on Data Augmentation.

### Can I Use COCO8-Multispectral for Benchmarking or Educational Purposes?

Absolutely! The small size and multispectral nature of COCO8-Multispectral make it ideal for benchmarking, educational demonstrations, and prototyping new model architectures. For more benchmarking datasets, see the Ultralytics Benchmark Dataset Collection.

📅 Created 5 months ago ✏️ Updated 1 month ago

## Comments