mnist-learning/README.md

44 lines
738 B
Markdown
Raw Normal View History

2023-12-29 19:53:46 +08:00
# MNIST 数据集
使用 PyTorch 训练
## 依赖安装
首先根据 [PyTorch 官网](https://pytorch.org/get-started/locally/) 安装 PyTorch以便启用 GPU 加速
然后安装其他依赖
```shell
pip install fastapi uvicorn pillow tqdm
```
## 训练模型
首先你当然要先训练模型啦
```shell
python mnist_train.py --save-model
```
## 使用方法
训练完模型后,本仓库包含两种使用方法,即本地文件和 Web UI
### 本地文件
将图片文件放到 input 文件夹内,必须是 28*28 的灰度png格式然后执行
```shell
python mnist.test.py
```
### Web UI
执行以下命令启动 Web UI
```shell
uvicorn webui:app
```
然后打开 <http://127.0.0.1:8000> 即可看到网页