Team Ai
Datasetpublic

gaunernst/pexels-portrait

Pexels Portrait This dataset was collected using the official Pexels API: https://www.pexels.com/api/ All fields returned by the API are recorded, except the source image URL. Only the original image URL is recorded, since other variants can be retrieved on-the-fly by modifying the URL parameters. The "alt" field can be used for simple text-to-image training/finetuning. Image files are not provided. You need to download the image files by yourself. Example of downloading image… See the full description on the dataset page: https://huggingface.co/datasets/gaunernst/pexels-portrait.

sourceHugging Faceupdated 2y agoView on Hugging Face
3likes225downloads
Dataset Card

Pexels Portrait

This dataset was collected using the official Pexels API: https://www.pexels.com/api/

All fields returned by the API are recorded, except the source image URL. Only the original image URL is recorded, since other variants can be retrieved on-the-fly by modifying the URL parameters. The "alt" field can be used for simple text-to-image training/finetuning.

Image files are not provided. You need to download the image files by yourself. Example of downloading image files:

python
def download(_id: int, url: str):
    # corresponds to "large"
    params = dict(auto="compress", cs="tinysrgb", dpr=2, h=650, w=940)
    resp = requests.get(url, params=params)
    resp.raise_for_status()

    save_path = save_dir / str(_id)[-3:] / f"{_id}.webp"
    save_path.parent.mkdir(exist_ok=True, parents=True)
    open(save_path, "wb").write(resp.content)

Photos without human faces were removed with YOLOv8-Face, using score threshold 0.7.

More samples might be added in the future.