animetimm / swinv2_base_window8_256.dbv4-full-witha

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

Introduction of swinv2_base_window8_256.dbv4-full-witha

Model Details of swinv2_base_window8_256.dbv4-full-witha

Anime Tagger swinv2_base_window8_256.dbv4-full-witha

Model Details
  • Model Type: Multilabel Image classification / feature backbone
  • Model Stats:
    • Params: 109.7M
    • FLOPs / MACs: 121.6G / 60.7G
    • Image size: train = 448 x 448, test = 448 x 448
  • Dataset: animetimm/danbooru-wdtagger-v4-w640-ws-full-witha
    • Tags Count: 22298
      • General (#0) Tags Count: 9357
      • Artist (#1) Tags Count: 9480
      • Character (#4) Tags Count: 3457
      • 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.628 / 0.637 / 0.701 / 0.599 0.685 / 0.684 / 0.675 / 0.695 ---
Test 0.628 / 0.638 / 0.702 / 0.598 0.685 / 0.685 / 0.676 / 0.695 0.677 / 0.718 / 0.667
  • 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.41 0.671 / 0.667 / 0.676 0.417 / 0.469 / 0.402 0.455 / 0.456 / 0.483
1 artist 1 0.41 0.789 / 0.869 / 0.723 0.737 / 0.859 / 0.681 0.808 / 0.894 / 0.763
4 character 1 0.6 0.927 / 0.951 / 0.903 0.900 / 0.905 / 0.900 0.920 / 0.944 / 0.902
9 rating 1 0.42 0.829 / 0.796 / 0.865 0.834 / 0.804 / 0.868 0.836 / 0.810 / 0.864
  • 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/swinv2_base_window8_256.dbv4-full-witha'
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=448, interpolation=bicubic, max_size=None, antialias=True)
#     CenterCrop(size=[448, 448])
#     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/swinv2_base_window8_256.dbv4-full-witha/resolve/main/sample.webp')
input_ = preprocessor(image).unsqueeze(0)
# input_, shape: torch.Size([1, 3, 448, 448]), dtype: torch.float32
with torch.no_grad():
    output = model(input_)
    prediction = torch.sigmoid(output)[0]
# output, shape: torch.Size([1, 22298]), dtype: torch.float32
# prediction, shape: torch.Size([22298]), 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())))
# {'general': 0.9218264818191528,
#  'long_hair': 0.8617217540740967,
#  'looking_at_viewer': 0.6087620854377747,
#  'blush': 0.8194699287414551,
#  'smile': 0.7942238450050354,
#  'open_mouth': 0.6477962732315063,
#  'shirt': 0.5871002674102783,
#  'blue_eyes': 0.8884249329566956,
#  'multiple_girls': 0.989618718624115,
#  'long_sleeves': 0.5353618264198303,
#  'brown_hair': 0.8567362427711487,
#  'black_hair': 0.9784889221191406,
#  'hair_ornament': 0.7076285481452942,
#  'closed_mouth': 0.7080296277999878,
#  'bow': 0.5767548680305481,
#  'hair_between_eyes': 0.7296777963638306,
#  'ribbon': 0.7851208448410034,
#  'jacket': 0.7861509323120117,
#  'twintails': 0.7923949360847473,
#  'white_shirt': 0.40748366713523865,
#  'medium_breasts': 0.4460415542125702,
#  'green_eyes': 0.9238812327384949,
#  'school_uniform': 0.9403164386749268,
#  'upper_body': 0.6293675899505615,
#  'yellow_eyes': 0.7571271061897278,
#  'multicolored_hair': 0.9546223282814026,
#  'pink_hair': 0.8180018067359924,
#  'sidelocks': 0.5729357600212097,
#  'hair_bow': 0.5830323100090027,
#  'collared_shirt': 0.6518788933753967,
#  'green_hair': 0.8949645161628723,
#  'medium_hair': 0.7911376357078552,
#  'hairclip': 0.6503432989120483,
#  'blunt_bangs': 0.3833540678024292,
#  'speech_bubble': 0.5847594141960144,
#  'hair_bun': 0.8585909008979797,
#  'black_jacket': 0.8354110717773438,
#  'two-tone_hair': 0.46723976731300354,
#  'red_bow': 0.7785623073577881,
#  'grey_eyes': 0.8497334122657776,
#  'red_ribbon': 0.5991357564926147,
#  'v-shaped_eyebrows': 0.3285539150238037,
#  'border': 0.47807320952415466,
#  'neck_ribbon': 0.7679146528244019,
#  'gradient_hair': 0.8827264904975891,
#  'swept_bangs': 0.3612409830093384,
#  '4girls': 0.9509821534156799,
#  'one_side_up': 0.6597328782081604,
#  'white_border': 0.532529354095459,
#  'crossed_arms': 0.6533893942832947,
#  'cover': 0.8216056823730469,
#  '?': 0.8707193732261658,
#  'musical_note': 0.9128340482711792,
#  'cover_page': 0.8051306009292603,
#  'outline': 0.5144034624099731,
#  '!': 0.9172455072402954,
#  'half_updo': 0.941903829574585,
#  'doujin_cover': 0.4625090956687927,
#  'winter_uniform': 0.8833600878715515,
#  'white_outline': 0.6181722283363342,
#  'single_side_bun': 0.847456693649292,
#  'spoken_question_mark': 0.8506443500518799,
#  'spoken_exclamation_mark': 0.9253754615783691,
#  'spoken_musical_note': 0.8720793724060059,
#  'nijigasaki_school_uniform': 0.818751871585846,
#  'yuki_setsuna': 0.955053448677063,
#  'uehara_ayumu': 0.9783639311790466,
#  'takasaki_yu': 0.9188328981399536,
#  'osaka_shizuku': 0.8943168520927429}
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, artist, character, rating = multilabel_timm_predict(
    'https://huggingface.co/animetimm/swinv2_base_window8_256.dbv4-full-witha/resolve/main/sample.webp',
    repo_id='animetimm/swinv2_base_window8_256.dbv4-full-witha',
    fmt=('general', 'artist', 'character', 'rating'),
)

print(general)
# {'multiple_girls': 0.9896187782287598,
#  'black_hair': 0.9784889221191406,
#  'multicolored_hair': 0.9546222686767578,
#  '4girls': 0.9509822130203247,
#  'half_updo': 0.9419039487838745,
#  'school_uniform': 0.940316379070282,
#  'spoken_exclamation_mark': 0.9253759384155273,
#  'green_eyes': 0.9238814115524292,
#  '!': 0.9172458648681641,
#  'musical_note': 0.9128341674804688,
#  'green_hair': 0.8949645757675171,
#  'blue_eyes': 0.8884252309799194,
#  'winter_uniform': 0.8833599090576172,
#  'gradient_hair': 0.8827265501022339,
#  'spoken_musical_note': 0.8720798492431641,
#  '?': 0.8707190752029419,
#  'long_hair': 0.8617217540740967,
#  'hair_bun': 0.8585906028747559,
#  'brown_hair': 0.8567360639572144,
#  'spoken_question_mark': 0.8506441116333008,
#  'grey_eyes': 0.8497333526611328,
#  'single_side_bun': 0.8474563360214233,
#  'black_jacket': 0.8354111313819885,
#  'cover': 0.821605920791626,
#  'blush': 0.8194700479507446,
#  'nijigasaki_school_uniform': 0.8187518119812012,
#  'pink_hair': 0.8180019855499268,
#  'cover_page': 0.8051306009292603,
#  'smile': 0.7942242622375488,
#  'twintails': 0.7923948168754578,
#  'medium_hair': 0.7911379337310791,
#  'jacket': 0.786151111125946,
#  'ribbon': 0.7851210832595825,
#  'red_bow': 0.7785626649856567,
#  'neck_ribbon': 0.7679146528244019,
#  'yellow_eyes': 0.757127046585083,
#  'hair_between_eyes': 0.7296783924102783,
#  'closed_mouth': 0.7080299854278564,
#  'hair_ornament': 0.7076290249824524,
#  'one_side_up': 0.6597331762313843,
#  'crossed_arms': 0.6533896923065186,
#  'collared_shirt': 0.651878833770752,
#  'hairclip': 0.6503437757492065,
#  'open_mouth': 0.6477963328361511,
#  'upper_body': 0.6293678283691406,
#  'white_outline': 0.618173360824585,
#  'looking_at_viewer': 0.6087625622749329,
#  'red_ribbon': 0.5991360545158386,
#  'shirt': 0.5871002078056335,
#  'speech_bubble': 0.5847594738006592,
#  'hair_bow': 0.5830323100090027,
#  'bow': 0.5767549276351929,
#  'sidelocks': 0.5729360580444336,
#  'long_sleeves': 0.5353617072105408,
#  'white_border': 0.5325303077697754,
#  'outline': 0.5144045352935791,
#  'border': 0.4780738353729248,
#  'two-tone_hair': 0.4672397971153259,
#  'doujin_cover': 0.46250927448272705,
#  'medium_breasts': 0.44604194164276123,
#  'white_shirt': 0.4074837863445282,
#  'blunt_bangs': 0.3833542466163635,
#  'swept_bangs': 0.3612416982650757,
#  'v-shaped_eyebrows': 0.32855379581451416}
print(artist)
# {}
print(character)
# {'uehara_ayumu': 0.9783639907836914,
#  'yuki_setsuna': 0.9550533294677734,
#  'takasaki_yu': 0.9188326597213745,
#  'osaka_shizuku': 0.8943172693252563}
print(rating)
# {'general': 0.9218265414237976}

For further information, see documentation of function multilabel_timm_predict .

Runs of animetimm swinv2_base_window8_256.dbv4-full-witha on huggingface.co

0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About swinv2_base_window8_256.dbv4-full-witha huggingface.co Model

More swinv2_base_window8_256.dbv4-full-witha license Visit here:

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

swinv2_base_window8_256.dbv4-full-witha huggingface.co

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

swinv2_base_window8_256.dbv4-full-witha huggingface.co Url

https://huggingface.co/animetimm/swinv2_base_window8_256.dbv4-full-witha

animetimm swinv2_base_window8_256.dbv4-full-witha online free

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

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

https://huggingface.co/animetimm/swinv2_base_window8_256.dbv4-full-witha

swinv2_base_window8_256.dbv4-full-witha install

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

swinv2_base_window8_256.dbv4-full-witha install url in huggingface.co:

https://huggingface.co/animetimm/swinv2_base_window8_256.dbv4-full-witha

Url of swinv2_base_window8_256.dbv4-full-witha

swinv2_base_window8_256.dbv4-full-witha huggingface.co Url

Provider of swinv2_base_window8_256.dbv4-full-witha huggingface.co

animetimm
ORGANIZATIONS

Other API from animetimm