konachan / README.md
ryan-minato's picture
Update README.md
0424df5 verified
|
raw
history blame
10.7 kB
metadata
dataset_info:
  - config_name: default
    features:
      - name: id
        dtype: int64
      - name: filename
        dtype: string
      - name: mimetype
        dtype: string
      - name: width
        dtype: int64
      - name: height
        dtype: int64
      - name: rating
        dtype: string
      - name: file_url
        dtype: string
      - name: tags
        sequence: string
      - name: created_at
        dtype: int64
      - name: creator_id
        dtype: float64
      - name: author
        dtype: string
      - name: change
        dtype: int64
      - name: source
        dtype: string
      - name: score
        dtype: int64
      - name: md5
        dtype: string
      - name: file_size
        dtype: int64
      - name: is_shown_in_index
        dtype: bool
      - name: preview_url
        dtype: string
      - name: preview_width
        dtype: int64
      - name: preview_height
        dtype: int64
      - name: actual_preview_width
        dtype: int64
      - name: actual_preview_height
        dtype: int64
      - name: sample_url
        dtype: string
      - name: sample_width
        dtype: int64
      - name: sample_height
        dtype: int64
      - name: sample_file_size
        dtype: int64
      - name: jpeg_url
        dtype: string
      - name: jpeg_width
        dtype: int64
      - name: jpeg_height
        dtype: int64
      - name: jpeg_file_size
        dtype: int64
      - name: has_children
        dtype: bool
      - name: parent_id
        dtype: float64
      - name: status
        dtype: string
      - name: is_held
        dtype: bool
      - name: frames_pending_string
        dtype: string
      - name: frames_pending
        list:
          - name: height
            dtype: int64
          - name: post_id
            dtype: int64
          - name: preview_height
            dtype: int64
          - name: preview_url
            dtype: string
          - name: preview_width
            dtype: int64
          - name: source_height
            dtype: int64
          - name: source_left
            dtype: int64
          - name: source_top
            dtype: int64
          - name: source_width
            dtype: int64
          - name: url
            dtype: string
          - name: width
            dtype: int64
      - name: frames_string
        dtype: string
      - name: frames
        sequence: 'null'
      - name: tag_info
        struct:
          - name: artist
            sequence: string
          - name: character
            sequence: string
          - name: circle
            sequence: string
          - name: copyright
            sequence: string
          - name: general
            sequence: string
          - name: style
            sequence: string
          - name: unknown
            sequence: string
      - name: is_original
        dtype: bool
      - name: image
        dtype: image
    splits:
      - name: train
        num_bytes: 821141234395.8423
        num_examples: 309779
    download_size: 801022997333
    dataset_size: 821141234395.8423
  - config_name: metadata
    features:
      - name: id
        dtype: int64
      - name: filename
        dtype: string
      - name: mimetype
        dtype: string
      - name: width
        dtype: int64
      - name: height
        dtype: int64
      - name: rating
        dtype: string
      - name: file_url
        dtype: string
      - name: tags
        sequence: string
      - name: created_at
        dtype: int64
      - name: creator_id
        dtype: float64
      - name: author
        dtype: string
      - name: change
        dtype: int64
      - name: source
        dtype: string
      - name: score
        dtype: int64
      - name: md5
        dtype: string
      - name: file_size
        dtype: int64
      - name: is_shown_in_index
        dtype: bool
      - name: preview_url
        dtype: string
      - name: preview_width
        dtype: int64
      - name: preview_height
        dtype: int64
      - name: actual_preview_width
        dtype: int64
      - name: actual_preview_height
        dtype: int64
      - name: sample_url
        dtype: string
      - name: sample_width
        dtype: int64
      - name: sample_height
        dtype: int64
      - name: sample_file_size
        dtype: int64
      - name: jpeg_url
        dtype: string
      - name: jpeg_width
        dtype: int64
      - name: jpeg_height
        dtype: int64
      - name: jpeg_file_size
        dtype: int64
      - name: has_children
        dtype: bool
      - name: parent_id
        dtype: float64
      - name: status
        dtype: string
      - name: is_held
        dtype: bool
      - name: frames_pending_string
        dtype: string
      - name: frames_pending
        list:
          - name: height
            dtype: int64
          - name: post_id
            dtype: int64
          - name: preview_height
            dtype: int64
          - name: preview_url
            dtype: string
          - name: preview_width
            dtype: int64
          - name: source_height
            dtype: int64
          - name: source_left
            dtype: int64
          - name: source_top
            dtype: int64
          - name: source_width
            dtype: int64
          - name: url
            dtype: string
          - name: width
            dtype: int64
      - name: frames_string
        dtype: string
      - name: frames
        sequence: 'null'
      - name: mod
        dtype: int64
      - name: tag_info
        struct:
          - name: artist
            sequence: string
          - name: character
            sequence: string
          - name: circle
            sequence: string
          - name: copyright
            sequence: string
          - name: general
            sequence: string
          - name: style
            sequence: string
          - name: unknown
            sequence: string
      - name: is_original
        dtype: bool
    splits:
      - name: train
        num_bytes: 408942486
        num_examples: 309779
    download_size: 151404391
    dataset_size: 408942486
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
  - config_name: metadata
    data_files:
      - split: train
        path: metadata/train-*

CommonArch - Konachan

Description

This dataset contains a dump of image resources from the website Anime Konachan, encompassing a wide variety of anime-style illustrations. It aims to provide a comprehensive collection for training anime-style image generation models and other related research.

This dataset contains 309,779 illustrations scraped up to 2024-09-28 15:49:27 UTC.and is regularly updated every 3 months via web crawling. The next update is scheduled for the end of March 2025.

Dataset Details

  • Number of Images: 309,779
  • Image Quality: Generally of "high" quality.
  • Image Format: Includes various formats such as JPG, PNG, and WEBP.
  • Storage Format: Parquet

This dataset is stored in Parquet format to facilitate integration with the Hugging Face ecosystem. The original image formats (JPG, PNG, WEBP) are preserved during storage.

Data Sampling: The files have been re-ordered during conversion to ensure each file is a reasonably random sample of the parent dataset. You can easily obtain a random subset by loading only a portion of the files (e.g., "hf://datasets/zenless-lab/konachan/data/train-0000[12]-*.parquet").

Image Quality Distribution

(*** WIP ***)

Data Origin and Processing

This dataset is converted from the DeepGHS's deepghs/konachan_full. The content is updated every 3 months through web crawling.

Columns

The dataset contains the following columns:

  • id: Unique identifier (unsorted).
  • filename: Original filename from deepghs/konachan_full, usually in the format <id>.<ext>.
  • minetype: The MIME type of the downloaded image (e.g., image/jpeg, image/png).
  • width: Original image width.
  • height: Original image height.
  • rating: Image rating.
  • file_url: Original image URL.
  • file_size: Image file size (in bytes).
  • creator_id: ID of the uploader.
  • author: Name of the uploader.
  • created_at: Upload timestamp (Unix timestamp).
  • source: Source of the image (only available for some rows).
  • md5: MD5 hash of the image.
  • preview_url: URL of the image preview.
  • preview_width: Width of the image preview.
  • preview_height: Height of the image preview.
  • tags: Original tags associated with the image.
  • tag_info: Structured information about the tags, categorized by role, IP address, etc.
  • is_original: Boolean indicating if the image is original content.
  • image: The dumped original image file (binary data).

Intended Use

This dataset is primarily intended for training anime-style image generation models. It can also be used for other research purposes related to image analysis and style transfer.

Usage

The image column contains a dictionary with keys "bytes" and "path". When using the datasets library, the images are automatically converted to PIL Images. However, when using other libraries, you may need to pre-process the images to convert them to PIL format.

Here are some examples of how to load and use the dataset with different libraries:

Using datasets:

from datasets import load_dataset

ds = load_dataset("parquet", data_files="hf://datasets/zenless-lab/konachan/data/train-0000[12]-*.parquet", split="train")
print(ds)
# Access the first image (automatically converted to PIL Image)
image = ds[0]['image']
image.show()

# Access the tags for the first image
tags = ds[0]['tags']
print(tags)

Using Dask:

import dask.dataframe as dd
from PIL import Image
import io


def convert_image(row):
  if not isinstance(row, dict):
    return None
  img_bytes = io.BytesIO(row["bytes"])
  img = Image.open(img_bytes)
  img = img.convert("RGB")
  return img


df = dd.read_parquet("hf://datasets/zenless-lab/konachan/data/train-0000[12]-*.parquet")
df["image"] = df["image"].map(convert_image)
print(df.head(10)) # to avoid pulling all data during debugging.

Using Polars:

import polars as pl
from PIL import Image
import io

df = pl.read_parquet('hf://datasets/zenless-lab/konachan/data/train-0000[12]-*.parquet')
df = df.with_columns(
    pl.col("image").map_elements(lambda x: Image.open(io.BytesIO(x["bytes"])), return_dtype=pl.Object)
)

print(df)

License

Important Notice Regarding Licensing:

This dataset does not currently have a defined license. Before using this dataset, it is your responsibility to ensure that your use complies with the copyright laws in your jurisdiction. You should determine whether your use qualifies for an exception or limitation to copyright, such as fair use (in the US) or similar provisions like Article 30-4 of the Japanese Copyright Act or the EU Directive on Copyright in the Digital Single Market. This is not legal advice; please consult with a legal professional to assess the risks associated with your intended use.

Contributing

Contributions to this dataset are welcome! You can contribute by:

  • Reporting issues or suggesting improvements.
  • Submitting new images (please ensure they comply with the website's terms of service).
  • Correcting or improving tags and metadata.

Contact

If you have any questions or issues, please feel free to open an issue on the Hugging Face Dataset repository.

Future Updates

The dataset will be updated approximately every three months with new images.