Applications of AI and Computer Vision in Agriculture-Fruit recognition, localization and segmentation
Install dependencies
pip3 install -r requirements.txt
Run setup.py
python3 setup.py install
You can import the modules in Jupyter Notebook (see train_fruit.ipynb) or run it from the command line:
# First enter the Mask_RCNN/samples/fruit directory
# Train a new model starting from pre-trained COCO weights
python3 fruit.py train --dataset=./apples/ --weights=coco --epoch=15
# Resume training a model that you had trained earlier
python3 fruit.py train --dataset=./apples/ --weights=last --epoch=25 --layers='all'
# Train a new model starting from ImageNet weights
python3 fruit.py train --dataset=./apples/ --weights=imagenet
# Train a new model from a arbitrary pre-trained weights
python3 fruit.py train --dataset=./apples/ --weights=path of .h5 files e.g. ./mask_rcnn_coco.h5 --epoch=11 --layers='all'
# There are five arguments for command line: --dataset, --weights, --logs, --epoch, --layers, you can type:
python3 fruit.py --help
# to see each parameter usage.
The inference code are ran on Google Gloud Colaboratory. First upload the Mask_RCNN folder to your google drive, then run the arbitrary .ipynb code file in Mask_RCNN/samples/fruit directory.
The code refers to https://github.com/matterport/Mask_RCNN.