How to Use DeepDanbooru: Your Guide to Anime-Style Image Tagging

Jan 15, 2022 | Data Science

Welcome to the world of DeepDanbooru, the anime-style girl image tag estimation system that adds a sprinkle of magic to your images. Whether you are a developer looking to enhance your project with anime-style tagging or a creator wanting to explore AI developments, this guide will walk you through the steps of getting started with DeepDanbooru. Let’s dive in!

System Requirements

Before you begin, ensure you have Python 3.11 installed on your system. The following packages should also be included:

  • Click=8.1.7
  • numpy=1.26.4
  • requests=2.32.3
  • scikit-image=0.24.0
  • six=1.16.0
  • tensorflow=2.17.0
  • tensorflow-io=0.31.0

You can install these packages easily using the requirements file provided:

pip install -r requirements.txt

If you want to include TensorFlow, you can do so by installing DeepDanbooru with the TensorFlow extra package:

pip install .[tensorflow]

Usage Steps

Now, let’s break down the steps to use DeepDanbooru into manageable pieces. Think of the process like preparing a meal: you need your ingredients, tools, and a recipe!

1. Prepare Your Dataset

If you don’t have a dataset, consider using DanbooruDownloader to download the required images from Danbooru. Want to create your own dataset? Consult the Dataset Structure section below.

2. Create a Training Project Folder

Launch your terminal and run the following command:

deepdanbooru create-project [your_project_folder]

3. Prepare Your Tag List

Want to use the latest tags? Use this command (you will need a Danbooru account and API key):

deepdanbooru download-tags [your_project_folder] --username [your_danbooru_account] --api-key [your_danbooru_api_key]

4. (Optional) Filter Your Dataset

If you want to train with specific tags, convert them into system tags:

deepdanbooru make-training-database [your_dataset_sqlite_path] [your_filtered_sqlite_path]

5. Modify project.json

Edit the project.json file in your project folder, changing the database_path to your actual SQLite file path.

6. Start Training

Ready to train your model? Run:

deepdanbooru train-project [your_project_folder]

7. Enjoy Your Results

Once training is complete, use the following command to evaluate your images:

deepdanbooru evaluate [image_file_path or folder]... --project-path [your_project_folder] --allow-folder

Understanding the Dataset Structure

DeepDanbooru follows a specific folder structure for the input dataset, akin to organizing a cookbook. Here’s how to structure it:

Your dataset should look like this:

MyDataset
images
    00
        00000000000000000000000000000000.jpg
    01
        01000000000000000000000000000000.jpg
    ff
        ff000000000000000000000000000000.jpg
my-dataset.sqlite

The core component is the SQLite database file, which must contain the essential table structure outlined in the README. Each image is stored according to its unique filename and corresponding tags.

Troubleshooting

If you encounter any issues during the setup or training process, consider the following tips:

  • Ensure all required packages are installed as per the specified versions.
  • Double-check your dataset paths and project folder structure.
  • Make sure you have a valid Danbooru account for downloading tags.

If you’re still facing difficulties, for more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox