Downloads · 30 days
15
13% of all-time downloads
Jaysaly/cornlarva_convnextv2
cornlarva_convnextv2 is a image classification model from Jaysaly. Use it when you need a label for an image. The card lists the license as mit.
这是一个基于ConvNextV2架构训练的玉米害虫图像分类模型,专门用于识别8种常见玉米害虫。
Downloads · 30 days
15
13% of all-time downloads
All-time downloads
114
Public
Parameters
89.8M
359 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors359 MB · 100%
From the Hugging Face model README
这是一个基于ConvNextV2架构训练的玉米害虫图像分类模型,专门用于识别8种常见玉米害虫。
[ "草地贪夜蛾", "赤须盲蝽", "点蜂缘蝽", "龟纹瓢虫", "棉铃虫", "茄二十八星瓢虫", "双斑长跗萤叶甲", "玉米螟" ]
from transformers import AutoImageProcessor, AutoModelForImageClassification
import torch
from PIL import Image
# 加载模型和处理器
model_name = "Jaysaly/cornlarva_convnextv2"
processor = AutoImageProcessor.from_pretrained(model_name)
model = AutoModelForImageClassification.from_pretrained(model_name)
# 准备图像
image = Image.open("path_to_image.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
# 推理
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicted_class_idx = logits.argmax(-1).item()
# 获取预测结果
predicted_label = model.config.id2label[str(predicted_class_idx)]
print(f"预测结果: {predicted_label}")
import requests
API_URL = "https://api-inference.huggingface.co/models/Jaysaly/cornlarva_convnextv2"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
def query(image_bytes):
response = requests.post(API_URL, headers=headers, data=image_bytes)
return response.json()
在验证集上的Top-1准确率: ~95%
Jaysaly
MIT License