# ImageClassification-MNIST **Repository Path**: class-project/image-classification-mnist ## Basic Information - **Project Name**: ImageClassification-MNIST - **Description**: 图像分类:MNIST手写数字识别 - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2023-12-25 - **Last Updated**: 2024-01-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 手写数字识别实验-Image Classification(MNIST) --- 通过Lenet和Mobilenet完成手写数字识别任务。 ## 源文件结构 ```bash ├─nets │ ├─lenet.py │ └─mobilenet.py ├─resource │ └─mainwindow.ui ├─utils │ ├─dataloader.py │ ├─device.py │ └─util.py ├─.gitignore ├─requirements.txt ├─demo.py ├─test.py ├─infer.py ├─train.py ├─README.md └─REPORT.md ``` ## 运行 ### 训练网络 ```bash python train.py [--model lenet/mobilenet] [--data_dir] [--batch_size] [--n_epochs] [--test_every_epoch] ``` 训练lenet模型 ```bash python train.py --model lenet ``` 训练mobilenet模型 ```bash python train.py --model mobilenet ``` ### 测试模型 ```bash python test.py [--model lenet/mobilenet] [--data_dir] [--batch_size] ``` 测试lenet模型 ```bash python test.py --model lenet ``` 测试mobilenet模型 ```bash python test.py --model mobilenet ``` ### 推理图像 infer.py提供了使用模型对单张图像进行推理的功能 ```bash python infer.py [--model lenet/mobilenet] [--img_path] ``` ```bash python infer.py --model mobilenet --img_path data/img/0.jpg ``` ### 画板Demo demo.py提供了可视化的交互式操作界面,demo的启动命令如下。 ```bash python demo.py [--model lenet/mobilenet] ``` ```bash python demo.py --model mobilenet ``` UI左侧是一个画板,用于手写数字,右侧显示识别的结果。整个UI采用鼠标进行控制,具体操作如下: - 在画板中按住鼠标左键并移动进行绘制 - 双击鼠标左键清空画板 - 单击鼠标右键进行推理 ![image-20231224104032525](./.assets/image-20231224104032525.png)