ONNX Model Zoo

Timmek/AniCompliance16

By Timmek · ↓ 0 · ♥ 0 · Updated 2025-04-11

What's in this repo

This page lists the files in Timmek/AniCompliance16, including 4gen_ConvNeXt_Large_AniCompliance-16+.onnx.

  • 1 ONNX models (.onnx files)
  • 4 files, including 1 .onnx, 1 .pth, 1 .md
  • Last updated 2025-04-11

ONNX files

File Size Download
4gen_ConvNeXt_Large_AniCompliance-16+.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

Demo https://rkn.aniworldai.org/

image/png

FP32 | 0.2b

# Important! For TensorRT, import tensorrt BEFORE onnxruntime
# import tensorrt

import onnxruntime as ort
import numpy as np
from PIL import Image

def classify_anime_age(image_path, model_path="model.onnx"):
   # Automatic device selection
   providers = []
   available = ort.get_available_providers()
   if 'TensorrtExecutionProvider' in available:  # Nvidia GPU + TensorRT
       providers.append(('TensorrtExecutionProvider', {'trt_fp16_enable': True}))
   if 'CUDAExecutionProvider' in available:      # CUDA
       providers.append('CUDAExecutionProvider')
   if 'OpenVINOExecutionProvider' in available:  # Intel GPU/CPU
       providers.append(('OpenVINOExecutionProvider', {'device_type': 'AUTO'}))
   providers.append('CPUExecutionProvider')      # Any CPU
   
   # Load model
   session = ort.InferenceSession(model_path, providers=providers)
   
   # Prepare image
   img = Image.open(image_path).convert('RGB').resize((512, 512))
   img_array = np.array(img, dtype=np.float32) / 255.0
   img_array = img_array.transpose(2, 0, 1)      # HWC -> CHW
   img_array = np.expand_dims(img_array, axis=0) # NCHW
   
   # Run inference
   outputs = session.run(None, {session.get_inputs()[0].name: img_array})
   
   # Process results (sigmoid for probability)
   prob = 1.0 / (1.0 + np.exp(-outputs[0][0][0]))
   result = "Adult" if prob > 0.5 else "Minor"
   
   return result, prob, session.get_providers()[0]

image/png

image/png

Model info

onnx art legal ru en base_model:timm/convnext_large.fb_in22k_ft_in1k base_model:quantized:timm/convnext_large.fb_in22k_ft_in1k region:us
↓ 0 ♥ 0

Created: 2025-04-11

Updated: 2025-04-11

View on Hugging Face

Files (4)

.gitattributes
4gen_ConvNeXt_Large_AniCompliance-16+.onnx ONNX
4gen_ConvNeXt_Large_anime_age_model.pth
README.md

Related models