nickpai's picture
Update README.md
a54c590 verified
metadata
dataset_info:
  features:
    - name: license
      dtype: int64
    - name: file_name
      dtype: string
    - name: coco_url
      dtype: string
    - name: height
      dtype: int64
    - name: width
      dtype: int64
    - name: date_captured
      dtype: string
    - name: flickr_url
      dtype: string
    - name: image_id
      dtype: int64
    - name: ids
      sequence: int64
    - name: captions
      sequence: string
  splits:
    - name: train
      num_bytes: 60768398.02132102
      num_examples: 112268
    - name: validation
      num_bytes: 2684731
      num_examples: 5000
  download_size: 28718001
  dataset_size: 63453129.02132102
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
      - split: validation
        path: data/validation-*
task_categories:
  - text-to-image
  - image-to-image
language:
  - en
tags:
  - coco
  - image-captioning
  - colorization
pretty_name: COCO2017-Colorization
size_categories:
  - 100K<n<1M

COCO 2017 Dataset for Image Colorization

Overview

This dataset is derived from the COCO (Common Objects in Context) 2017 dataset, which is a large-scale object detection, segmentation, and captioning dataset. The COCO 2017 dataset has been adapted here specifically for the task of image colorization.

Dataset Description

Format

DatasetDict({
    train: Dataset({
        features: ['license', 'file_name', 'coco_url', 'height', 'width', 'date_captured', 'flickr_url', 'image_id', 'ids', 'captions'],
        num_rows: 112268
    })
    validation: Dataset({
        features: ['license', 'file_name', 'coco_url', 'height', 'width', 'date_captured', 'flickr_url', 'image_id', 'ids', 'captions'],
        num_rows: 5000
    })
})

Usage

Download image data and unzip

cd PATH_TO_IMAGE_FOLDER

wget http://images.cocodataset.org/zips/train2017.zip
wget http://images.cocodataset.org/zips/val2017.zip

unzip train2017.zip
unzip val2017.zip

Branches

  • main: Provides the original captions sentences.
  • caption-free: Provides random prompts selected from the following list:
sentences = [
    "Add colors to this image",
    "Give realistic colors to this image",
    "Add realistic colors to this image",
    "Colorize this grayscale image",
    "Colorize this image",
    "Restore the original colors of this image",
    "Make this image colorful",
    "Colorize this image as if it was taken with a color camera",
    "Create the original colors of this image"
]
  • custom-caption: Provides captions generated by CLIP Interrogator with 'ViT-H-14/laion2b_s32b_b79k' model. Then filter with 'csv_filter.py' to remove unlikely words, such as black and white, monochrome, grainy, desaturated, etc. For more details about the prompts filtering criteria, refer to the Dataset-for-Image-Colorization repository. For example, bellow is one of the generated caption:
["there is a  photo of a bear sitting in the grass, half grizzly bear, portrait of anthropomorphic bear, head of a bear, grizzly, grizzled, brown bear, by Mirko Rački, bear, half bear, by Jacek Sempoliński, staring, angry bear"]

Loading the Dataset

You can load this dataset using the Hugging Face 'datasets' library:

from datasets import load_dataset

Main Branch

# Load the train split of the colorization dataset
train_dataset = load_dataset("nickpai/coco2017-colorization", split="train")
# Load the validation split of the colorization dataset
val_dataset = load_dataset("nickpai/coco2017-colorization", split="validation")

Caption-Free Branch

# Load the train split of the colorization dataset from the caption-free branch
train_dataset = load_dataset("nickpai/coco2017-colorization", split="train", revision="caption-free")
# Load the validation split of the colorization dataset from the caption-free branch
val_dataset = load_dataset("nickpai/coco2017-colorization", split="validation", revision="caption-free")

Custom-Caption Branch

# Load the train split of the colorization dataset from the custom-caption branch
train_dataset = load_dataset("nickpai/coco2017-colorization", split="train", revision="custom-caption")
# Load the validation split of the colorization dataset from the custom-caption branch
val_dataset = load_dataset("nickpai/coco2017-colorization", split="validation", revision="custom-caption")

Filtering Criteria

1. Grayscale Images

  • Images in grayscale mode are identified and removed.
  • Grayscale images lack color information are not be suitable for image colorization.

2. Identical Color Histograms

  • Images with identical histograms across color channels (red, green, and blue) are removed.
  • Such images may lack sufficient color variation, affecting model training and performance.

3. Low Color Variance

  • Images with low color variance, determined by a specified threshold, are removed.
  • Low color variance can indicate poor image quality or uniform color distribution.

For more details about the image filtering criteria, refer to the Dataset-for-Image-Colorization repository.