kichangkim / deepdanbooru Goto Github PK
View Code? Open in Web Editor NEWAI based multi-label girl image classification system, implemented by using TensorFlow.
License: MIT License
AI based multi-label girl image classification system, implemented by using TensorFlow.
License: MIT License
Hi, um, I get a strange error when I run this command in the console:
python program.py create-project .\test\
Log:
Traceback (most recent call last):
File "program.py", line 5, in <module>
import deepdanbooru.commands
File "C:\Users\User\Desktop\DeepDanbooru-master\deepdanbooru\commands\__init__.py", line 1, in <module>
from .create_project import create_project
File "C:\Users\User\Desktop\DeepDanbooru-master\deepdanbooru\commands\create_project.py", line 15
print(f'New project was successfully created. ({project_path})')
^
SyntaxError: invalid syntax
I have not changed the original files, and as far as I can tell the problem is not in the command, although I have no experience with Python.
I installed all dependencies using pip (globally)
I'm using Python 3.5.2
My system: Windows 10 1909
This here for squeeze_excitation
seems to be incorrect: s
is just getting overwritten in each line since the layers work on x
.
s = x
s = tf.keras.layers.GlobalAveragePooling2D()(s)
s = tf.keras.layers.Dense(output_filters // reduction, activation="relu")(x)
s = tf.keras.layers.Dense(output_filters, activation="sigmoid")(x)
x = tf.keras.layers.Multiply()([x, s])
Hi,
quick question: Are the models provided in the releases section covered under the MIT license as well?
can i know that if i run this programe in spyder ,which py file is given us to run with come out those tag result
The repo in https://github.com/halcy/DeepDanbooruActivationMaps seems very slim, is it posssible to add the notebook into the mainline library for completeness sake, or better yet, improve on the library to allow for custom non-graphical outputs likes arrays and such?
Can it detect r18 features in the pic?
Hi, I have a question, what are json files used for in image folders, and why does a neural network need a database?
And also why these files are needed: tags.txt; tags-character.txt; tags-general.txt
I ask because I downloaded 150K images from sankaku, and 40K from rule34 (All images from the same anime universe).
I'm going to combine them, but the problem is that their tags are different (mostly character names).
I want to bring all the tags to the same type, and I need to know which files to make corrections using the script.
Should I change the values only in the sqlite database? or I need to change the tags values as: tags.txt; tags-character.txt; tags-general.text?
Or do I even include thousands of json files?
deepdanbooru.project.load_project
still loads tags using dd.data.load_tags_from_project
; as far as I can tell this should simply be updated to load_tags_from_project
now that the function has been moved to the project module (other parts of the code were updated to dd.project.load_tags_from_project
, so I'm assuming I'm not missing anything).
I was experimenting with the library and was using commands.evaluate_project
as a template for writing an evaluation function. My code raised an error on dd.project.load_project(project_path)
referencing the noted bug. I applied the mentioned fix and no longer receive the error.
I've made the change on my fork and can open a Pull Request for the change if that's easier for you.
Thanks for making this project by the way!
!python -m deepdanbooru grad-cam model image.png cam.png
File "/content/DeepDanbooru/deepdanbooru/project/project.py", line 27, in load_project
tags = **dd.data.load_tags_from_project(project_path)**
AttributeError: module 'deepdanbooru.data' has no attribute 'load_tags_from_project
tags = load_tags_from_project(project_path)
Hi, I have new questions:
I read that increasing Batchsize leads to improved learning accuracy, is this true?
What exactly is the: minibatch_size parameter responsible for?
Is this a classic Batchsize? or something else?
Now, as for training materials, should I filter them? I mean, I downloaded a huge number of images from booru sites. It contains not only illustrations, but also lineArts, comics, doujinshi, materials with dialogs and text, covers, and so on.
What exactly do I need to remove from the training material? At this point, I'm removing all LineArts, and black and white images.
Hello @KichangKim !
I have a question about learning rate values used for trainig, especially for v3.
As far as I understand the code
"learning_rates": [
{
"used_epoch": 0,
"learning_rate": 5.0
}
]
# Udpate learning rate
for learning_rate_per_epoch in learning_rates:
if learning_rate_per_epoch['used_epoch'] <= int(used_epoch):
learning_rate = learning_rate_per_epoch['learning_rate']
you set learning rate to 5.0 during the first epoch and don't change it anymore.
Do I understand it correclty? If yes, what is the reason for using such a high learning rate? Most of the ResNets I've seen were trained with lr=0.01 or lower.
Hi, I'm trying to test the deepdanbooru on colab. I have upload the deepdanbooru-v1-20191108-sgd-e30.zip and DeepDanbooru-master on 'drive/Colab Notebooks/' as folders, and upload an image in the test folder. The code is as follows:
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse
from google.colab import auth
auth.authenticate_user()
from oauth2client.client import GoogleCredentials
creds = GoogleCredentials.get_application_default()
import getpass
!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
vcode = getpass.getpass()
!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}!mkdir -p drive
!google-drive-ocamlfuse driveimport os
import sys
os.chdir('drive/Colab Notebooks')!pip install tensorflow>=2.1.0
!pip install Click>=7.0
!pip install numpy>=1.16.2
!pip install scikit-image>=2.22.0
!pip install requests>=0.15.0
!pip install six>=1.13.0path = "/content/drive/Colab Notebooks/DeepDanbooru master"
os.chdir(path)!python setup.py install
path = "/content/drive/Colab Notebooks"
os.chdir(path)
!deepdanbooru evaluate deepdanbooru-v1-20191108-sgd-e30 test
However, it stops on the last command and informs as:
Traceback (most recent call last):
File "/usr/local/bin/deepdanbooru", line 11, in
load_entry_point('deepdanbooru==1.0.0', 'console_scripts', 'deepdanbooru')()
File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2852, in load_entry_point
return ep.load()
File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2443, in load
return self.resolve()
File "/usr/local/lib/python3.6/dist-packages/pkg_resources/init.py", line 2449, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/init.py", line 1, in
File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/init.py", line 4, in
File "/usr/local/lib/python3.6/dist-packages/deepdanbooru-1.0.0-py3.6.egg/deepdanbooru/commands/train_project.py", line 6, in
File "/usr/local/lib/python3.6/dist-packages/tensorflow/init.py", line 101, in
from tensorflow_core import *
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/init.py", line 40, in
from tensorflow.python.tools import module_util as _module_util
File "/usr/local/lib/python3.6/dist-packages/tensorflow/init.py", line 50, in getattr
module = self._load()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/init.py", line 44, in _load
module = _importlib.import_module(self.name)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/init.py", line 49, in
from tensorflow.python import pywrap_tensorflow
ImportError: cannot import name 'pywrap_tensorflow'
Could you help me with this problem? Many thanks!
I'm getting OOM on 1050Ti device:GPU:0 with 1331 MB memory
. It's a usual situation for me, because 1.3GB of memory is not enough for training large networks. But in the past I've managed to train small and somewhat middle-sized networks on my GPU.
So, as usual, default training settings of DeepDanbooru cause OOM. I've tried to gradually reduce image size, batch size and tag count, but it didn't help.
Then, just for fun, I've set the following settings:
"image_width": 1,
"image_height": 1,
"minibatch_size": 1,
"epoch_count": 1,
image_records = image_records[0:1]
(dataset size 1, originally there were 5K images)
tf.config.experimental.set_memory_growth(tf.config.get_visible_devices('GPU')[0], True)
# Prefetch was disabled:
#dataset = dataset.prefetch(
# buffer_size=tf.data.experimental.AUTOTUNE)
This resulted in the following model:
Model : (None, 1, 1, 3) -> (None, 4)
and 1 epoch of 1 batch of 1 image:
tf.Tensor([[[[0.8124463 0.76407635 0.8057518 ]]]], shape=(1, 1, 1, 3), dtype=float32) tf.Tensor([[0. 0. 1. 0.]], shape=(1, 4), dtype=float32)
And it still throws an OOM:
2020-04-13 11:02:41.993600: W tensorflow/core/common_runtime/bfc_allocator.cc:424] Allocator (GPU_0_bfc) ran out of memory trying to allocate 1B (rounded to 256). Current allocation summary follows.
2020-04-13 11:02:42.383291: I tensorflow/core/common_runtime/bfc_allocator.cc:970] Stats:
Limit: 1396083507
InUse: 1396083456
MaxInUse: 1396083456
NumAllocs: 13265
MaxAllocSize: 13107200
What else I can reduce to 1, lol, to make this work?
I'm using Python 3.6, CUDA 10.1 and all te requirements installed from the requirements.txt
.
I just spent a while getting ROCm set up to use tensorflow with my AMD GPU. Now that I finally started training the model, it's just been saving a checkpoint for 10 minutes according to the log. Is this normal? Can you explain what the process is and what I should expect to see while training?
EDIT: It got past that after about 15 minutes and then said:
Shuffling samples (epoch 1) ...
Trying to change learning rate to 0.001 ...
Learning rate is changed to <tf.Variable 'learning_rate:0' shape=() dtype=float32, numpy=0.001> ...
Saving checkpoint ... (2021-08-30 23:55:21.722089)
Saving checkpoint ... (2021-08-30 23:55:22.717642)
Saving checkpoint ... (2021-08-30 23:55:23.718639)
Saving checkpoint ... (2021-08-30 23:55:25.234769)
It's going at like 1200MB/s write (I've got a nice bcache'd RAID) with no read, so it's definitely doing something, but I don't know if it should be reading a lot at this point or not.
EDIT2:
Looks like it reads a little...but that write....it's doesn't look right
Not an issue, but a question.
Single image:
time deepdanbooru evaluate /mnt/f/deepdanbooru/sample-460c5595dcf9b07d58f951d349202d98.jpg --model-path /mnt/f/deepdanbooru/deepdanbooru-v3-20200915-sgd-e30.zip/model-resnet_custom_v3.h5 --tags-path /mnt/f/deepdanbooru/deepdanbooru-v3-20200915-sgd-e30.zip/tags.txt --verbose --threshold 0.500 --no-compile
real 0m19.199s
Folder with 14 images:
time deepdanbooru evaluate /mnt/f/deepdanbooru/1/ --model-path /mnt/f/deepdanbooru/deepdanbooru-v3-20200915-sgd-e30.zip/model-resnet_custom_v3.h5 --tags-path /mnt/f/deepdanbooru/deepdanbooru-v3-20200915-sgd-e30.zip/tags.txt --verbose --threshold 0.500 --no-compile --allow-folder
real 0m29.276s
Seems that actual recognition only takes 1 sec/image. But startup takes 20 seconds.
Is there a way to speed this up, or keep deepdanbooru running?
I tried installing hydrus-dd, which uses DeepDanbooru and I got the following error:
ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1ddf0il_/deepdanbooru/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1ddf0il_/deepdanbooru/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-1ddf0il_/deepdanbooru/pip-egg-info cwd: /tmp/pip-install-1ddf0il_/deepdanbooru/ Complete output (5 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-1ddf0il_/deepdanbooru/setup.py", line 12, in <module> version = re.search("__version__ = '([^']+)'", f.read()).group(1) # type: ignore AttributeError: 'NoneType' object has no attribute 'group' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Hi, @KichangKim in your sample code:
https://colab.research.google.com/drive/1BOSYlrWzBHI60NCZF18PIdmwVgsy2tCT
I notice that when I'm evaluating the images, the evaluate code will inform me as:
2020-02-19 06:09:25.243632: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
And the code I'm running is on GPU mode:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.67 Driver Version: 418.67 CUDA Version: 10.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |
| N/A 65C P8 11W / 70W | 0MiB / 15079MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
So does this mean that the evaluate.py is running without CUDA? So could I open CUDA on colab when I'm running it? Many thanks!
Can this project be generalized? I'd like to be able to use it on things like food pictures, text scraping into a tag to make it searchable on threadcaps, etc. I dont really know anything about how to build and modify the script. Figured i'd ask.
It would be easy to break such a system and cause mis-tagging by using these libraries as a demonstration on the weakness of using NN for automated image tagging.
Here are some of my proposals to make it more resilient:
AND THEN THERE IS THIS (claiming that most mitigation strategy fails) https://github.com/anishathalye/obfuscated-gradients
I have talked about something similar in halcy/DeepDanbooruActivationMaps#3
Hello Kim, love your work, I just have a question for you that how many image do you use to to train in Pretrained Model v3?
tensorflow.python.framework.errors_impl.InvalidArgumentError: Got 55 frames, but animated gifs can only be decoded by tf.io.decode_gif or tf.io.decode_image [Op:DecodePng]
When trying to load the v3 or v4 model I get the following error log:
2020-11-06 23:01:33.522590: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
Traceback (most recent call last):
File "C:/Users/someone/PycharmProjects/deep-gelbooru/download_images.py", line 809, in <module>
create_image_with_tags(project)
File "C:/Users/someone/PycharmProjects/deep-gelbooru/download_images.py", line 414, in create_image_with_tags
project_context, model, tags = dd.project.load_project(project)
File "C:\Users\someone\PycharmProjects\deep-gelbooru\deepdanbooru\project\project.py", line 38, in load_project
model = tf.keras.models.load_model(model_path)
File "C:\Users\someone\Anaconda3\envs\deep-gelbooru\lib\site-packages\tensorflow_core\python\keras\saving\save.py", line 146, in load_model
return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
File "C:\Users\someone\Anaconda3\envs\deep-gelbooru\lib\site-packages\tensorflow_core\python\keras\saving\hdf5_format.py", line 168, in load_model_from_hdf5
custom_objects=custom_objects)
File "C:\Users\someone\Anaconda3\envs\deep-gelbooru\lib\site-packages\tensorflow_core\python\keras\saving\model_config.py", line 55, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "C:\Users\someone\Anaconda3\envs\deep-gelbooru\lib\site-packages\tensorflow_core\python\keras\layers\serialization.py", line 106, in deserialize
printable_module_name='layer')
File "C:\Users\someone\Anaconda3\envs\deep-gelbooru\lib\site-packages\tensorflow_core\python\keras\utils\generic_utils.py", line 292, in deserialize_keras_object
config, module_objects, custom_objects, printable_module_name)
File "C:\Users\someone\Anaconda3\envs\deep-gelbooru\lib\site-packages\tensorflow_core\python\keras\utils\generic_utils.py", line 250, in class_and_config_for_serialized_keras_object
raise ValueError('Unknown ' + printable_module_name + ': ' + class_name)
ValueError: Unknown layer: Functional
Using Windows,
tensorflow-gpu: 2.1.0
Click: 7.1.2
numpy: 1.18.5
requests: 2.24.0
scikit-image: 0.16.2
six: 1.15.0
python: 3.6.10
Using the v1 model works fine.
Any ideas what the problem could be ?
2021-09-05 11:47:16.558264: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-09-05 11:47:16.558398: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libamdhip64.so
2021-09-05 11:47:16.764310: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1734] Found device 0 with properties:
pciBusID: 0000:09:00.0 name: Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] ROCm AMDGPU Arch: gfx803
coreClock: 1.286GHz coreCount: 32 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 104.31GiB/s
2021-09-05 11:47:16.816826: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library librocblas.so
2021-09-05 11:47:16.845041: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libMIOpen.so
2021-09-05 11:47:17.046085: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libhipfft.so
2021-09-05 11:47:17.049131: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library librocrand.so
2021-09-05 11:47:17.049283: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2021-09-05 11:47:17.049576: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-09-05 11:47:17.050033: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-09-05 11:47:17.050148: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1734] Found device 0 with properties:
pciBusID: 0000:09:00.0 name: Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] ROCm AMDGPU Arch: gfx803
coreClock: 1.286GHz coreCount: 32 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 104.31GiB/s
2021-09-05 11:47:17.050181: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library librocblas.so
2021-09-05 11:47:17.050206: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libMIOpen.so
2021-09-05 11:47:17.050230: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libhipfft.so
2021-09-05 11:47:17.050253: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library librocrand.so
2021-09-05 11:47:17.050379: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2021-09-05 11:47:17.050739: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-09-05 11:47:17.050750: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0
2021-09-05 11:47:17.050755: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N
2021-09-05 11:47:17.050913: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7700 MB memory) -> physical GPU (device: 0, name: Ellesmere [Radeon RX 470/480/570/570X/580/580X/590], pci bus id: 0000:09:00.0)
WARNING:tensorflow:No training configuration found in the save file, so the model was *not* compiled. Compile it manually.
Tags of /media/da3dsoul/Golias/Media/Pictures/Public/92400803_p4.jpg:
2021-09-05 11:47:20.534415: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:116] None of the MLIR optimization passes are enabled (registered 2)
2021-09-05 11:47:20.554107: I tensorflow/core/platform/profile_utils/cpu_utils.cc:112] CPU Frequency: 3792885000 Hz
2021-09-05 11:47:22.564449: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libMIOpen.so
2021-09-05 11:47:24.485907: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library librocblas.so
Can you help me decipher the meaning of some of this? I can't tell if it actually worked and just didn't have enough training to give tags on the image, or if something got in the way.
The things I would expect to be a problem, if anything, is it not compiling the model or using MLIR optimizations.
I used
deepdanbooru evaluate "/media/da3dsoul/Golias/Media/Pictures/Public/92400803_p4.jpg" --project-path /media/da3dsoul/Golias/DeepDanbooru/unbooru_model/ --allow-gpu --compile
Is it possible to convert the weights for Pytorch?
Hi,
just a short question, what model version does the web version use, and what do you do in case the "Use Cropping" option is enabled?
That option works well with manga pages, so I'm interested in how it works.
Hello !
It's been a while i'm trying to make this run, i had some external help to solve most problems, but i can't find a solution to this :
Using Adam optimizer ...
Loading tags ...
Creating model (resnet_custom_v3) ...
Model : (None, 299, 299, 3) -> (None, 181)
Loading database ...
No checkpoint. Starting new training ... (2021-12-03 20:13:30.093662)
Shuffling samples (epoch 0) ...
Trying to change learning rate to 0.001 ...
Learning rate is changed to <tf.Variable 'learning_rate:0' shape=() dtype=float32, numpy=0.001> ...
Shuffling samples (epoch 1) ...
Trying to change learning rate to 0.001 ...
Learning rate is changed to <tf.Variable 'learning_rate:0' shape=() dtype=float32, numpy=0.001> ...
Shuffling samples (epoch 2) ...
Trying to change learning rate to 0.001 ...
Learning rate is changed to <tf.Variable 'learning_rate:0' shape=() dtype=float32, numpy=0.001> ...
Shuffling samples (epoch 3) ...
Trying to change learning rate to 0.001 ...
Learning rate is changed to <tf.Variable 'learning_rate:0' shape=() dtype=float32, numpy=0.001> ...
Shuffling samples (epoch 4) ...
Trying to change learning rate to 0.001 ...
Learning rate is changed to <tf.Variable 'learning_rate:0' shape=() dtype=float32, numpy=0.001> ...
Shuffling samples (epoch 5) ...
Trying to change learning rate to 0.001 ...
Learning rate is changed to <tf.Variable 'learning_rate:0' shape=() dtype=float32, numpy=0.001> ...
Shuffling samples (epoch 6) ...
Trying to change learning rate to 0.001 ...
Learning rate is changed to <tf.Variable 'learning_rate:0' shape=() dtype=float32, numpy=0.001> ...
Shuffling samples (epoch 7) ...
Trying to change learning rate to 0.001 ...
Learning rate is changed to <tf.Variable 'learning_rate:0' shape=() dtype=float32, numpy=0.001> ...
Shuffling samples (epoch 8) ...
Trying to change learning rate to 0.001 ...
Learning rate is changed to <tf.Variable 'learning_rate:0' shape=() dtype=float32, numpy=0.001> ...
Shuffling samples (epoch 9) ...
Trying to change learning rate to 0.001 ...
Learning rate is changed to <tf.Variable 'learning_rate:0' shape=() dtype=float32, numpy=0.001> ...
Saving model ... (per epoch {export_model_per_epoch})
A:\ANACONDA\envs\deeptag\lib\site-packages\keras\utils\generic_utils.py:494: CustomMaskWarning: Custom mask layers require a config and must override get_config. When loading, the custom mask layer must be passed to the custom_objects argument.
warnings.warn('Custom mask layers require a config and must override '
Saving model ...
Training is complete.
used_epoch=10, used_minibatch=0, used_sample=0
All seems to go well, except it doesn't train... is there a verbose mode or a way to find out what's the problem ? the directories have been checked :
├─dataset
│ │ test21.sqlite
│ │
│ └─images
│ └─00
│ 00000747f1d8598b622bd0d7ad364075.png
│ [...]
└─test17
project.json
tags.txt
And my json :
{
"image_width": 299,
"image_height": 299,
"database_path": "A:\\NN\\DeepTag\\dataset\\test21.sqlite",
"minimum_tag_count": 1,
"model": "resnet_custom_v3",
"minibatch_size": 2,
"epoch_count": 10,
"export_model_per_epoch": 10,
"checkpoint_frequency_mb": 200,
"console_logging_frequency_mb": 10,
"optimizer": "adam",
"learning_rate": 0.001,
"rotation_range": [
0.0,
360.0
],
"scale_range": [
0.9,
1.1
],
"shift_range": [
-0.1,
0.1
],
"mixed_precision": false
}
The tags.txt contains approximately 180 tags that are all in the images (there is no "orphan" tags), all images contains 10~30 tags, and there is 7,7k images (i'm testing it on a reduced dataset first).
Thank you for any help.
PS : here are all the packages and version i have installed in this environment :
_tflow_select 2.3.0 mkl
abseil-cpp 20210324.2 hd77b12b_0
absl-py 0.13.0 py39haa95532_0
aiohttp 3.8.1 py39h2bbff1b_0
aiosignal 1.2.0 pyhd3eb1b0_0
astor 0.8.1 py39haa95532_0
astunparse 1.6.3 py_0
async-timeout 4.0.1 pyhd3eb1b0_0
attrs 21.2.0 pyhd3eb1b0_0
blas 1.0 mkl
blinker 1.4 py39haa95532_0
brotlipy 0.7.0 py39h2bbff1b_1003
ca-certificates 2021.10.26 haa95532_2
cachetools 4.2.2 pyhd3eb1b0_0
certifi 2021.10.8 py39haa95532_0
cffi 1.15.0 py39h2bbff1b_0
charset-normalizer 2.0.4 pyhd3eb1b0_0
clang 5.0 pypi_0 pypi
click 8.0.3 pyhd3eb1b0_0
colorama 0.4.4 pypi_0 pypi
cryptography 3.4.8 py39h71e12ea_0
cycler 0.11.0 pypi_0 pypi
dataclasses 0.8 pyh6d0b6a4_7
deepdanbooru 1.0.0 pypi_0 pypi
flatbuffers 1.12 pypi_0 pypi
fonttools 4.28.2 pypi_0 pypi
frozenlist 1.2.0 py39h2bbff1b_0
gast 0.4.0 pyhd3eb1b0_0
giflib 5.2.1 h62dcd97_0
google-auth 1.33.0 pyhd3eb1b0_0
google-auth-oauthlib 0.4.1 py_2
google-pasta 0.2.0 pyhd3eb1b0_0
grpcio 1.42.0 py39hc60d5dd_0
h5py 3.6.0 py39h3de5c98_0
hdf5 1.10.6 h7ebc959_0
icc_rt 2019.0.0 h0cc432a_1
icu 68.1 h6c2663c_0
idna 3.2 pyhd3eb1b0_0
imageio 2.13.1 pypi_0 pypi
importlib-metadata 4.8.1 py39haa95532_0
intel-openmp 2021.4.0 haa95532_3556
jpeg 9d h2bbff1b_0
keras 2.6.0 pypi_0 pypi
keras-preprocessing 1.1.2 pyhd3eb1b0_0
kiwisolver 1.3.2 pypi_0 pypi
libcurl 7.78.0 h86230a5_0
libpng 1.6.37 h2a8f88b_0
libprotobuf 3.14.0 h23ce68f_0
libssh2 1.9.0 h7a1dbc1_1
markdown 3.3.4 py39haa95532_0
matplotlib 3.5.0 pypi_0 pypi
mkl 2021.4.0 haa95532_640
mkl-service 2.4.0 py39h2bbff1b_0
mkl_fft 1.3.1 py39h277e83a_0
mkl_random 1.2.2 py39hf11a4ad_0
multidict 5.1.0 py39h2bbff1b_2
networkx 2.6.3 pypi_0 pypi
numpy 1.21.2 py39hfca59bb_0
numpy-base 1.21.2 py39h0829f74_0
oauthlib 3.1.1 pyhd3eb1b0_0
openssl 1.1.1l h2bbff1b_0
opt_einsum 3.3.0 pyhd3eb1b0_1
packaging 21.3 pypi_0 pypi
pillow 8.4.0 pypi_0 pypi
pip 21.2.4 py39haa95532_0
protobuf 3.14.0 py39hd77b12b_1
pyasn1 0.4.8 pyhd3eb1b0_0
pyasn1-modules 0.2.8 py_0
pycparser 2.21 pyhd3eb1b0_0
pyjwt 2.1.0 py39haa95532_0
pyopenssl 21.0.0 pyhd3eb1b0_1
pyparsing 3.0.6 pypi_0 pypi
pyreadline 2.1 py39haa95532_1
pysocks 1.7.1 py39haa95532_0
python 3.9.7 h6244533_1
python-dateutil 2.8.2 pypi_0 pypi
pywavelets 1.2.0 pypi_0 pypi
requests 2.26.0 pyhd3eb1b0_0
requests-oauthlib 1.3.0 py_0
rsa 4.7.2 pyhd3eb1b0_1
scikit-image 0.18.3 pypi_0 pypi
scipy 1.7.1 py39hbe87c03_2
setuptools 58.0.4 py39haa95532_0
setuptools-scm 6.3.2 pypi_0 pypi
six 1.16.0 pyhd3eb1b0_0
snappy 1.1.8 h33f27b4_0
sqlite 3.36.0 h2bbff1b_0
tensorboard 2.6.0 py_1
tensorboard-data-server 0.6.0 py39haa95532_0
tensorboard-plugin-wit 1.6.0 py_0
tensorflow 2.6.0 mkl_py39h31650da_0
tensorflow-base 2.6.0 mkl_py39h9201259_0
tensorflow-estimator 2.6.0 pyh7b7c402_0
termcolor 1.1.0 py39haa95532_1
tifffile 2021.11.2 pypi_0 pypi
tomli 1.2.2 pypi_0 pypi
typing-extensions 3.10.0.2 hd3eb1b0_0
typing_extensions 3.10.0.2 pyh06a4308_0
tzdata 2021e hda174b7_0
urllib3 1.26.7 pyhd3eb1b0_0
vc 14.2 h21ff451_1
vs2015_runtime 14.27.29016 h5e58377_2
werkzeug 2.0.2 pyhd3eb1b0_0
wheel 0.35.1 pyhd3eb1b0_0
win_inet_pton 1.1.0 py39haa95532_0
wincertstore 0.2 py39haa95532_2
wrapt 1.12.1 py39h196d8e1_1
yarl 1.6.3 py39h2bbff1b_0
zipp 3.6.0 pyhd3eb1b0_0
zlib 1.2.11 h62dcd97_4
Hi, I'm deeply impressed by your project and want to devote your model to my PyTorch project.
But when I used PyTorch to reproduce your project, my model performs much worse than yours after training. It is only able to predict high-frequency tags such as "solo, 1girl, highres", missing tags such as "blue eyes, green hair". It seems to caused by the long tailed distribution of danbooru dataset, but I cannot fix it.
Have you met similar problems before? Did you solve it with some improvements on loss function or some trianing tricks?
I'm using the model custom deepdanbooru_v3 and danbooru2020 dataset with 7000 one-hot labels.
optimizier, loss function and other settings are the same as your default ones.
Thank you!
A requirements.txt file would be super neat to have. I know you list them in the readme, but it'd be nice to just do a pip install -r requirements.txt
.
First, thanks for your hard work, this repo really inspire me, it might save my life from hundreds hours of tedious work.
You consider accept bitcoin donate? I will send hundreds of dollars worth bitcoin in return.
I want to use DeepDanbooru in actual thing.
Goal is pretty simple, give an image to AI, is the girl wearing black pantyhose? Yes or No.
Can DeepDanbooru able to do that?
I am assuming the answer is yes, I have already upload some images for test, in 90% cases, there will be a pantyhose related tag with high confidence, but in the rest 10% cases, pantyhose tag not even shows.
So I need to train my own model.
I am a programmer, but I never learn anything about AI.
There are still some questions confuse me.
1. Does DeepDanbooru also works on real people?
Your model is trained with millions of anime images, if I use real people images instead, will the model still work without additional problem?
2. Do I need to prepare images set doesn't contains black pantyhose?
I know I need to create a tag named "BlackPantyhose", and connect every images contains black pantyhose with it.
But do I also need to create a tag named "No BlackPantyhose", and it connect every image without black pantyhose?
Such as, scene without people, girl not wearing pantyhose, girl wearing white pantyhose, etc, anyway, if no black pantyhose shows in image, I will connect image to this tag.
So AI can use these images for reference, then might better understand what I am looking for?
I don't know the algorithm behind AI, so this maybe unnecessary?
3.How many images I need to prepare?
You use millions images to train model, but I only need to detect black pantyhose, don't care others at all, do I need to prepare millions images contains black pantyhose too?
Example:
(0.981) 1girl
(0.999) !
(0.969) !!
(1.000) argyle
(1.000) argyle_background
(1.000) argyle_legwear
(0.634) ball
(0.674) bandaid
(0.595) bandaid_on_arm
(0.881) bat_print
(0.554) bathtub
(0.953) bishop_(chess)
(0.872) blonde_hair
(1.000) board_game
(0.664) body_writing
(1.000) checkerboard_cookie
(1.000) checkered
(1.000) checkered_background
(1.000) checkered_flag
(1.000) checkered_floor
(1.000) checkered_kimono
(1.000) checkered_legwear
(0.899) checkered_neckwear
(0.881) checkered_obi
(1.000) checkered_scarf
(1.000) checkered_shirt
(1.000) checkered_skirt
(0.633) cherry
(1.000) chess_piece
(0.935) clown
(0.959) club_(shape)
(0.789) cocktail_glass
(0.994) cookie
(0.999) copyright
(0.990) cow_print
(0.972) crystal
(1.000) diamond_(shape)
(0.730) dice
(1.000) flag
(0.976) floor
(0.984) gohei
(0.968) hairpods
(0.811) halftone_background
(1.000) holding_flag
(0.973) holding_umbrella
(0.890) jester_cap
(1.000) king_(chess)
(1.000) knight_(chess)
(0.643) leopard_tail
(0.956) on_floor
(0.902) one_eye_closed
(0.829) parasol
(1.000) perspective
(1.000) plaid_background
(0.997) plaid_legwear
(0.949) prison_clothes
(0.983) queen_(chess)
(1.000) race_queen
(0.769) red_dress
(0.933) red_eyes
(0.681) red_footwear
(0.556) red_nails
(0.664) red_umbrella
(0.994) reflection
(0.970) reflective_floor
(0.570) restroom
(1.000) rook_(chess)
(0.996) shide
(0.706) shimenawa
(0.573) shoes
(0.618) short_sleeves
(0.804) shower_(place)
(0.852) side_ponytail
(0.527) skull
(0.624) smile
(0.876) soccer
(1.000) soccer_ball
(0.944) solo
(0.910) spade_(shape)
(0.911) spoken_exclamation_mark
(0.737) sticker
(0.940) striped_tail
(1.000) telstar
(0.831) thighhighs
(0.898) tiger
(0.768) tiger_boy
(0.836) tiger_ears
(0.994) tiger_stripes
(0.999) tiger_tail
(1.000) tile_floor
(1.000) tile_wall
(1.000) tiles
(0.885) torn_clothes
(0.671) torn_dress
(0.963) torn_legwear
(0.730) torn_skirt
(0.992) trading_card
(0.998) umbrella
(1.000) vanishing_point
(0.578) wheel
(0.997) wings
(0.995) yagasuri
(0.995) black_rock_shooter_(character)
(0.926) female_saniwa_(touken_ranbu)
(1.000) flandre_scarlet
(0.996) himekaidou_hatate
(0.988) kamado_tanjirou
(0.998) motoori_kosuzu
(0.998) ouma_kokichi
(0.676) saniwa_(touken_ranbu)
(0.796) rating:safe
(0.681) 0_0
(0.777) 1boy
(1.000) 1girl
(0.941) 2010
(1.000) 2021
(1.000) !
(1.000) !!
(0.995) +++
(0.502) :>
(0.732) =3
(0.995) ?
(0.978) adapted_turret
(0.693) after_anal
(0.522) after_vaginal
(0.996) afterimage
(0.531) akeome
(1.000) alice_(alice_in_wonderland)_(cosplay)
(0.795) america
(0.995) ammunition_belt
(0.989) anchor_hair_ornament
(0.690) anchor_print
(0.544) angel_wings
(0.966) animal_nose
(0.668) anime_coloring
(0.950) aqua_background
(0.697) aqua_theme
(1.000) argyle
(1.000) argyle_background
(1.000) argyle_legwear
(0.987) arm_cannon
(0.933) arm_grab
(0.907) arm_guards
(0.867) armband
(0.992) armchair
(0.581) back-seamed_legwear
(0.990) backlighting
(0.867) baggy_clothes
(1.000) ball
(0.954) bandeau
(0.635) bangs
(1.000) bat_print
(0.996) bathroom
(1.000) bathtub
(0.556) bent_over
(0.995) between_legs
(0.974) biceps
(0.813) big_belly
(0.699) bikini
(0.933) bikini_skirt
(1.000) bishop_(chess)
(0.690) black_cape
(1.000) blanket
(0.695) blindfold
(0.994) blue_eyeshadow
(1.000) blue_fire
(0.998) blue_hairband
(0.640) blue_theme
(0.830) blunt_bangs
(0.617) blush
(1.000) board_game
(0.583) book_stack
(0.998) bookshelf
(0.726) boots
(0.674) bow_panties
(0.507) bra
(0.925) bra_lift
(0.675) breast_bondage
(0.948) breast_lift
(0.992) breast_milk
(0.511) breasts
(0.590) brother_and_sister
(0.993) brown_hair
(0.688) bukkake
(0.991) bun_cover
(1.000) burger
(0.999) button_gap
(0.995) calico
(0.688) cameltoe
(0.722) cameo
(0.995) camera_phone
(0.996) camouflage_headwear
(1.000) camouflage_pants
(0.508) candy
(0.978) candy_cane
(0.981) candy_hair_ornament
(0.552) capelet
(1.000) card
(0.556) casual_one-piece_swimsuit
(0.610) cat_hat
(0.936) cat_teaser
(0.904) cephalopod_eyes
(0.986) chained
(0.972) chair
(0.880) champagne
(0.864) champion_uniform
(1.000) chandelier
(0.989) character_sheet
(1.000) checkerboard_cookie
(1.000) checkered
(1.000) checkered_background
(1.000) checkered_flag
(1.000) checkered_floor
(1.000) checkered_kimono
(1.000) checkered_legwear
(1.000) checkered_necktie
(1.000) checkered_neckwear
(1.000) checkered_obi
(1.000) checkered_scarf
(1.000) checkered_shirt
(1.000) checkered_skirt
(0.868) chef
(1.000) cherry
(0.998) cherry_blossoms
(1.000) chess_piece
(0.980) chibi
(0.997) chibi_inset
(1.000) chinese_zodiac
(0.875) cleavage
(0.954) clenched_hands
(0.821) clock
(0.589) clothed_male_nude_female
(0.908) clothed_sex
(0.764) clothes_tug
(0.529) clothes_writing
(0.553) clothing_cutout
(1.000) clown
(1.000) club_(shape)
(1.000) cocktail_glass
(0.947) collarbone
(0.514) color_connection
(1.000) color_guide
(0.741) colored_inner_hair
(0.999) colorful
(1.000) combat_boots
(0.999) company_name
(1.000) compass
(1.000) confetti
(1.000) cookie
(1.000) copyright
(0.999) corded_phone
(0.689) covered_nipples
(1.000) cow
(0.996) cow_ears
(1.000) cow_girl
(1.000) cow_print
(0.895) cowboy_shot
(0.936) creature
(0.981) crescent_moon
(0.943) cropped_jacket
(0.934) cropped_legs
(0.999) cross-laced_legwear
(0.999) crossed_legs
(1.000) crosswalk
(0.982) crotch
(0.999) crystal
(0.999) cube
(0.554) cutting_board
(0.693) dappled_sunlight
(0.973) dark
(0.944) dark-skinned_female
(1.000) deerstalker
(0.974) denim_skirt
(1.000) diamond_(shape)
(1.000) diamond_(symbol)
(1.000) dice
(1.000) different_reflection
(0.994) digital_dissolve
(0.964) drawstring
(0.995) dressing
(0.764) drink
(0.923) drunk
(0.983) duffel_coat
(1.000) elbow_rest
(0.959) expressions
(0.998) eyeball
(0.894) eyebrows_behind_hair
(0.924) eyeshadow
(0.586) eyewear_on_head
(0.925) facial_mark
(0.896) facial_tattoo
(0.993) fake_screenshot
(0.962) father_and_son
(0.707) female_orgasm
(0.998) fish
(1.000) flag
(0.973) flaming_eye
(1.000) floor
(0.983) flower-shaped_pupils
(0.811) foam
(0.909) folding_fan
(0.848) fox_shadow_puppet
(1.000) frilled_bikini
(0.989) frilled_bra
(0.948) fucked_silly
(0.784) fundoshi
(0.623) furrowed_brow
(1.000) gatling_gun
(0.768) gekkoukan_high_school_uniform
(0.561) girl_on_top
(1.000) goblet
(1.000) gohei
(0.964) grabbing
(1.000) green_hakama
(0.999) grey-framed_eyewear
(0.999) grey_sailor_collar
(0.667) hair_between_eyes
(0.989) hair_ornament
(0.571) hair_ribbon
(0.981) hair_spread_out
(1.000) hairpods
(0.630) hakama
(0.545) half-closed_eyes
(0.865) halftone
(1.000) halftone_background
(0.981) handjob
(0.950) happy
(0.650) hat
(0.663) hat_feather
(0.548) hat_ribbon
(0.750) have_to_pee
(0.972) head_back
(0.982) head_chain
(0.933) head_rest
(0.999) headphones
(0.812) heart_eyes
(0.999) heart_lock_(kantai_collection)
(0.934) heart_pasties
(0.954) heart_tattoo
(0.612) highleg_panties
(0.783) holding_card
(0.794) holding_dagger
(1.000) holding_flag
(0.943) holding_fork
(0.975) honeycomb_background
(1.000) houndstooth
(0.991) humanoid_robot
(0.957) indoors
(0.875) infinity
(1.000) jester_cap
(0.958) jewelry
(0.919) k/da_(league_of_legends)
(0.926) katana
(0.978) kerchief
(0.889) keyboard_(instrument)
(1.000) keystone
(0.973) kinchaku
(1.000) king_(chess)
(0.977) kitchen
(0.591) knees_to_chest
(0.567) knees_up
(1.000) knight_(chess)
(0.821) kouhaku_nawa
(0.999) large_bow
(0.512) latex_bodysuit
(0.978) leg_belt
(1.000) leopard_ears
(1.000) leopard_tail
(0.901) licking_nipple
(1.000) lifebuoy
(0.601) light_bulb
(0.861) light_particles
(0.999) limited_palette
(0.746) looking_to_the_side
(0.582) low_ponytail
(0.826) luggage
(0.987) lying
(0.999) machine_gun
(0.905) makeup
(0.703) map
(0.943) marker_(medium)
(0.953) mascara
(0.963) mascot
(0.850) mast
(0.997) mechanical_tail
(0.863) medium_breasts
(1.000) meiji_schoolgirl_uniform
(0.580) microskirt
(0.844) miniskirt
(0.999) mirror
(0.524) moon
(0.920) mop
(0.920) motion_blur
(0.975) motorcycle
(0.570) mouse_ears
(0.746) multicolored_background
(0.951) multicolored_bow
(0.807) multicolored_scarf
(0.732) multiple_piercings
(0.899) music
(0.782) musical_note
(0.939) navel_piercing
(0.946) necktie_grab
(0.897) neckwear_grab
(0.998) nejiri_hachimaki
(0.994) new_school_swimsuit
(0.949) new_year
(0.907) no_nose
(0.966) nose_piercing
(1.000) official_style
(0.950) on_back
(1.000) on_chair
(1.000) on_floor
(1.000) one-hour_drawing_challenge
(1.000) oonusa
(0.942) open_door
(0.616) oral_invitation
(0.801) orange_headwear
(0.991) orange_legwear
(0.974) orange_necktie
(0.998) over_shoulder
(0.949) overalls
(0.996) overcoat
(0.576) oversized_object
(0.929) page_number
(1.000) panda
(0.976) paper_airplane
(0.954) parody
(0.608) partially_visible_vulva
(1.000) pastel_colors
(0.558) person_on_head
(1.000) perspective
(0.999) petals
(1.000) picnic
(0.995) picnic_basket
(0.869) pillarboxed
(0.590) pink_leotard
(0.897) pink_neckerchief
(0.987) pipe
(1.000) pixel_art
(1.000) pixelated
(0.995) pixiv_id
(1.000) plaid_background
(1.000) plaid_legwear
(0.998) plaid_pants
(1.000) playboy_bunny
(1.000) playing_card
(0.864) playing_games
(0.960) playing_instrument
(0.980) pocky
(0.999) pointy_footwear
(1.000) poke_ball_symbol
(1.000) poker_chip
(1.000) pole_dancing
(0.636) polka_dot_headwear
(0.913) polka_dot_ribbon
(0.972) popped_collar
(1.000) pov_across_table
(0.998) power_symbol
(0.653) print_sarong
(1.000) prison_clothes
(0.674) product_placement
(0.992) purple_shorts
(1.000) queen_(chess)
(0.985) rabbit_ears
(0.982) raccoon_tail
(1.000) race_queen
(0.911) raimon_soccer_uniform
(1.000) rainbow_background
(0.945) reading
(0.665) red_choker
(0.764) red_coat
(0.638) red_eyes
(0.963) red_swimsuit
(1.000) reflection
(1.000) reflective_floor
(1.000) restaurant
(1.000) restroom
(1.000) reverse_cowgirl_position
(0.881) ribbed_sleeves
(1.000) rising_sun
(1.000) role_reversal
(1.000) rook_(chess)
(1.000) rope
(0.865) rubbing_eyes
(0.534) sailor_moon_redraw_challenge
(0.958) sandals_removed
(0.819) scar_on_forehead
(0.999) scowl
(0.961) scythe
(0.542) see-through_silhouette
(0.756) self_hug
(0.997) shell_casing
(1.000) shide
(1.000) shimenawa
(0.574) short_hair
(0.904) short_ponytail
(1.000) shower_(place)
(0.609) shushing
(1.000) side_braids
(0.994) sideways
(0.522) signature
(0.800) single_bare_shoulder
(1.000) skeleton
(1.000) sketchbook
(0.935) skull
(0.943) sleeve_cuffs
(0.944) smell
(0.737) smile
(1.000) soap_bottle
(1.000) soccer
(1.000) soccer_ball
(0.986) soccer_uniform
(0.989) solo
(1.000) spade_(shape)
(0.969) sparkle
(0.990) speaker
(0.651) splatter
(1.000) spoken_exclamation_mark
(0.972) spoken_sweatdrop
(0.655) spread_legs
(1.000) sticker
(0.988) straitjacket
(0.784) strapless_bikini
(0.999) striped_hoodie
(1.000) striped_scarf
(1.000) striped_tail
(0.999) stripper_pole
(0.999) sweater_vest
(0.981) sword_of_hisou
(0.928) table
(0.963) tablecloth
(1.000) teardrop
(0.649) teeth
(0.992) television
(1.000) telstar
(0.983) testicles
(1.000) tiger
(1.000) tiger_boy
(1.000) tiger_ears
(1.000) tiger_girl
(1.000) tiger_print
(1.000) tiger_stripes
(1.000) tiger_tail
(1.000) tile_floor
(1.000) tile_wall
(1.000) tiles
(0.874) tire
(0.729) toilet
(0.646) torn_cape
(0.748) torogao
(1.000) trading_card
(0.546) traditional_media
(0.992) traffic_cone
(0.957) tree
(0.905) trembling
(0.891) triforce
(0.981) two-tone_gloves
(0.745) two-tone_hair
(1.000) two-tone_legwear
(0.984) unmoving_pattern
(0.994) used_condom
(1.000) vanishing_point
(0.747) veins
(0.971) veiny_penis
(1.000) violin
(1.000) voyakiloid
(1.000) washing_machine
(0.995) water
(0.755) weibo_username
(0.633) wet_clothes
(0.998) wet_shirt
(1.000) wheel
(0.735) white_hairband
(0.708) white_headwear
(0.562) white_panties
(0.898) white_skin
(1.000) white_tiger
(0.928) widescreen
(1.000) window_shade
(0.822) wings
(1.000) yagasuri
(1.000) year_of_the_ox
(0.937) yellow_apron
(0.999) yellow_bodysuit
(0.587) yellow_hairband
(0.995) yellow_wings
(0.988) yin_yang
(1.000) yokozuwari
(0.599) zombie
(0.939) admiral_(kancolle)
(0.999) african_wild_dog_(kemono_friends)
(1.000) akemi_homura
(0.666) akiyama_yukari
(1.000) akuma_homura
(1.000) alice_(alice_in_wonderland)
(0.607) arch_bishop_(ragnarok_online)
(0.999) atago_(stunning_speedster)_(azur_lane)
(0.675) barnaby_brooks_jr.
(0.889) bb_(swimsuit_mooncancer)_(fate)
(1.000) black_rock_shooter_(character)
(0.637) bruno_buccellati
(1.000) caesar_anthonio_zeppeli
(0.672) celestia_ludenberg
(0.992) common_raccoon_(kemono_friends)
(1.000) dead_master
(0.808) doremy_sweet
(0.938) endou_mamoru
(0.788) failure_penguin
(0.991) fairy_(kancolle)
(1.000) female_saniwa_(touken_ranbu)
(0.918) fubuki_(kancolle)
(0.943) futatsuiwa_mamizou
(0.742) giorno_giovanna
(1.000) gotland_(kancolle)
(1.000) guido_mista
(1.000) himekaidou_hatate
(0.999) hinanawi_tenshi
(0.992) i-class_destroyer
(0.648) inaba_tewi
(0.782) iris_(pokemon)
(0.827) izayoi_sakuya
(0.659) jonathan_joestar
(1.000) joseph_joestar
(0.693) joseph_joestar_(old)
(0.953) joseph_joestar_(young)
(1.000) kamado_tanjirou
(0.624) kanzaki_ranko
(0.745) kazami_yuuka_(pc-98)
(0.913) keebo
(0.984) kijin_seija
(0.853) konno_junko
(0.721) leon_(pokemon)
(1.000) lum
(0.535) megurine_luka
(1.000) motoori_kosuzu
(0.995) nakano_azusa
(0.999) narukami_yuu
(0.981) nazrin
(1.000) nyarlathotep_(nyaruko-san)
(0.773) oozora_subaru
(1.000) ouma_kokichi
(0.615) piers_(pokemon)
(0.882) pramanix_(arknights)
(1.000) saniwa_(touken_ranbu)
(0.966) saria_(arknights)
(0.901) snivy
(1.000) strength_(black_rock_shooter)
(0.675) tippy_(gochiusa)
(0.978) tsuchinoko_(kemono_friends)
(0.798) watanabe_you
(1.000) white_rabbit_(alice_in_wonderland)
(0.999) yowane_haku
download_tags.py, line 31 : request_url = 'http://danbooru.donmai.us/tags.json'
It seems that API cannot be used without HTTPS.
I use the Chrome browser to test whether I use HTTPS or not and find that if I use HTTP, 'ERR_CONNECTION_RESET`. I tried to manually modify download_tags.py. After adding HTTPS to the API address, it returned to normal. I guess danbooru forced HTTPS.
It is because My Picture 's tag output data was totally different compare with your website even the image is a boy, it's tag come out show that the boy and girl 's tag are both equal to 0.5+,it is weird
Hello again !
I've been able to train a model, but now i can't evaluate it, i get this error message :
(deeptag) PS A:\NN\deeptag\deepdanbooru> deepdanbooru evaluate "A:\TEST\" --project-path "A:\NN\DeepTag\test1" --allow-folder
2021-12-05 16:44:56.034612: E tensorflow/stream_executor/cuda/cuda_driver.cc:271] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2021-12-05 16:44:56.040122: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-68LU6C2
2021-12-05 16:44:56.043203: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-68LU6C2
2021-12-05 16:44:56.045541: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Tags of A:\TEST\0beb247119fd16887de4a1feffe37e76.jpg:
Traceback (most recent call last):
File "A:\ANACONDA\envs\deeptag\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "A:\ANACONDA\envs\deeptag\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "A:\ANACONDA\envs\deeptag\Scripts\deepdanbooru.exe\__main__.py", line 7, in <module>
File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\deepdanbooru\__main__.py", line 85, in evaluate
dd.commands.evaluate(target_paths, project_path, model_path, tags_path, threshold, allow_gpu, compile_model, allow_folder, folder_filters, verbose)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\deepdanbooru\commands\evaluate.py", line 74, in evaluate
for tag, score in evaluate_image(image_path, model, tags, threshold):
File "A:\ANACONDA\envs\deeptag\lib\site-packages\deepdanbooru\commands\evaluate.py", line 27, in evaluate_image
result_dict[tag] = y[i]
IndexError: index 181 is out of bounds for axis 0 with size 181
I tried changing versions of CUDA (11.5, 11.2, 11.0, 10.2) and versions of tensorflow-gpu (2.7.0 and 2.6.0)
And the only change i've had was to get this error message instead of the previous one, with tensorflow-gpu 2.6.0
(deeptag) PS A:\NN\deeptag\deepdanbooru> deepdanbooru evaluate "A:\TEST\" --project-path "A:\NN\DeepTag\test1" --allow-folder
2021-12-05 16:10:20.496041: E tensorflow/core/lib/monitoring/collection_registry.cc:77] Cannot register 2 metrics with the same name: /tensorflow/api/keras/optimizers
Traceback (most recent call last):
File "A:\ANACONDA\envs\deeptag\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "A:\ANACONDA\envs\deeptag\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "A:\ANACONDA\envs\deeptag\Scripts\deepdanbooru.exe\__main__.py", line 7, in <module>
File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\deepdanbooru\__main__.py", line 85, in evaluate
dd.commands.evaluate(target_paths, project_path, model_path, tags_path, threshold, allow_gpu, compile_model, allow_folder, folder_filters, verbose)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\deepdanbooru\commands\evaluate.py", line 61, in evaluate
model = dd.project.load_model_from_project(project_path, compile_model=compile_model)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\deepdanbooru\project\project.py", line 43, in load_model_from_project
model = tf.keras.models.load_model(model_path, compile=compile_model)
File "A:\ANACONDA\envs\deeptag\lib\site-packages\tensorflow\python\util\lazy_loader.py", line 62, in __getattr__
module = self._load()
File "A:\ANACONDA\envs\deeptag\lib\site-packages\tensorflow\python\util\lazy_loader.py", line 45, in _load
module = importlib.import_module(self.__name__)
File "A:\ANACONDA\envs\deeptag\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "A:\ANACONDA\envs\deeptag\lib\site-packages\keras\__init__.py", line 25, in <module>
from keras import models
File "A:\ANACONDA\envs\deeptag\lib\site-packages\keras\models.py", line 20, in <module>
from keras import metrics as metrics_module
File "A:\ANACONDA\envs\deeptag\lib\site-packages\keras\metrics.py", line 26, in <module>
from keras import activations
File "A:\ANACONDA\envs\deeptag\lib\site-packages\keras\activations.py", line 20, in <module>
from keras.layers import advanced_activations
File "A:\ANACONDA\envs\deeptag\lib\site-packages\keras\layers\__init__.py", line 23, in <module>
from keras.engine.input_layer import Input
File "A:\ANACONDA\envs\deeptag\lib\site-packages\keras\engine\input_layer.py", line 21, in <module>
from keras.engine import base_layer
File "A:\ANACONDA\envs\deeptag\lib\site-packages\keras\engine\base_layer.py", line 43, in <module>
from keras.mixed_precision import loss_scale_optimizer
File "A:\ANACONDA\envs\deeptag\lib\site-packages\keras\mixed_precision\loss_scale_optimizer.py", line 18, in <module>
from keras import optimizers
File "A:\ANACONDA\envs\deeptag\lib\site-packages\keras\optimizers.py", line 26, in <module>
from keras.optimizer_v2 import adadelta as adadelta_v2
File "A:\ANACONDA\envs\deeptag\lib\site-packages\keras\optimizer_v2\adadelta.py", line 22, in <module>
from keras.optimizer_v2 import optimizer_v2
File "A:\ANACONDA\envs\deeptag\lib\site-packages\keras\optimizer_v2\optimizer_v2.py", line 36, in <module>
keras_optimizers_gauge = tf.__internal__.monitoring.BoolGauge(
File "A:\ANACONDA\envs\deeptag\lib\site-packages\tensorflow\python\eager\monitoring.py", line 360, in __init__
super(BoolGauge, self).__init__('BoolGauge', _bool_gauge_methods,
File "A:\ANACONDA\envs\deeptag\lib\site-packages\tensorflow\python\eager\monitoring.py", line 135, in __init__
self._metric = self._metric_methods[self._label_length].create(*args)
tensorflow.python.framework.errors_impl.AlreadyExistsError: Another metric with the same name already exists.
i'm stuck, i've been on this 2 full days now and i don't get it... (and my internet is super slow, uninstall/reinstall is a pain...)
Do you have exact versions confirmed to work of tensorflow/cuda/cupti/cudnn and such ? or does the problem comes from somewhere else ?
Thank you for your help
I'm going to be honest and say that while I have some programming experience it's not a lot and I haven't ever programmed anything like this, not just in the AI aspect but the parsing either so these may be really stupid questions but I can't find clarification elsewhere. The instructions on the main page indicate that you have to train the network after you download it but is there anyway to just download it pretrained? Using the test website it works more than well enough for my purposes and from what I understand to train it you have to feed it tons of images from danbooru which would take download time, storage space, processor time, etc. Maybe I'm wrong and completely misunderstanding something. I know I'm misunderstanding it to some extent since it sounds like some parts contradict eachother to me but I don't know the extent to which I am. Is there a simpler guide for a stock installation or am I just missing some really simple terminology or understandings that make it click?
Thank you very much.
import deepdanbooru as dd
2022-02-04 16:44:56.755548: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cudart64_110.dll
project_path=r'C:\0\DeepDanbooru\d20211112'
compile_model=False
model = dd.project.load_model_from_project(project_path, compile_model=compile_model )
Traceback (most recent call last):
File "", line 1, in
File "C:\0\pixiv2022\DeepDanbooru\deepdanbooru\project\project.py", line 44, in load_model_from_project
model = tf.keras.models.load_model(model_path, compile=compile_model)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\saving\save.py", line 202, in load_model
compile)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\saving\hdf5_format.py", line 181, in load_model_from_hdf5
custom_objects=custom_objects)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\saving\model_config.py", line 59, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\layers\serialization.py", line 163, in deserialize
printable_module_name='layer')
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 672, in deserialize_keras_object
list(custom_objects.items())))
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 669, in from_config
config, custom_objects)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 1279, in reconstruct_from_config
process_layer(layer_data)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\engine\functional.py", line 1261, in process_layer
layer = deserialize_layer(layer_data, custom_objects=custom_objects)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\layers\serialization.py", line 163, in deserialize
printable_module_name='layer')
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 675, in deserialize_keras_object
deserialized_obj = cls.from_config(cls_config)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 740, in from_config
return cls(**config)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\layers\pooling.py", line 1023, in init
super(GlobalPooling2D, self).init(**kwargs)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\training\tracking\base.py", line 522, in _method_wrapper
result = method(self, *args, **kwargs)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 347, in init
generic_utils.validate_kwargs(kwargs, allowed_kwargs)
File "C:\ProgramData\Miniconda3\envs\tf25\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 1137, in validate_kwargs
raise TypeError(error_message, kwarg)
TypeError: ('Keyword argument not understood:', 'keepdims')
python==3.7.9
cuda==11.3
cudann=8.2.1
tensorflow-gpu==2.5.0
RTX 2080ti windows10
How big is the dataset used to train the model on DeepDanbooru Web?
I did a quick google search on premade Danbooru datasets and they all seemed to be exceptionally large (~3m images, ~2tb in size).
Hi @KichangKim, I've tried the following code to load the newest model on colab:
!git clone https://github.com/KichangKim/DeepDanbooru.git
!pip install -e DeepDanbooru
!pip install tensorflow -U
%env TF_CPP_MIN_LOG_LEVEL=2
!python -m deepdanbooru evaluate test --project-path model --allow-folder
While I notice that the evaluating result is quite different from the demo site:
http://kanotype.iptime.org:8003/deepdanbooru/
The demo site provides far more accurate results than the above codes, while I notice that the web demo might have used the newest pre-trained model.
So would you kindly help me to fix the above code to reproduce the result from the web demo? Many thanks!
first, thx for your awesome project.
Can this model be used to extract features of anime pictures?
If it can, I would like to use it to extract image features and build reverse image search system.
Hello,
first of all, thank you for this awesome project.
I'm interested in training my own model. Unfortunately with the current GPU shortage I can't buy an appropriate GPU for a reasonable price.
However, I have 2 GTX 1060 6GB and could possibly get hold of more.
That got me wondering if it would be possible to train on mutliple GPUs.
I read the documentation of tf.distribute.MirroredStrategy and tried to modify the code of the train_project function similar to how it was done in the example of the TensorFlow docs, but that resulted in 2/3 of the performance of just 1 GPU.
I have to say I'm not at all familiar with neural networks. I get the basic concept, but I never worked with a library like TensorFlow.
Researching the problem I found that for very densely connected neural networks a mirrored strategy might actually hurt performance, because of bandwidth limitations. The NVIDIA X Server Settings show me a peak PCIe bandwidth utilization of around 50%.
The guide on the TensorFlow website claims the tf.distribute.Strategy API can be utilized "with minimal code changes", but I guess that depends and might not be that easy in some cases. When I start the training, the model is loaded into the memory of both GPUs and both GPUs are utilized, but I get a lot of these warnings:
2021-04-22 04:40:35.020293: W tensorflow/core/grappler/optimizers/data/auto_shard.cc:695] AUTO sharding policy will apply DATA sharding policy as it failed to apply FILE sharding policy because of the following reason: Found an unshardable source dataset: name: "TensorDataset/_2"
op: "TensorDataset"
input: "Placeholder/_0"
input: "Placeholder/_1"
attr {
key: "Toutput_types"
value {
list {
type: DT_FLOAT
type: DT_FLOAT
}
}
}
attr {
key: "output_shapes"
value {
list {
shape {
dim {
size: 4
}
dim {
size: 128
}
dim {
size: 128
}
dim {
size: 3
}
}
shape {
dim {
size: 4
}
dim {
size: 8434
}
}
}
}
}
So my question is, do you have an idea why the training on multiple GPUs is so slow? Could it be a problem with how the neural network is architectured or did I do something wrong?
Thanks for your time and effort!
newer model mean more updated tags but is there downside to use earlier network type model?
is the next release v3, v4 or v5?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.