Using OpenVino and OAK-D combined, we will train an object detection model(PyTorch) to identify all types of insect pests for cocoa trees, to identify the symptoms and signs present on each part of the cocoa tree (leaves, pods, stems, etc.).
30 to 40% of the world's annual cocoa production is lost due to insects and pathologies. This represents around 558,000 tones out of a total of over 3.9 million annual production. Cocoa is produced mainly by developing countries, which do not have the appropriate technology to ensure its healthy and sustainable production. How to use artificial intelligence to detect insects and pathologies harmful to cocoa production?
The first phase consists to build a detector model to detect the two main cocoa pathologies present in Africa (black pod root and pod borer). Then deploy the model into OAK-D device.
We choose Pytorch as framework because of the flexibility. It is easy to customize pre-trained models and train on custom datasets. Our goal is to detect disease symptoms on cocoa pod. To do that we will perform instance segmentation with mask on images. The best model to perform this task is the Mask RCNN model from Torchvision. We will re-train this model on ours datasets.
The first step of this phase consist of data preparation. To train our model, we need a set of images of cocoa pod.
We have collected data from Google image and from Kaggle cocoa diseases dataset. Our dataset has the following characteristics:
- A sample for each category : 3344 images of healthy cocoa pod, 943 images of cocoa pod with black pod rot, 103 images of cocoa pod with pod borer
- Total of 4390 images
- Image size 310801080
For data annotation, we used SuperAnnotation tool and polygon annotation technic.
At the end of this step we have a dataset of 2435 annotated images. We also split the dataset as:
- 80% for training (1930 images)
- 20% for validation (506 images) We exported our dataset in COCO format.
You will find the notebook containing the code for loading the data, training loop, validation and test by following this link
Pytorch documentation & tutorial: https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html Depthai Documentation : https://docs.luxonis.com/en/latest/#depthai-s-documentation Kaggle dataset: https://www.kaggle.com/zaldyjr/cacao-diseases Tensorflow images segmentation tutorial : https://www.tensorflow.org/tutorials/images/segmentation Learn OpenCV tutorials : https://learnopencv.com/mask-r-cnn-instance-segmentation-with-pytorch/ Udacity course : https://www.udacity.com/course/intel-edge-ai-for-iot-developers-nanodegree--nd131






