auto-cats-and-dogs / README.md
yourusername's picture
commit files to HF hub
e0c25d9
metadata
task_categories:
  - other
task_ids:
  - other-image-classification
  - image-classification
tags:
  - auto-generated
  - image-classification

nateraw/auto-cats-and-dogs

Image Classification Dataset

Usage

from PIL import Image
from datasets import load_dataset

def pil_loader(path: str):
    with open(path, 'rb') as f:
        im = Image.open(f)
        return im.convert('RGB')

def image_loader(example_batch):
    example_batch['image'] = [
        pil_loader(f) for f in example_batch['file']
    ]
    return example_batch


ds = load_dataset('nateraw/auto-cats-and-dogs')
ds = ds.with_transform(image_loader)