cheesechaser.datapool.safebooru

This module provides data pool classes for accessing Safebooru image data.

It contains two classes:

  1. SafebooruDataPool: For accessing the full Safebooru dataset.

  2. SafebooruWebpDataPool: For accessing the WebP-formatted Safebooru dataset with 4M pixel images.

Both classes inherit from IncrementIDDataPool and provide easy access to the respective datasets stored in Hugging Face repositories. These classes simplify the process of retrieving and working with Safebooru image data, allowing users to easily integrate this data into their projects or research.

Note

The datasets deepghs/safebooru_full and deepghs/safebooru-webp-4Mpixel is gated, you have to get the access of it before using this module.

SafebooruDataPool

class cheesechaser.datapool.safebooru.SafebooruDataPool(revision: str = 'main', hf_token: str | None = None)[source]

A data pool class for accessing the full Safebooru dataset.

This class inherits from IncrementIDDataPool and is configured to access the full Safebooru dataset stored in the ‘deepghs/safebooru_full’ repository. It provides methods to retrieve image data based on image IDs.

Parameters:

revision (str) – The revision of the dataset to use, defaults to ‘main’.

Note:

This class uses a base level of 4 for file organization, which means the images are stored in a directory structure with 4 levels of subdirectories.

__init__(revision: str = 'main', hf_token: str | None = None)[source]

Initialize the SafebooruDataPool.

Parameters:
  • revision (str) – The revision of the dataset to use, defaults to ‘main’.

  • hf_token (Optional[str]) – Hugging Face authentication token, defaults to None.

SafebooruWebpDataPool

class cheesechaser.datapool.safebooru.SafebooruWebpDataPool(revision: str = 'main', hf_token: str | None = None)[source]

A data pool class for accessing the WebP-formatted Safebooru dataset with 4M pixel images.

This class inherits from IncrementIDDataPool and is configured to access the WebP-formatted Safebooru dataset stored in the ‘deepghs/safebooru-webp-4Mpixel’ repository. It provides methods to retrieve WebP-formatted image data based on image IDs.

Parameters:
  • revision (str) – The revision of the dataset to use, defaults to ‘main’.

  • hf_token (Optional[str]) – Hugging Face authentication token, defaults to None.

Note:

This class uses a base level of 3 for file organization, which means the images are stored in a directory structure with 3 levels of subdirectories. Authentication may be required to access this dataset.

__init__(revision: str = 'main', hf_token: str | None = None)[source]

Initialize the SafebooruWebpDataPool.

Parameters:
  • revision (str) – The revision of the dataset to use, defaults to ‘main’.

  • hf_token (Optional[str]) – Hugging Face authentication token, defaults to None.