Downloads · 30 days
2
4% of all-time downloads
zhaospei/Model_16
Model_16 is a machine learning model from zhaospei. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Mô hình này là phiên bản fine-tuned của google/vit-base-patch16-224-in21k trên bộ dữ liệu CIFAR-10 (60.000 ảnh màu 32×32, 10 lớp). Trên tập đánh giá, mô hình đạt: Loss: 0.2564 Accuracy: 97.88
Downloads · 30 days
2
4% of all-time downloads
All-time downloads
49
Public
Repo size
687 MB
Likes
0
Public
Click a slice to open those files.
.bin343 MB · 100%
From the Hugging Face model README
Mô hình này là phiên bản fine-tuned của google/vit-base-patch16-224-in21k trên bộ dữ liệu CIFAR-10 (60.000 ảnh màu 32×32, 10 lớp). Trên tập đánh giá, mô hình đạt: Loss: 0.2564 Accuracy: 97.88
Phân loại ảnh CIFAR-10 (10 lớp như: airplane, automobile, bird, cat, …) Dùng để transfer learning cho các tập dữ liệu nhỏ hơn Làm nền tảng cho các thử nghiệm về fine-tuning ViT trên dữ liệu màu sắc nhỏ
Ảnh màu RGB Thư viện sẽ xử lý bằng ViTImageProcessor: Resize hình về 224×224 Chuẩn hóa theo mean/std của ImageNet
Logits tensor kích thước [batch_size, 10] Dùng argmax(-1) để nhận nhãn dự đoán
pip install torch torchvision transformers
import torch
from transformers import ViTForImageClassification, ViTImageProcessor
from PIL import Image
model_name = "zhaospei/Model_16"
processor = ViTImageProcessor.from_pretrained(model_name)
model = ViTForImageClassification.from_pretrained(model_name)
img = Image.open("path/to/cifar10_image.png").convert("RGB")
inputs = processor(img, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
pred = logits.argmax(-1).item()
label = model.config.id2label[pred]
print(f"Predicted label: {label} (Index: {pred})")
Thiết lập Giá trị Learning rate 5e-5 Batch size (train/eval) 32 / 32 Gradient accumulation 4 Total batch size 128 Optimizer Adam (β=(0.9,0.999), ε=1e-8) Scheduler Learning rate linearly giảm (warmup 0.1) Epochs 1 Seed 42 Framework Transformers 4.17.0, PyTorch 1.10.0+cu111
Báo cáo accuracy đạt 97.88 % trên tập đánh giá CIFAR-10
Thích hợp để đánh giá khả năng áp dụng ViT ở dữ liệu nhỏ và cải tiến nhanh timemodels
Đây là mô hình để demo hoặc baseline, không phù hợp cho trường hợp cần độ chính xác cao hơn (có thể fine-tune thêm)
Dễ dàng kết hợp với các kỹ thuật augment, thêm epochs, hoặc sử dụng data robustness khi cần
Có thể dùng làm backbone để ép nhỏ, kiểm thử OOD, adversarial training, v.v.