rorshark vit base

提供商amunchet
分类image-classification
许可证apache-2.0
下载量913.9K
星标0

简介

rorshark vit base 是一款基于 Vision Transformer (ViT) 架构的图像分类模型。不同于传统的卷积神经网络,它利用 Transformer 的全局注意力机制来捕捉图像特征,在处理复杂视觉模式时具有更强的泛化能力。该模型采用 Apache-2.0 开源协议,对开发者非常友好。对于需要实现自动化标签分类、图像识别或将其作为视觉编码器集成到更大规模多模态项目中的开发者来说,这是一个轻量且高效的选择,上手难度低,可直接替代部分传统的 ResNet 类模型。

核心亮点

  • 基于 ViT 架构,具备强大的全局图像特征捕捉能力
  • Apache-2.0 协议,支持商业化自由部署与二次开发
  • 专注于图像分类任务,可作为高效的视觉特征提取器
  • 模型规模适中,在推理速度与识别精度间取得平衡

使用方法

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

model = AutoModel.from_pretrained("amunchet/rorshark-vit-base")
tokenizer = AutoTokenizer.from_pretrained("amunchet/rorshark-vit-base")

Hugging Face 下载

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

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

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download amunchet/rorshark-vit-base

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

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

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

SDK 下载

SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('amunchet/rorshark-vit-base')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://huggingface.co/amunchet/rorshark-vit-base

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

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/amunchet/rorshark-vit-base

模型文件托管在 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('amunchet/rorshark-vit-base')
tokenizer = AutoTokenizer.from_pretrained('amunchet/rorshark-vit-base')

完整文档

来源: HuggingFace

---
license: apache-2.0
base_model: google/vit-base-patch16-224-in21k
tags:

  • image-classification

  • vision

  • generated_from_trainer

datasets:
  • imagefolder

metrics:
  • accuracy

model-index:
  • name: rorshark-vit-base

results:
- task:
name: Image Classification
type: image-classification
dataset:
name: imagefolder
type: imagefolder
config: default
split: train
args: default
metrics:
- name: Accuracy
type: accuracy
value: 0.9922928709055877
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

rorshark-vit-base

This model is a fine-tuned version of google/vit-base-patch16-224-in21k on the imagefolder dataset.
It achieves the following results on the evaluation set:

  • Loss: 0.0393

  • Accuracy: 0.9923

Model description

More information needed

Intended uses & limitations

More information needed

Training and evaluation data

More information needed

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 2e-05

  • train_batch_size: 8

  • eval_batch_size: 8

  • seed: 1337

  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08

  • lr_scheduler_type: linear

  • num_epochs: 5.0

Training results

| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|:-------------:|:-----:|:----:|:---------------:|:--------:|
| 0.0597 | 1.0 | 368 | 0.0546 | 0.9865 |
| 0.2009 | 2.0 | 736 | 0.0531 | 0.9865 |
| 0.0114 | 3.0 | 1104 | 0.0418 | 0.9904 |
| 0.0998 | 4.0 | 1472 | 0.0425 | 0.9904 |
| 0.1244 | 5.0 | 1840 | 0.0393 | 0.9923 |

Framework versions

  • Transformers 4.36.0.dev0
  • Pytorch 2.1.1+cu118
  • Datasets 2.15.0
  • Tokenizers 0.15.0