Datasets:
# Downloading Images | |
Once you have the URLs or S3 file keys from the metadata ([follow the steps here here]("./metadata.md")), you can download the images through any standard means. | |
#### cURL | |
Download an image from a url to a local image file with the name `image.png`: | |
```bash | |
curl -O image.png https://spawning-15m.s3.us-west-2.amazonaws.com/image.png | |
``` | |
#### Python | |
Download an image from a url to a local image file with the name `image.png`: | |
```python | |
import requests | |
url = "https://spawning-15m.s3.us-west-2.amazonaws.com/image.png" | |
response = requests.get(url) | |
with open('image.png', 'wb') as f: | |
f.write(response.content) | |
``` | |
#### img2dataset | |
You can also use the `img2dataset` tool to quickly download images from a metadata file. The tool is available [here](https://github.com/rom1504/img2dataset). The example below will download all the images to a local `images` directory. | |
```bash | |
img2dataset download --url_list spawning-15m-metadata.001.parquet --input_format parquet --url_col url --caption_col caption --output-dir images/ | |
``` | |
#### S3 CLI | |
Download an image from an S3 bucket to an image with the name `image.png`: | |
```bash | |
aws s3 cp s3://spawning-15m/image.png image.png | |
``` |