gender classification

提供商rizvandwiki
分类image-classification
许可证Apache-2.0
下载量1.5M
星标0

简介

这是一个轻量级的图像分类模型,专注于识别图片中的人物性别。对于需要快速处理用户头像、自动化标签分类或进行人口统计分析的开发者来说,它提供了一种低成本的自动化方案。该模型上手门槛极低,无需复杂的调优即可通过 API 或本地部署实现快速推理。相比于通用的大型多模态模型,它在单一任务上响应更快,适合集成到对实时性要求较高的业务流程中,作为图像预处理的一个环节。

核心亮点

  • 专注性别识别,推理速度快且资源占用低
  • 适配 Apache-2.0 协议,商业集成灵活
  • 无需复杂配置,适合快速搭建自动化分类流
  • 可作为通用视觉模型的前置过滤工具

使用方法

安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("rizvandwiki/gender-classification")
tokenizer = AutoTokenizer.from_pretrained("rizvandwiki/gender-classification")

Hugging Face 下载

我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 huggingface_hub:

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download rizvandwiki/gender-classification

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download rizvandwiki/gender-classification config.json --local-dir ./dir

更多命令行下载选项,可参见官方文档

SDK 下载

SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('rizvandwiki/gender-classification')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://huggingface.co/rizvandwiki/gender-classification

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/rizvandwiki/gender-classification

模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。

PyTorch / Transformers 使用

安装 Transformers

安装 Transformers
pip install -U transformers torch

模型加载和推理

模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('rizvandwiki/gender-classification')
tokenizer = AutoTokenizer.from_pretrained('rizvandwiki/gender-classification')

完整文档

来源: HuggingFace

---
tags:

  • image-classification

  • pytorch

  • huggingpics

metrics:
  • accuracy

model-index:

  • name: gender-classification

results:
- task:
name: Image Classification
type: image-classification
metrics:
- name: Accuracy
type: accuracy
value: 0.9244444370269775
---

gender-classification

Autogenerated by HuggingPics🤗🖼️

Create your own image classifier for anything by running the demo on Google Colab.

Report any issues with the demo at the github repo.

Example Images

#### female

!female

#### male

!male