A downloader for e621.net with meant for iterability, using e621 db post exports, designed for deep learning.
Project description
py621dl - an iterable E621 downloader
This package is meant to be used in deep learning applications and automation, not as a means to download specific images and post IDs or searching for tags. For that application, please check out py621 which is not related to this package in any way.
The package is meant to be used with the official db export format from E621, posts information. See here for available db exports and here for general information on the API.
!! This is a pre-release version, and is not meant for production use !!
Proper documentation, tests, and automated updates to the package will be added later.
Usage
The E621Downloader class must be initialized using the Reader class, to which the csv file must be passed. The Reader supports only the official db export csv files of the format "posts-YYYY-MM-DD.csv.gz", either compressed or uncompressed.
The E621Downloader class can be initialized with the following parameters:
csv_reader: the Reader objecttimeout: the timeout for the requests, in secondsretries: the number of retries for the requests
It can be used as an iterable, yielding lists of np.ndarray objects of the images. The list size
will depend on your batch_size specified for Reader. The images are of opencv BGR format.
The downloader automatically handles and filters deleted or flagged posts, and will attempt to fill
the batch with new images so that it will always yield a full batch.
The Reader class can be initialized with the following parameters:
csv_file: the path to the csv filebatch_size: the size of the batch to be returned by theE621Downloaderexcluded_tags: a list of E621 tags to be excluded from the resultsminimum_score: the minimum score of the posts to be included in the resultschunk_size: the size of the chunk to be read from the csv file at oncecheckpoint_file: the path to the checkpoint file, to resume from any point. If path doesn't exist, a new file will be created.repeat: whether to repeat from the beginning of the csv file when the end is reached automatically. OtherwiseStopIterationis raised.E621Downloaderhandles this exception and raises its ownStopIterationwhen the end is reached.
Example use
from py621dl import Reader, E621Downloader
reader = Reader("posts-2022-10-30.csv.gz")
downloader = E621Downloader(reader, timeout=10, retries=3)
for batch in downloader:
# do something with the batch
pass
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py621dl-0.1a0.dev3.tar.gz.
File metadata
- Download URL: py621dl-0.1a0.dev3.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.11.0 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79e13090753b7489bec72a9adec9bfb1670bda8882fe75c2b3de543237e2a0a2
|
|
| MD5 |
fcfdb088519ce43b66ee36b4305e9845
|
|
| BLAKE2b-256 |
b77ca04a7da5cedcfb4b2441c7cc8cb0c4576bb871c9ff65ec7cefe24b53ce81
|
File details
Details for the file py621dl-0.1a0.dev3-py3-none-any.whl.
File metadata
- Download URL: py621dl-0.1a0.dev3-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.11.0 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
151d4f6d8c80d2e088e887f0386f88cd79ff7a4609596bb1bc7f88916627e4e8
|
|
| MD5 |
91bd5dd854937a065f19ce18d8122ed4
|
|
| BLAKE2b-256 |
1ab3896f3d42ddd160a29a992734c71b4ada133fa7a4542256a1197640ad076a
|