--- task_categories: - text-to-image pretty_name: 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 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](https://github.com/hpc203/yolov8-face-landmarks-opencv-dnn), using score threshold 0.7. More samples might be added in the future.