# myapplevisionmodel
**Repository Path**: tzjm/myapplevisionmodel
## Basic Information
- **Project Name**: myapplevisionmodel
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-02-13
- **Last Updated**: 2025-02-13
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# MinneApple: 用于苹果检测和分割的基准数据集
这是我们的论文[MinneApple: 用于苹果检测和分割的基准数据集](https://arxiv.org/abs/1909.06441)的代码。我们提供了用于加载数据、在MinneApple数据集上训练Faster RCNN和Mask RCNN以及示例评估脚本的示例脚本。
## 评估
截至2019年11月1日,这里是我们最新的模型及其相应的基准结果。
### 苹果检测
| 方法 | 骨干网络 | AP @ IoU=.50:.05:.95 | AP @ IoU=.50 | AP @ IoU=.74 | AP_small | AP_medium | AP_large|
|---|---|---|---|---|---|---|---|
| Tiled Faster RCNN | ResNet50 | 0.341 | 0.639 | 0.339 | 0.197 | 0.519 | 0.208 |
| Faster RCNN | ResNet50 | 0.438 | 0.775 | 0.455 | 0.297 | 0.578 | 0.871 |
| Mask RCNN | ResNet50 | 0.433 | 0.763 | 0.449 | 0.295 | 0.571 | 0.809 |
### 苹果分割
### 苹果分割
| 方法 | 骨干网络 | IoU | 类别IoU(苹果) | 像素准确率 | 类别准确率(苹果) |
|---|---|---|---|---|---|
| 半监督GMM | - | 0.635 | 0.341 | 0.968 | 0.455 |
| 用户监督GMM | - | 0.649 | 0.455 | 0.959 | 0.634 |
| UNet(无预训练) | ResNet50 | 0.678 | 0.397 | 0.960 | 0.818 |
| UNet(ImageNet预训练) | ResNet50 | 0.685 | 0.410 | 0.962 | 0.848 |
### 苹果计数
| 方法 | 骨干网络 | 平均准确率 |
|---|---|---|
| GMM | - | 0.816 |
| CNN | ResNet50 | 0.908 |
## 安装
* 设置 Python 3 环境
* 安装 Pytorch(1.0.1 或更高版本)和 TorchVision
* 安装其他一些包:
pip install Pillow opencv-python sklearn numpy
* 克隆此仓库并进入:
git clone https://github.com/nicolaihaeni/MinneApple.git
cd MinneApple
## 数据加载器
文件 `data/apple_dataset.py` 包含一个自定义数据集类,允许动态加载图像和掩码,并提取边界框和分割掩码。如果需要向网络添加额外输入,请相应修改此类。
## 训练
在 MinneApple 数据集上训练网络之前,请确保已从 [这里](https://conservancy.umn.edu/handle/11299/206575) 下载数据集。
* 现在可以使用以下命令训练 Faster RCNN 或 Mask RCNN 网络:
# 训练 Faster RCNN
python train_rcnn.py --data_path /path/to/MinneApple/dataset --model frcnn --epochs 50 --output-dir /path/to/checkpoint/directory
# 训练 Mask RCNN
python train_rcnn.py --data_path /path/to/MinneApple/dataset --model mrcnn --epochs 50 --output-dir /path/to/checkpoint/directory
## 预测
要使用模型进行预测,请运行以下命令:
# 使用 Faster RCNN 进行预测
python predict_rcnn.py --data_path /path/to/MinneApple/dataset --output_file /path/to/which/to/write/the/predictions --weight_file /path/to/a/weight/file --device [one out of: cpu/gpu] --frcnn
# 使用 Mask RCNN 进行预测
python predict_rcnn.py --data_path /path/to/MinneApple/dataset --output_file /path/to/which/to/write/the/predictions --weight_file /path/to/a/weight/file --device [one out of: cpu/gpu] --mrcnn
## 评估脚本
为了确保您的方法与其他方法的公平比较,我们已经在 CodaLab 上设置了针对水果检测、水果分割和水果计数的竞赛。
* 评估服务器仅接受结果提交,请确保按照相应网站上的说明进行操作。
* 服务器上的评估脚本与本代码库中提供的评估脚本非常接近。
## 引用
如果您在工作中使用了 MinneApple 或此代码库,请引用以下文献:
@misc{hani2019minneapple,
title={MinneApple: A Benchmark Dataset for Apple Detection and Segmentation},
author={Nicolai Häni and Pravakar Roy and Volkan Isler},
year={2019},
eprint={1909.06441},
archivePrefix={arXiv},
primaryClass={cs.CV}
}