动漫风格图像的标签预测系统。
在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 [orderd]
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/autotagger#无dockerpython -m诗歌运行gunicorn
然后打开http:// localhost:5000用于使用WebApp。在这里,您可以上传图像并查看预测标签的列表。
如上所述启动应用程序服务器,然后执行:
curl http:// localhost:5000/evaluate -x post -f file =@hatsune_miku.jpg -f格式= json
输出看起来像这样:
[ {“ filename”:“ hatsune_miku.jpg”,“标签”:{“ 1girl”:0.99995526671409607,“ hatsune_miku”:0.999521616131210327, ,“大腿”:0.970325767993927,“ long_hair”: 0.963035569381714,“ twintails”:0.9352861046791077,“ heyte_long_hair”:0.853290200234595 eves“:0.796751081943512,“裙子”:0.7879447340965271,“评级:S”:0.7843148112297058,“ aquaa_eyes”: 0.6136178374290466,“ zettai_ryouiki”:0.5611224174499512,“ thigh_boots”:0.3745302579452515,“ _background“:0.28789788484573364,“靴子”:0.286143958568573,“耳机”:0.27902844548225403,“ White_background”:0.234441512882709503,“ “衬衫”:0.2172034887504578,“ fooke_at_viewer”:0.2044636756181717,“ pleated_skirt”:0.17705336213111877,“微笑” 9,“耳机”:0.16347116231918335,“站立”:0.155511766076087952,“评分:G”:0.13711321353912354, “ aqua_necktie”:0.11798079311847687,“ black_skirt”:0.11197035759687424,“ Blush”:0.10813453793525696} } 这是给出的
生成单个图像的标签:
#与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 -rm -v $ pwd:/host ghcr.io/danbooru/autotagger autotag autotag/host/host/host/host/host/ image1.jpg/host/image2.jpg#没有docker:./ autotag image1.jpg image2.jpg
为images/
目录中的所有图像生成标签:
#与Docker:#更改图像目录的任何称为toce.docker run -rm -v $ pwd/images:/images ghcr.io/danbooru/autotagger autotagg autotag/autotag/images note docker note docker:./ autotag Images/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上预估计,然后在Danbooru上进行了大约10个时期。
该模型在约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 umps)