アニメスタイルの画像のタグ予測システム。
https://autotagger.donmai.usでお試しください。
または、https://danbooru.donmai.us/ai_tagsにアクセスして、danbooruのすべての投稿で予測されたタグを閲覧します。さまざまなタグの例をいくつか紹介します。
https://danbooru.donmai.us/ai_tags?search [tag_name] = comic&search [Order] = score_desc
https://danbooru.donmai.us/ai_tags?search [tag_name] = hatsune_miku&search [order] = score_desc
https://danbooru.donmai.us/ai_tags?search [tag_name] = cat&search [Order] = score_desc
# Get tags for a single image cat image.jpg | docker run --rm -i ghcr.io/danbooru/autotagger autotag - # Run the web server. Open http://localhost:5000. docker run --rm -p 5000:5000 ghcr.io/danbooru/autotagger # Get tags from the web server. curl http://localhost:5000/evaluate -X POST -F file=@hatsune_miku.jpg -F format=json
アプリサーバーを開始します:
#dockerdocker run -rm -p 5000:5000 ghcr.io/danbooru/autotagher# withodkerpython -m詩Run gunicorn
次に、http:// localhost:5000を開き、WebAppを使用します。ここでは、画像をアップロードして、予測されたタグのリストを表示できます。
上記のようにアプリサーバーを起動してから、次のようにしてください。
curl http:// localhost:5000/evaluate -x post -f file =@hatsune_miku.jpg -f format = json
出力は次のようになります:
[ {"filename": "hatsune_miku.jpg"、 "tags":{"1girl":0.995526671409607、 "hatsune_miku":0.9995216131210327、 "vocaloid":0.998115555555555555555572、 、「Thighhighs」:0.970325767993927、 "long_hair": 0.9630335569381714、「Twintails」:0.9352861046791077、 "very_long_hair":0.8532902002334595、「ネクタイ」:0.8532789945602417 Leeves ":0.796751081943512、" Skirt ":0.7879447340965271、" rating:s ":0.78431481122297058、" aqua_eyes ": 0.6136178374290466、 "zettai_ryouiki":0.561124174499512、 "thigh_boots":0.37453025555794515、 "black_legwear":0.37255123257632611 "0.332613背景 ":0.2878978484573364、" Boots ":0.286143958568573、" Headset ":0.279028445482225403、" White_background ":0.234441512882709503、 「シャツ」:0.21720334887504578、 "looking_at_viewer":0.204636756181717、 "pleated_skirt":0.17705336213111877、 "smile":0.175753361717153168、 "beareds" 9、「ヘッドフォン」:0.16347116231918335、「スタンディング」:0.1511766076087952、 "評価:G":0.13711321353912354、 「aqua_necktie」:0.11798079311847687、 "black_skirt":0.11197035759687424、 "blush":0.10813453793525696} } ]
単一の画像のタグを生成します。
#with docker:cat image.jpg | docker run -rm ghcr.io/danbooru/autotagger autotag-#docker:./ autotag image.jpg
複数の画像のタグを生成します。
#with docker:# `-v $ pwd:/host`は、docker container.docker runの内側に/ホストとして現在のディレクトリをマウントすることを意味します。 Image1.jpg /host/image2.jpg# witdocker:./ autotag image1.jpg image2.jpg
images/
ディレクトリ内のすべての画像のタグを生成します。
#with docker:#「画像」を画像ディレクトリを呼び出すものに変更します。ドッカーrun - rm -v $ pwd/images:/images ghcr.io/danbooru/autotagger autotag/images#docker:./ autotag images/
パターンに一致するディレクトリ内のすべてのファイルのタグを生成します。
画像/ -name '*.jpg' |を見つけます./autotag -i-
CSV形式でタグのリストを生成し、独自のDanbooruインスタンスにインポートするのに適しています。
./autotag -c -f -n images/ | gzip> tags.csv.gz
# Install system dependencies apt-get update apt-get install git build-essential gfortran libatlas-base-dev libffi-dev libssl-dev libbz2-dev liblzma-dev # Get code git clone https://github.com/danbooru/autotagger.git cd autotagger # Install Python (skip this if Python 3.9.13 is already installed) git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.0 echo ". $HOME/.asdf/asdf.sh" >> ~/.bashrc exec bash asdf plugin add python asdf install python 3.9.13 asdf shell python 3.9.13 # Install Python dependencies pip install poetry==1.1.13 python -m poetry env use 3.9 python -m poetry install --no-dev # Download latest model wget https://github.com/danbooru/autotagger/releases/download/2022.06.20-233624-utc/model.pth -O models/model.pth # Test that it works ./autotag test/hatsune_miku.jpg
現在のモデルはストックResNet-152であり、Imagenetで前処理され、その後約10個のエポックでDanbooruで微調整されています。
モデルは約5500タグでトレーニングされています。これには、750を超える投稿を備えた文字タグ、2000を超える投稿の著作権タグ、および2500を超える投稿を含む一般的なタグが含まれますが、アーティストやメタタグは含まれません。評価も含まれています。
このモデルは、https://github.com/danbooru/autotagger/releasesで入手できます。
https://github.com/kichangkim/deepdanbooru
https://github.com/smilingwolf/sw-cv-modelzoo
https://github.com/zyddnys/regdeepdanbooru
https://github.com/rezoo/illustration2vec
https://www.gwern.net/danbooru2021
https://console.cloud.google.com/storage/browser/danbooru_public/data?project=danbooru1(danbooru data dumpss)