Instructions to use print1Username/COS30082-Individual-Assignment.model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use print1Username/COS30082-Individual-Assignment.model with timm:
import timm model = timm.create_model("hf-hub:print1Username/COS30082-Individual-Assignment.model", pretrained=True) - Notebooks
- Google Colab
- Kaggle
Upload README.zh-CN.md
Browse files- README.zh-CN.md +95 -0
README.zh-CN.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- print1Username/COS30082-Assignment-1
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
- zh
|
| 7 |
+
base_model:
|
| 8 |
+
- microsoft/resnet-50
|
| 9 |
+
pipeline_tag: image-classification
|
| 10 |
+
tags:
|
| 11 |
+
- image-classification
|
| 12 |
+
- pytorch
|
| 13 |
+
metrics:
|
| 14 |
+
- accuracy
|
| 15 |
+
library_name: timm
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
<div align="center">
|
| 19 |
+
|
| 20 |
+
[](README.md)
|
| 21 |
+
[](README.zh-CN.md)
|
| 22 |
+
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
# COS30082 Assignment 1 - 鸟类物种分类模型
|
| 26 |
+
|
| 27 |
+
## 模型简介
|
| 28 |
+
|
| 29 |
+
这是一个用于识别 **200 种鸟类**的图像分类模型,基于 **Caltech-UCSD Birds 200(CUB-200)** 数据集训练,是 COS30082 Assignment 1 的课程项目。
|
| 30 |
+
|
| 31 |
+
模型以图像作为输入,并预测图像中鸟类所属的物种类别。
|
| 32 |
+
|
| 33 |
+
## 预期用途与限制
|
| 34 |
+
|
| 35 |
+
- **预期用途:** 学术研究和课程作业,用于根据鸟类图像预测其物种类别。
|
| 36 |
+
- **适用范围:** 模型针对 CUB-200 数据集中的 200 种鸟类进行训练。
|
| 37 |
+
- **限制:** 模型主要适用于数据集中包含的鸟类物种。对于数据集之外的鸟类,或在光照、背景、拍摄角度和图像质量差异较大的情况下,模型的表现可能下降。
|
| 38 |
+
|
| 39 |
+
## 训练数据
|
| 40 |
+
|
| 41 |
+
模型使用 **Caltech-UCSD Birds 200(CUB-200)** 数据集进行训练。该数据集包含 200 种鸟类的图像。
|
| 42 |
+
|
| 43 |
+
- **数据集来源:** [Caltech-UCSD Birds 200](http://www.vision.caltech.edu/visipedia/CUB-200.html)
|
| 44 |
+
- **数据集 Hugging Face 页面:** [print1Username/COS30082-Assignment-1](https://huggingface.co/datasets/print1Username/COS30082-Assignment-1)
|
| 45 |
+
|
| 46 |
+
## 评估结果
|
| 47 |
+
|
| 48 |
+
根据作业提供的测试数据集,模型取得以下评估结果:
|
| 49 |
+
|
| 50 |
+
| 评估指标 | 结果 |
|
| 51 |
+
| --- | ---: |
|
| 52 |
+
| Top-1 准确率 | 78.5% |
|
| 53 |
+
| 各类别平均准确率 | 77.2% |
|
| 54 |
+
|
| 55 |
+
以上结果基于本项目所使用的测试数据集;模型在其他数据集或真实环境中的表现可能有所不同。
|
| 56 |
+
|
| 57 |
+
## 使用方法
|
| 58 |
+
|
| 59 |
+
以下示例展示如何使用 PyTorch 和 `huggingface_hub` 下载模型权重并加载到模型架构中。
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
import torch
|
| 63 |
+
from huggingface_hub import hf_hub_download
|
| 64 |
+
|
| 65 |
+
# 请先定义与训练时一致的模型架构
|
| 66 |
+
# model = MyBirdClassifier()
|
| 67 |
+
|
| 68 |
+
# 下载模型权重
|
| 69 |
+
model_path = hf_hub_download(
|
| 70 |
+
repo_id="print1Username/COS30082-Assignment-1-model",
|
| 71 |
+
filename="bird_model.pth",
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
# 加载权重
|
| 75 |
+
state_dict = torch.load(model_path, map_location="cpu")
|
| 76 |
+
model.load_state_dict(state_dict)
|
| 77 |
+
model.eval()
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
**注意:** 请将 `MyBirdClassifier()` 替换为训练时使用的实际模型架构,并确保模型定义与权重文件匹配。仅有权重文件通常不足以独立重建模型。
|
| 81 |
+
|
| 82 |
+
## 模型信息
|
| 83 |
+
|
| 84 |
+
- **基础模型:** ResNet-50
|
| 85 |
+
- **模型库:** PyTorch / timm
|
| 86 |
+
- **分类类别数:** 200
|
| 87 |
+
- **项目:** COS30082 Assignment 1
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
<div align="center">
|
| 92 |
+
|
| 93 |
+
**语言切换:** [English](README.md) · [简体中文](README.zh-CN.md)
|
| 94 |
+
|
| 95 |
+
</div>
|