animetimm / caformer_s36.dbv4-full

huggingface.co
Total runs: 22
24-hour runs: 12
7-day runs: 12
30-day runs: 20
Model's Last Updated: June 03 2025
image-classification

Introduction of caformer_s36.dbv4-full

Model Details of caformer_s36.dbv4-full

Anime Tagger caformer_s36.dbv4-full

Model Details
  • Model Type: Multilabel Image classification / feature backbone
  • Model Stats:
    • Params: 62.8M
    • FLOPs / MACs: 44.4G / 22.1G
    • Image size: train = 384 x 384, test = 384 x 384
  • Dataset: animetimm/danbooru-wdtagger-v4-w640-ws-full
    • Tags Count: 12476
      • General (#0) Tags Count: 9225
      • Character (#4) Tags Count: 3247
      • Rating (#9) Tags Count: 4
Results
# [email protected] (F1/MCC/P/R) [email protected] (F1/MCC/P/R) Macro@Best (F1/P/R)
Validation 0.503 / 0.514 / 0.594 / 0.465 0.670 / 0.669 / 0.688 / 0.653 ---
Test 0.504 / 0.514 / 0.593 / 0.466 0.670 / 0.669 / 0.688 / 0.653 0.549 / 0.561 / 0.560
  • Macro/[email protected] means the metrics on the threshold 0.40.
  • Macro@Best means the mean metrics on the tag-level thresholds on each tags, which should have the best F1 scores.
Thresholds
Category Name Alpha Threshold Micro@Thr (F1/P/R) [email protected] (F1/P/R) Macro@Best (F1/P/R)
0 general 1 0.37 0.658 / 0.659 / 0.657 0.371 / 0.480 / 0.330 0.425 / 0.431 / 0.451
4 character 1 0.49 0.909 / 0.944 / 0.878 0.880 / 0.914 / 0.854 0.899 / 0.932 / 0.872
9 rating 1 0.39 0.818 / 0.775 / 0.865 0.826 / 0.796 / 0.859 0.827 / 0.801 / 0.857
  • Micro@Thr means the metrics on the category-level suggested thresholds, which are listed in the table above.
  • [email protected] means the metrics on the threshold 0.40.
  • Macro@Best means the metrics on the tag-level thresholds on each tags, which should have the best F1 scores.

For tag-level thresholds, you can find them in selected_tags.csv .

How to Use

We provided a sample image for our code samples, you can find it here .

Use TIMM And Torch

Install dghs-imgutils , timm and other necessary requirements with the following command

pip install 'dghs-imgutils>=0.17.0' torch huggingface_hub timm pillow pandas

After that you can load this model with timm library, and use it for train, validation and test, with the following code

import json

import pandas as pd
import torch
from huggingface_hub import hf_hub_download
from imgutils.data import load_image
from imgutils.preprocess import create_torchvision_transforms
from timm import create_model

repo_id = 'animetimm/caformer_s36.dbv4-full'
model = create_model(f'hf-hub:{repo_id}', pretrained=True)
model.eval()

with open(hf_hub_download(repo_id=repo_id, repo_type='model', filename='preprocess.json'), 'r') as f:
    preprocessor = create_torchvision_transforms(json.load(f)['test'])
# Compose(
#     PadToSize(size=(512, 512), interpolation=bilinear, background_color=white)
#     Resize(size=384, interpolation=bicubic, max_size=None, antialias=True)
#     CenterCrop(size=[384, 384])
#     MaybeToTensor()
#     Normalize(mean=tensor([0.4850, 0.4560, 0.4060]), std=tensor([0.2290, 0.2240, 0.2250]))
# )

image = load_image('https://huggingface.co/animetimm/caformer_s36.dbv4-full/resolve/main/sample.webp')
input_ = preprocessor(image).unsqueeze(0)
# input_, shape: torch.Size([1, 3, 384, 384]), dtype: torch.float32
with torch.no_grad():
    output = model(input_)
    prediction = torch.sigmoid(output)[0]
# output, shape: torch.Size([1, 12476]), dtype: torch.float32
# prediction, shape: torch.Size([12476]), dtype: torch.float32

df_tags = pd.read_csv(
    hf_hub_download(repo_id=repo_id, repo_type='model', filename='selected_tags.csv'),
    keep_default_na=False
)
tags = df_tags['name']
mask = prediction.numpy() >= df_tags['best_threshold']
print(dict(zip(tags[mask].tolist(), prediction[mask].tolist())))
# {'sensitive': 0.6732404828071594,
#  '1girl': 0.9989670515060425,
#  'solo': 0.9742707014083862,
#  'looking_at_viewer': 0.7746273279190063,
#  'blush': 0.7733078002929688,
#  'smile': 0.9283913373947144,
#  'short_hair': 0.7719565033912659,
#  'shirt': 0.47657671570777893,
#  'long_sleeves': 0.6560283303260803,
#  'brown_hair': 0.4212648272514343,
#  'holding': 0.5391519665718079,
#  'dress': 0.5818409323692322,
#  'sitting': 0.7706035375595093,
#  'purple_eyes': 0.7837147116661072,
#  'flower': 0.8481572866439819,
#  'braid': 0.8077557682991028,
#  'sidelocks': 0.228519469499588,
#  'outdoors': 0.4121169447898865,
#  'red_hair': 0.5769475102424622,
#  'blunt_bangs': 0.30574652552604675,
#  'tears': 0.7491690516471863,
#  'crying': 0.3120376467704773,
#  'plant': 0.7737892270088196,
#  'blue_flower': 0.47581613063812256,
#  'crown_braid': 0.6513967514038086,
#  'potted_plant': 0.7279829978942871,
#  'flower_pot': 0.7788273692131042,
#  'wiping_tears': 0.35318365693092346}
Use ONNX Model For Inference

Install dghs-imgutils with the following command

pip install 'dghs-imgutils>=0.17.0'

Use multilabel_timm_predict function with the following code

from imgutils.generic import multilabel_timm_predict

general, character, rating = multilabel_timm_predict(
    'https://huggingface.co/animetimm/caformer_s36.dbv4-full/resolve/main/sample.webp',
    repo_id='animetimm/caformer_s36.dbv4-full',
    fmt=('general', 'character', 'rating'),
)

print(general)
# {'1girl': 0.9989669919013977,
#  'solo': 0.9742707014083862,
#  'smile': 0.9283914566040039,
#  'flower': 0.8481571674346924,
#  'braid': 0.807754635810852,
#  'purple_eyes': 0.783713698387146,
#  'flower_pot': 0.7788212299346924,
#  'looking_at_viewer': 0.7746275663375854,
#  'plant': 0.7737869024276733,
#  'blush': 0.7733079195022583,
#  'short_hair': 0.7719560861587524,
#  'sitting': 0.7706024646759033,
#  'tears': 0.7491673827171326,
#  'potted_plant': 0.7279786467552185,
#  'long_sleeves': 0.6560283899307251,
#  'crown_braid': 0.6513921022415161,
#  'dress': 0.5818408727645874,
#  'red_hair': 0.5769445896148682,
#  'holding': 0.5391532182693481,
#  'shirt': 0.476578027009964,
#  'blue_flower': 0.4758123755455017,
#  'brown_hair': 0.42126381397247314,
#  'outdoors': 0.4121153652667999,
#  'wiping_tears': 0.353171706199646,
#  'crying': 0.3120347261428833,
#  'blunt_bangs': 0.30574560165405273,
#  'sidelocks': 0.22851887345314026}
print(character)
# {}
print(rating)
# {'sensitive': 0.6732401251792908}

For further information, see documentation of function multilabel_timm_predict .

Runs of animetimm caformer_s36.dbv4-full on huggingface.co

22
Total runs
12
24-hour runs
12
3-day runs
12
7-day runs
20
30-day runs

More Information About caformer_s36.dbv4-full huggingface.co Model

More caformer_s36.dbv4-full license Visit here:

https://choosealicense.com/licenses/gpl-3.0

caformer_s36.dbv4-full huggingface.co

caformer_s36.dbv4-full huggingface.co is an AI model on huggingface.co that provides caformer_s36.dbv4-full's model effect (), which can be used instantly with this animetimm caformer_s36.dbv4-full model. huggingface.co supports a free trial of the caformer_s36.dbv4-full model, and also provides paid use of the caformer_s36.dbv4-full. Support call caformer_s36.dbv4-full model through api, including Node.js, Python, http.

caformer_s36.dbv4-full huggingface.co Url

https://huggingface.co/animetimm/caformer_s36.dbv4-full

animetimm caformer_s36.dbv4-full online free

caformer_s36.dbv4-full huggingface.co is an online trial and call api platform, which integrates caformer_s36.dbv4-full's modeling effects, including api services, and provides a free online trial of caformer_s36.dbv4-full, you can try caformer_s36.dbv4-full online for free by clicking the link below.

animetimm caformer_s36.dbv4-full online free url in huggingface.co:

https://huggingface.co/animetimm/caformer_s36.dbv4-full

caformer_s36.dbv4-full install

caformer_s36.dbv4-full is an open source model from GitHub that offers a free installation service, and any user can find caformer_s36.dbv4-full on GitHub to install. At the same time, huggingface.co provides the effect of caformer_s36.dbv4-full install, users can directly use caformer_s36.dbv4-full installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

caformer_s36.dbv4-full install url in huggingface.co:

https://huggingface.co/animetimm/caformer_s36.dbv4-full

Url of caformer_s36.dbv4-full

caformer_s36.dbv4-full huggingface.co Url

Provider of caformer_s36.dbv4-full huggingface.co

animetimm
ORGANIZATIONS

Other API from animetimm