Home

Awesome

MinneApple: A Benchmark Dataset for Apple Detection and Segmentation

This is the code to our paper MinneApple: A Benchmark Dataset for Apple Detection and Segmentation. We provide example scripts for loading data, training Faster RCNN and Mask RCNN on the MinneApple dataset and example evaluation scripts.

<p align="center"> <img src="./imgs/concept.png" width="400"> </p>

Evaluation

As of November 1st, 2019 here are our latest models along with their respective benchmark results.

Apple Detection

MethodBackboneAP @ IoU=.50:.05:.95AP @ IoU=.50AP @ IoU=.74AP_smallAP_mediumAP_large
Tiled Faster RCNNResNet500.3410.6390.3390.1970.5190.208
Faster RCNNResNet500.4380.7750.4550.2970.5780.871
Mask RCNNResNet500.4330.7630.4490.2950.5710.809

Apple Segmentation

MethodBackboneIoUClass IoU (Apple)Pixel AccuracyClass Accuracy (Apple)
Semi-supervised GMM-0.6350.3410.9680.455
User-supervised GMM-0.6490.4550.9590.634
UNet (no pretraining)ResNet500.6780.3970.9600.818
UNet (ImageNet pretraining)ResNet500.6850.4100.9620.848

Apple Counting

MethodBackboneMean Accurracy
GMM-0.816
CNNResNet500.908

Installation

# Install necessary packages
pip install Pillow opencv-python sklearn numpy
git clone https://github.com/nicolaihaeni/MinneApple.git
cd MinneApple

Data Loader

The file data/apple_dataset.py contains a custom dataset class that allows loading images and masks on the fly and extract bounding boxes and segmentation masks. Modify this class accordingly if you need additional inputs to your network.

Training

To train a network on the MinneApple dataset make sure that you download the dataset first from here.

# Train Faster RCNN
python train_rcnn.py --data_path /path/to/MinneApple/dataset --model frcnn --epochs 50 --output-dir /path/to/checkpoint/directory
# Train Mask RCNN
python train_rcnn.py --data_path /path/to/MinneApple/dataset --model mrcnn --epochs 50 --output-dir /path/to/checkpoint/directory

Prediction

To use a model for prediction run the following command:

# Predict for 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
# Predict for 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

Evaluation scripts

To guarantee a fair comparison of your approach with others we have setup codalab competitions for fruit detection, fruit segmentation and fruit counting.

The evaluation servers are result submission only, so make sure to follow the instructions on the respective website. The evaluation scripts on the server closely follow the provided evaluation scripts in this codebase.

Citation

If you use MinneApple or this code base in your work, please cite

@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}
}