Datasets:
|
Download tutorials/metadata.md from Spawning/PD12M: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/datasets/Spawning/PD12M/resolve/5efbf9c0668cb303c636eb7a0c7e67f3fd4670ac/tutorials/metadata.md
- Command line
-
hf download hf://datasets/Spawning/PD12M@5efbf9c0668cb303c636eb7a0c7e67f3fd4670ac/tutorials/metadata.md
-
curl -L -o metadata.md https://huggingface.co/datasets/Spawning/PD12M/resolve/5efbf9c0668cb303c636eb7a0c7e67f3fd4670ac/tutorials/metadata.md
1.04 kB
| # Working with the Metadata | |
| The metadata files are in parquet format, and contain the following attributes: | |
| - `id`: A unique identifier for the image. | |
| - `url`: The URL of the image. | |
| - `s3_key`: The S3 file key of the image. | |
| - `caption`: A caption for the image. | |
| - `md5_hash`: The MD5 hash of the image file. | |
| - `mime_type`: The MIME type of the image file. | |
| - `width`: The width of the image in pixels. | |
| - `height`: The height of the image in pixels. | |
| - `license_type`: The URL of the license. | |
| #### Open a metadata file | |
| The files are in parquet format, and can be opened with a tool like `pandas` in Python. | |
| ```python | |
| import pandas as pd | |
| df = pd.read_parquet('spawning-15m-metadata.001.parquet') | |
| ``` | |
| #### Get URLs from metadata | |
| Once you have opened a maetadata file with pandas, you can get the URLs of the images with the following command: | |
| ```python | |
| urls = df['url'] | |
| ``` | |
| #### Get S3 File Keys from metadata | |
| You can also get the S3 file keys, which can be used to download the images using the S3 CLI: | |
| ```python | |
| s3_keys = df['s3_key'] | |
| ``` |