Saltar al contenido
ModelPublicadoExterno
Descargar

Image L Class

基于 EfficientNet 的图片内容分级模型,支持 L1–L4 四级分类。

TipoOtherModelo basetimm/tf_efficientnetv2_m.in21k_ft_in1kVersiónRevision 9d5d858Ccalidad

Fuente del modelo

Tipo
Other
Tamaño del archivo
15,3–101 MB
Modelo base
timm/tf_efficientnetv2_m.in21k_ft_in1k
Versión
vRevision 9d5d858
Actualizado
15 sept 2026
Descargas
0
Fuente
Hugging Face

Descripción de la fuente

Image L-Class — 图片内容分级 (L1–L4)

基于 EfficientNet 的图片内容分级模型,支持 L1–L4 四级分类。

分类标准

等级说明示例
L1轻度性感内容正常身材 + 性感内衣/衣物遮挡下体,姿势正常无性暗示
L2中度性感内容夸张身材 + 衣着性感/较少,姿势有较强性暗示
L3重度性感内容裸露(半裸/全裸),私密部位暴露
L4色情内容明确性行为/性交内容

详细分级标准见 数据准备文档


当前版本:v1.0.2(推荐部署)

项目值
版本v1.0.2
文件efficientNet/V2M/efficientNet-V2M-best-fp16.onnx(同 v1.0.2 权重)
版本归档efficientNet/V2M/efficientNet-V2M-best-fp16-v1.0.2.onnx
架构tf_efficientnetv2_m(timm)
输入尺寸384 × 384
精度FP16(ONNX 输入须 float16)
权重best checkpoint(best.pt → FP16;训练启用 EMA 但本版导出为 best)
大小~101 MB
训练数据~41K(data_36K_v6,40,928 张:v5 基座 + createporn 扩增)
基座从头训练(50 epoch,resume: null)
定位v6 数据集合并重训

训练验证集(data_36K_v6_split/val)

项目值
Overall Acc92.91%(epoch 46,best val acc)
训练 epoch50
最优 epoch46

与 v1.0.1 使用的 data_20K_v3_split/val、data_24K_v4_split/val 为不同划分,Overall 不可直接对比。

数据构成(data_36K_v6)

等级样本数来源
L111,233v5 11,076 + createporn 157
L25,468v5 4,455 + createporn 1,013
L310,838v5 9,040 + createporn 1,798
L413,389v5 8,718 + createporn 4,671
合计40,928v5(data_33K_v5)+ createporn 导出

变更摘要

  • 训练数据合并为 data_36K_v6(v5 + createporn,共 40,928 张)
  • 在 v6 数据上 从头训练 50 epoch(非 v1.0.1 resume)
  • 导出 best_fp16.onnx 作为线上部署权重

ONNX Runtime 推理(V2M v1.0.2)

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

MODEL_PATH = "efficientNet/V2M/efficientNet-V2M-best-fp16.onnx"
IMG_SIZE = 384
CLASS_NAMES = ["L1", "L2", "L3", "L4"]

session = ort.InferenceSession(MODEL_PATH, providers=["CPUExecutionProvider"])
input_name = session.get_inputs()[0].name
input_dtype = np.float16  # FP16 模型必须用 float16 喂入

transform = transforms.Compose([
    transforms.Resize((IMG_SIZE, IMG_SIZE)),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406],
                         std=[0.229, 0.224, 0.225]),
])

img = Image.open("image.jpg").convert("RGB")
input_tensor = transform(img).unsqueeze(0).numpy().astype(input_dtype)

outputs = session.run(None, {input_name: input_tensor})[0]
pred_id = int(np.argmax(outputs, axis=1)[0])
print(f"预测等级: {CLASS_NAMES[pred_id]}")

推理服务(本地)

cd image_L_class_train/tools/inference_server
python app.py \
  --model-path /path/to/efficientNet-V2M-best-fp16.onnx \
  --model-format onnx \
  --img-size 384 \
  --device cpu \
  --port 6006

支持 file / files 上传,以及 JSON/form 字段 image_url。


历史版本:v1.0.1

项目值
训练数据~30.6K(含 ~4K qwen-image-edit)
基座v1.0.0 权重 --resume 微调(40 epoch)
定位L2 / L3 边界档加强
权重EMA(best_ema.pt → FP16)
版本归档efficientNet/V2M/efficientNet-V2M-ema-fp16-v1.0.1.onnx

同集对比(data_20K_v3_split/val,5224 张 @384)

等级v1.0.0v1.0.1Δ
Overall92.99%94.08%+1.09
L1 Recall95.35%96.05%+0.70
L2 Recall86.67%88.30%+1.63
L3 Recall85.54%89.19%+3.65
L4 Recall96.69%96.86%+0.17

训练验证集(data_24K_v4_split/val,6113 张)

等级PrecisionRecall样本数
Overall—96.52%6113
L197.51%97.55%2124
L292.53%93.65%913
L396.45%94.88%1290
L497.44%97.93%1786

历史版本:v1.0.0

项目值
训练数据~26K(Civitai 人工复核)
验证集data_20K_v3_split/val,5224 张
Overall Acc92.99%
等级AccPrecisionRecall样本数
L195.35%94.48%95.35%1848
L286.67%88.32%86.67%855
L385.54%90.56%85.54%740
L496.69%94.56%96.69%1781

历史模型:EfficientNet-B0(轻量版)

项目值
文件efficientNet/B0/efficientNet-B0.onnx
架构EfficientNet-B0
输入尺寸224 × 224(Resize 256 + CenterCrop 224)
精度FP32
大小~14 MB

分类精度(B0 基准)

等级准确率
Overall82.50% (n=1400)
L187.47%
L273.31%
L384.87%
L482.93%

ONNX Runtime 推理(B0)

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

session = ort.InferenceSession("efficientNet/B0/efficientNet-B0.onnx")
input_name = session.get_inputs()[0].name

transform = transforms.Compose([
    transforms.Resize(256),
    transforms.CenterCrop(224),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406],
                         std=[0.229, 0.224, 0.225]),
])

img = Image.open("image.jpg").convert("RGB")
input_tensor = transform(img).unsqueeze(0).numpy()

outputs = session.run(None, {input_name: input_tensor})[0]
pred_id = np.argmax(outputs, axis=1)[0]
class_names = ["L1", "L2", "L3", "L4"]
print(f"预测等级: {class_names[pred_id]}")

权重文件一览

路径大小说明
efficientNet/V2M/efficientNet-V2M-best-fp16.onnx~101 MB当前部署:V2M best FP16 @384 v1.0.2
efficientNet/V2M/efficientNet-V2M-best-fp16-v1.0.2.onnx~101 MBv1.0.2 版本归档(best)
efficientNet/V2M/efficientNet-V2M-ema-fp16.onnx~101 MB遗留指针 → v1.0.1 EMA(勿用于 v1.0.2)
efficientNet/V2M/efficientNet-V2M-ema-fp16-v1.0.1.onnx~101 MBv1.0.1 版本归档(EMA)
efficientNet/B0/efficientNet-B0.onnx~14 MB历史轻量 FP32 @224

训练与继续微调

  • 训练代码:image_L_class_train
  • 框架:timm + PyTorch
  • 线上 badcase 对齐 / 继续微调:见仓库内 docs/上线继续训练.md

部署建议

场景建议
生产V2M FP16 @384 v1.0.2,ONNX Runtime
GPUFP32 ONNX + CUDA(低延迟)
CPUFP16 ONNX;可设 OMP_NUM_THREADS=32
轻量B0 FP32 @224

Fuentes

1 fuente
Hugging FacePrincipalVersión 9d5d85841bfebd51caa034192c0ed678eec45daa
huggingface.co/jiangchengchengNLP/image_l_class/tree/9d5d85841bfebd51caa034192c0ed678eec45daa

Verificado 19 ago

Artefactos del modelo

5 artefactos

efficientNet/B0/efficientNet-B0.onnx

onnx · 15,3 MB · SHA-256 7cd53358d852…b16b · Hugging Face

Descargar

efficientNet/V2M/efficientNet-V2M-best-fp16-v1.0.2.onnx

onnx · 101 MB · SHA-256 429c5f8ad50a…04ad · Hugging Face

Descargar

efficientNet/V2M/efficientNet-V2M-best-fp16.onnx

onnx · 101 MB · SHA-256 429c5f8ad50a…04ad · Hugging Face

Descargar

efficientNet/V2M/efficientNet-V2M-ema-fp16-v1.0.1.onnx

onnx · 101 MB · SHA-256 2e8cc1f49d6e…8a13 · Hugging Face

Descargar

efficientNet/V2M/efficientNet-V2M-ema-fp16.onnx

onnx · 101 MB · SHA-256 2e8cc1f49d6e…8a13 · Hugging Face

Descargar

Extractos de fuentes

2 extractos

--- language: - en - zh tags: - image-classification - efficientnet-v2-m - onnx - fp16 - content-moderation - image-safety - timm - not-for-all-audiences library_name: onnx pipeline_tag: image-classification base_model: timm/tf_efficientnetv2_m.in21k_ft_in1k base_model_relation: finetune model-index: - name: EfficientNet-V2M best FP16 v1.0.2 results: - task: type: image-classification dataset: name: data_36K_v6_split/val type: custom metrics: - name: Accuracy type: accuracy value: 92.91 source: name: image_L_class_train data_36K_v6 url: https://huggingface.co/jiangchengchengNLP/image_l_class --- # Image L-Class — 图片内容分级 (L1–L4) 基于 EfficientNet 的图片内容分级模型,支持 **L1–L4** 四级分类。 ## 分类标准 | 等级 | 说明 | 示例 | |------|------|------| | **L1** | 轻度性感内容 | 正常身材 + 性感内衣/衣物遮挡下体,姿势正常无性暗示 | | **L2** | 中度性感内容 | 夸张身材 + 衣着性感/较少,姿势有较强性暗示 | | **L3** | 重度性感内容 | 裸露(半裸/全裸),私密部位暴露 | | **L4** | 色情内容 | 明确性行为/性交内容 | 详细分级标准见 [数据准备文档](https://huggingface.co/jiangchengchengNLP/image_l_class_efficient/blob/main/docs/数据准备.md) --- ## 当前版本:**v1.0.2**(推荐部署) | 项目 | 值 | |------|-----| | 版本 | **v1.0.2** | | 文件 | `efficientNet/V2M/efficientNet-V2M-best-fp16.onnx`(同 v1.0.2 权重) | | 版本归档 | `efficientNet/V2M/efficientNet-V2M-best-fp16-v1.0.2.onnx` | | 架构 | `tf_efficientnetv2_m`(timm) | | 输入尺寸 | **384 × 384** | | 精度 | **FP16**(ONNX 输入须 `float16`) | | 权重 | **best** checkpoint(`best.pt` → FP16;训练启用 EMA 但本版导出为 best) | | 大小 | ~101 MB | | 训练数据 | **~41K**(`data_36K_v6`,40,928 张:v5 基座 + createporn 扩增) | | 基座 | **从头训练**(50 epoch,`resume: null`) | | 定位 | **v6 数据集合并重训** | ### 训练验证集(`data_36K_v6_split/val`) | 项目 | 值 | |------|-----| | **Overall Acc** | **92.91%**(epoch 46,best val acc) | | 训练 epoch | 50 | | 最优 epoch | 46 | > 与 v1.0.1 使用的 `data_20K_v3_split/val`、`data_24K_v4_split/val` 为不同划分,Overall **不可直接对比**。 ### 数据构成(`data_36K_v6`) | 等级 | 样本数 | 来源 | |------|--------|------| | L1 | 11,233 | v5 11,076 + createporn 157 | | L2 | 5,468 | v5 4,455 + createporn 1,013 | | L3 | 10,838 | v5 9,040 + createporn 1,798 | | L4 | 13,389 | v5 8,718 + createporn 4,671 | | **合计** | **40,928** | v5(`data_33K_v5`)+ createporn 导出 | ### 变更摘要 - 训练数据合并为 **`data_36K_v6`**(v5 + createporn,共 40,928 张) - 在 v6 数据上 **从头训练** 50 epoch(非 v1.0.1 resume) - 导出 `best_fp16.onnx` 作为线上部署权重 ### ONNX Runtime 推理(V2M v1.0.2) ```python import onnxruntime as ort import numpy as np from PIL import Image from torchvision i...

Source context: 0 downloads · 0 likes · Pipeline image-classification · Library onnx · Repo jiangchengchengNLP/image_l_class