PHPackages                             ramsterhad/ddta - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ramsterhad/ddta

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ramsterhad/ddta
===============

Deep Danbooru Tag Assist. An assistant to find new tags.

v1.4.0(2y ago)543051GPL-3.0-onlyPHP

Since Nov 20Pushed 2y ago2 watchersCompare

[ Source](https://github.com/ramsterhad/deep-danbooru-tag-assist-app)[ Packagist](https://packagist.org/packages/ramsterhad/ddta)[ RSS](/packages/ramsterhad-ddta/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (6)Used By (1)

Deep Danbooru Tag Assist
========================

[](#deep-danbooru-tag-assist)

Web-based assist application for an AI-based multi-label image classification system, based on [KichangKim´s DeepDanbooru](https://github.com/KichangKim/DeepDanbooru "KichangKim´s DeepDanbooru").

[![screenshot](ddta_screenshot.jpg?raw=true "DDTA screenshot")](ddta_screenshot.jpg?raw=true)**[LIVE functional production server, login with danbooru username and API key](https://rdtls.nl/ddta/ "DDTA LIVE functional demonstration and production server").**
*PLEASE BEWARE: SELECTED &amp; SUBMITTED TAGS ARE ADDED TO DANBOORU FOR REAL*.
An API key can be created and removed on your profile page: . See the danbooru API for further information: [https://danbooru.donmai.us/wiki\_pages/help:api](https://danbooru.donmai.us/wiki_pages/help:api).

Data availability
-----------------

[](#data-availability)

We precomputed the images present in [Gwern's danbooru2020 SFW dataset](https://www.gwern.net/Danbooru2020 "Gwen's danbooru 2020 SFW subset dataset") using the 4 RESNET models released by [KichangKim](https://github.com/KichangKim/DeepDanbooru "KichangKim´s DeepDanbooru") for deepdanbooru using a threshold of 0.100. In total, 3.227.713 images were classified using the 4 models, giving 12.910.852 tag prediction strings. The data is available under [releases](https://github.com/ramsterhad/deep-danbooru-tag-assist-app/releases/tag/danbooru2020 "DDTA danbooru 2020 SFW subset dataset tag prediction releases")

Installation
------------

[](#installation)

You can either install it by composer or by downloading the ZIP file.

### Requirements

[](#requirements)

- web server (tested with Apache 2.4)
- PHP 8.0
- php8-curl

#### Optional

[](#optional)

- ImageMagick
- Optional but advised: Configure your web server to serve `public/` as the webroot.

### Composer

[](#composer)

```
composer create-project ramsterhad/ddta-project .
```

### ZIP

[](#zip)

Download the latest deepdanbooru tag assist [ddta.zip](https://github.com/ramsterhad/deep-danbooru-tag-assist-app/releases/latest) package and unzip the files into the target directory of your webserver (e.g. apache: /var/www/html/).

```
wget https://github.com/ramsterhad/deep-danbooru-tag-assist-app/releases/download/v1.4.0/ddta.zip
unzip v1.4.0.zip
chmod -R 777 cache tmp
```

Configuration
-------------

[](#configuration)

Deepdanbooru tag assist queries a TensorFlow model evaluator server (TFMES) accessible from . The parameters are ?url= and &amp;min\_score=, example: [https://deepdanbooru.donmai.us/?url=https://cdn.donmai.us/360x360/6e/8e/6e8e3f6c38f1e9b2e2c531943547e39e.jpg&amp;min\_score=0.5](https://deepdanbooru.donmai.us/?url=https://cdn.donmai.us/360x360/6e/8e/6e8e3f6c38f1e9b2e2c531943547e39e.jpg&min_score=0.5)To adapt the configuration of DDTA, adapt the `.env` file or create `.env.local` so an update doesn't overwrite your configuration.

Parameterdefault valuedanbooru\_api\_urldanbooru\_default\_requesttags=random:1+rating:gdanbooru\_useremptydanbooru\_passemptymachine\_learning\_platform\_repository\_debugfalsetags\_min\_score0.500picture\_storagetmplimit\_for\_suggested\_tags15highlight\_color\_attributesred,green,blue,pink,black,silver,purple,
grey,white,brown,orange,blonde,aqua,
dark\_blue,dark\_green,light\_blue,
light\_brown,light\_green,light\_purple,pink,
platinum\_blonde,purple,translucent,yellowtag\_suggestion\_exclude\_listemptydebugfalse### danbooru\_api\_url

[](#danbooru_api_url)

The default API domain for the Danbooru platforms API. At this moment, only danbooru.donmai.us and its derivative domains are supported. Support for other \*boorus using compatible APIs will follow in future releases. URL must end in a trailing slash. You can change the whole request URL also directly on the page in the input field on top of it. The input field overwrites the environment variable as long as the session cookie lives.

### danbooru\_default\_request

[](#danbooru_default_request)

The default request URL for the Danbooru platforms API request. During the process this string is going to be appended to the config variable `danbooru_api_url`: `${danbooru_api_url}.'posts.json?'.${danbooru_default_request}`. For example:

```
danbooru_api_url=https://example.com/
danbooru_default_request=bar

becomes:

https://example.com/posts.json?bar

```

You can change the whole request URL also directly on the page in the input field on top of it. The input field overwrites the environment variable as long as the session cookie lives.

### danbooru\_user &amp; danbooru\_pass

[](#danbooru_user--danbooru_pass)

To be able to submit new tags to Danbooru, you need to be a registered member and provide your API credentials. To create a session you need to provide credentials in the form of your username and API key. Alternatively, credentials can be placed into the `.env` config file when locally hosting ddta. The API key is different from your password and can be created at your profile page at Danbooru. Please see the [Authentication](https://danbooru.donmai.us/wiki_pages/help:api)section at their API manual.

### machine\_learning\_platform\_repository\_debug

[](#machine_learning_platform_repository_debug)

If set to true, the actual MLP will not be called, but a defined array of example tags will be returned. This is for testing only and should not be used in production.

### tags\_min\_score

[](#tags_min_score)

Tags got a confidence score by the machine learning platform. From 1 to 0. The threshold 0.500 is well tested.

### picture\_storage

[](#picture_storage)

The image is downloaded from danbooru and temporarily locally stored in case it is to be forwarded to the machine learning platform (MLP). Needs write rights.

### limit\_for\_suggested\_tags

[](#limit_for_suggested_tags)

Limits the checkboxes for suggested new tags. By default, a row contains 3 columns. So a number dividable by 3 is recommended. Using the numpad, the first 9 suggested tags can be toggled on/off.

### highlight\_color\_attributes

[](#highlight_color_attributes)

Highlights tags which are already present at Danbooru, but were also suggested from Deep Danbooru, but with a different color.
Example: `hair_yellow` &lt;-&gt; `hair_orange`

### tag\_suggestion\_exclude\_list

[](#tag_suggestion_exclude_list)

A whitespace separated list to exclude tags to be suggested.
Example: `tag_suggestion_exclude_list=tag1 tag2 tag3`

### debug

[](#debug)

Activates a logging for Post Responses, e.g. the answer from the danbooru platform.

Examples of danbooru api calls
------------------------------

[](#examples-of-danbooru-api-calls)

```
Members and anon cannot search for more than two tags at a time. Gold users can search for up to six tags, and Platinum and above users can search for up to twelve tags

Posts are categorized into safe for work (s), questionable (q) and explicit (e)
Safe for work:                        rating:s
Questionable / unrated:               rating:q
Explicit, not safe for work:          rating:e
The api returns posts up until limit=200 or smaller. The default order is ID, but can also be score, favcount, random, etc
Random order:                         order:random
Random safe image:                    https://danbooru.donmai.us/posts.json?limit=1&tags=order:random+rating:s
Random safe image with low tagcount:  https://danbooru.donmai.us/posts.json?limit=1&tags=order:random+rating:s+tagcount:%3C10

Tags are categorized into copyright tags (series name), artist tags, character tags (names), general tags (features), and metatags (features of the file)
Artist tag:                           arttags:
