nirmalendu01/animal_dataset
Animal Dataset from COCO This dataset contains animal images extracted from the COCO 2017 training set, with two download configurations available. Dataset Configurations 1. Metadata Configuration (Small Download) The metadata configuration contains only text metadata and image URLs - no image bytes. This is ideal for quick exploration and when you want to download images yourself. from datasets import load_dataset # Load full metadata dataset… See the full description on the dataset page: https://huggingface.co/datasets/nirmalendu01/animal_dataset.
Animal Dataset from COCO
This dataset contains animal images extracted from the COCO 2017 training set, with two download configurations available.
Dataset Configurations
1. Metadata Configuration (Small Download)
The metadata configuration contains only text metadata and image URLs - no image bytes. This is ideal for quick exploration and when you want to download images yourself.
from datasets import load_dataset
# Load full metadata dataset (small download)
ds = load_dataset("nirmalendu01/animal_dataset", "metadata", split="train")
# Load first 200 samples only (partial download)
ds = load_dataset("nirmalendu01/animal_dataset", "metadata", split="train[:200]")Fields included:
cocoid: COCO image IDfile_name: Image filenamewidth,height: Image dimensionscoco_url,flickr_url: Image download URLscaptions: List of captions for the imageanimal_labels: List of animal types in the imageanimal_bboxes_xywh: Bounding boxes [[x, y, width, height], ...]animal_bbox_labels: Labels corresponding to each bbox
2. Images Configuration (Large Download)
The images configuration includes the actual image data. This is larger but convenient for direct use.
from datasets import load_dataset
# Load full images dataset (large download)
ds_img = load_dataset("nirmalendu01/animal_dataset", "images", split="train")
# Load first 200 samples only (partial download with images)
ds_img = load_dataset("nirmalendu01/animal_dataset", "images", split="train[:200]")Fields included:
- All fields from
metadataconfiguration image: PIL Image object with the actual image data
Partial Downloads and Slicing
This dataset supports partial downloads through split slicing. You can download only a subset of the data without downloading the entire dataset:
# First 100 samples
ds = load_dataset("nirmalendu01/animal_dataset", "metadata", split="train[:100]")
# Samples 100-200
ds = load_dataset("nirmalendu01/animal_dataset", "metadata", split="train[100:200]")
# Last 100 samples
ds = load_dataset("nirmalendu01/animal_dataset", "metadata", split="train[-100:]")
# Every 10th sample (10% of data)
ds = load_dataset("nirmalendu01/animal_dataset", "metadata", split="train[::10]")Note: Split slicing works for both metadata and images configurations. The dataset is sharded into multiple files to enable efficient partial downloads.
Usage Examples
Example 1: Quick exploration with metadata only
from datasets import load_dataset
# Small download - just metadata
ds = load_dataset("nirmalendu01/animal_dataset", "metadata", split="train[:100]")
# Access metadata
print(ds[0]["animal_labels"]) # ['cat', 'dog']
print(ds[0]["captions"][0]) # "A cat and dog playing..."
print(ds[0]["coco_url"]) # Image URLExample 2: Working with images
from datasets import load_dataset
# Larger download - includes images
ds = load_dataset("nirmalendu01/animal_dataset", "images", split="train[:100]")
# Access image directly
image = ds[0]["image"]
image.show() # Display image
# Access metadata
print(ds[0]["animal_labels"])
print(ds[0]["animal_bboxes_xywh"])Example 3: Object detection with bounding boxes
from datasets import load_dataset
from PIL import Image, ImageDraw
ds = load_dataset("nirmalendu01/animal_dataset", "images", split="train[:10]")
for example in ds:
img = example["image"]
bboxes = example["animal_bboxes_xywh"] # [[x, y, w, h], ...]
labels = example["animal_bbox_labels"]
# Draw bounding boxes
draw = ImageDraw.Draw(img)
for bbox, label in zip(bboxes, labels):
x, y, w, h = bbox
draw.rectangle([x, y, x+w, y+h], outline="red", width=2)
draw.text((x, y-10), label, fill="red")
img.show()Dataset Statistics
- Total images: 23,989
- Animal categories: 10 (bird, cat, dog, horse, sheep, cow, elephant, bear, zebra, giraffe)
- Source: COCO 2017 Training Set
- License: CC-BY-4.0 (inherited from COCO)
Citation
If you use this dataset, please cite the original COCO dataset:
@article{lin2014microsoft,
title={Microsoft coco: Common objects in context},
author={Lin, Tsung-Yi and Maire, Michael and Belongie, Serge and Hays, James and Perona, Pietro and Ramanan, Deva and Doll{'a}r, Piotr and Zitnick, C Lawrence},
journal={arXiv preprint arXiv:1405.0312},
year={2014}
}