"""Tel Aviv Urban Photography Dataset""" import csv import os import datasets _CITATION = """\ @dataset{tel_aviv_pics_2025, title={Tel Aviv Urban Photography Dataset}, author={Rosehill, Daniel}, year={2025}, publisher={Hugging Face}, howpublished={\\url{https://huggingface.co/datasets/danielrosehill/Tel-Aviv-Pics}} } """ _DESCRIPTION = """\ This dataset contains 53 high-quality photographs of Tel Aviv's urban environment, captured to serve as reference material for game development, 3D world creation, and digital environment design. All photographs were taken by Daniel Rosehill and are available on Pexels: https://www.pexels.com/@danielrosehill/ """ _HOMEPAGE = "https://huggingface.co/datasets/danielrosehill/Tel-Aviv-Pics" _LICENSE = "cc-by-4.0" _URLS = { "images": "data/images/", "metadata": "metadata.csv", } class TelAvivPics(datasets.GeneratorBasedBuilder): """Tel Aviv Urban Photography Dataset for game development and 3D world creation.""" VERSION = datasets.Version("1.0.0") def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "image": datasets.Image(), "filename": datasets.Value("string"), "image_number": datasets.Value("string"), "file_size_bytes": datasets.Value("int64"), "photographer": datasets.Value("string"), "photographer_url": datasets.Value("string"), "location": datasets.Value("string"), } ), supervised_keys=None, homepage=_HOMEPAGE, license=_LICENSE, citation=_CITATION, ) def _split_generators(self, dl_manager): """Returns SplitGenerators.""" return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={ "images_dir": "data/images", "metadata_file": "metadata.csv", }, ), ] def _generate_examples(self, images_dir, metadata_file): """Yields examples.""" # Read metadata with open(metadata_file, encoding="utf-8") as f: reader = csv.DictReader(f) for idx, row in enumerate(reader): image_path = os.path.join(images_dir, row["filename"]) yield idx, { "image": image_path, "filename": row["filename"], "image_number": row["image_number"], "file_size_bytes": int(row["file_size_bytes"]), "photographer": row["photographer"], "photographer_url": row["photographer_url"], "location": row["location"], }