Credit
Jul 7th, 2023
modified from SmilingWolf/wd-v1-4-moat-tagger-v2
sha256==8452cddf280b952281b6e102411c50e981cb2908
I use this model for image feature extraction to cluster images https://github.com/WSH032/image-deduplicate-cluster-webui
What did I do?
I adjusted the output of the model to the last four layers.
And change keras to onnx.
Env
Tools here https://github.com/WSH032/wd-v1-4-tagger-feature-extractor-tutorials
Thanks to Colab
onnx == 1.14.0
tf2onnx == 1.14.0
tensorflow == 2.12.0
Detail
Detail about model
# modified from "SmilingWolf/wd-v1-4-moat-tagger-v2"
# 8452cddf280b952281b6e102411c50e981cb2908
# 输入 ['input_1']
# 输出 ['predictions_sigmoid', 'predictions_dense', 'predictions_norm', 'predictions_globalavgpooling'] # 最左边是最外层
[[input]]
name = "input_1" # 原始模型就有
shape = [ "None", 448, 448, 3,]
dtype = "float32"
[[output]]
name = "predictions_sigmoid" # 原始模型就有
shape = [ "None", 9083,]
dtype = "float32"
[[output]]
name = "predictions_dense"
shape = [ "None", 9083,]
dtype = "float32"
[[output]]
name = "predictions_norm"
shape = [ "None", 1024,]
dtype = "float32"
[[output]]
name = "predictions_globalavgpooling"
shape = [ "None", 1024,]
dtype = "float32"
Detail about wd14_tags.toml
It modified from wd-v1-4-moat-tagger-v2/selected_tags.csv
[rating]
means category == 9
in selected_tags.csv
[general]
means category == 0
in selected_tags.csv
[character]
means category == 4
in selected_tags.csv
Detail about candidate_labels_scores_*.npz
import numpy as np
import pandas as pd
import toml
with open("wd14_tags.toml", "r") as f:
general_tags = toml.load(f)["tags"][1]["tags"] # 0 -> rating, 1 -> general, 2 -> characters
with np.load("candidate_labels_scores_safetensors.npz") as data:
candidate_labels = data["candidate_labels"] # Similar to `[candidate_labels]` in `wd14_tags.toml`
scores = data["scores"]
df = pd.DataFrame(
scores,
index=candidate_labels,
columns=general_tags,
)
This score is inferred by sileod/deberta-v3-base-tasksource-nli
sha256 == 6a7865dd24917225ec499fad77e91b97baedf7da