Lemon quality control dataset

Application of Computer Vision in fruit quality control.

    SHARE

Background

SoftwareMill in cooperation with Amplus, a Polish producer and distributor of fresh fruits and vegetables, decided to tackle the important issue of food quality. We’ve started from a series of experiments regarding using computer vision in quality check of fruits.

Team

  • 2

Duration

  • 1 month

Team role

  • Senior Machine Learning Developers

Industry

  • Food

Technology

  • Python

Methodology

We’ve collected nine packages, each containing lemons divided by skilled quality controllers into different categories. The quality of a lemon depends on such features as: color, shape, texture, lack of greening, blemishes, scars, diseases and mold. Single package contained healthy lemons or those that have only one of the flaws indicated earlier. For the sake of simplicity we’ve decided that defective items should be homogeneous i.e. contain only a single flaw. This is going to help us in the future to precisely identify the defect against the background of healthy lemon tissue.

The process

After carefully checking the package and verifying whether the classification is correct we started designing our DIY photo station. We knew that time is short and to avoid the risk of lemons rotting before capturing a photo in the relevant category we had to be ready as soon as possible with our setup. As a consequence we decided to use as simple components as possible. We ended up with a hexa base rotate kit, powered by Arduino UNO. We used a mobile phone camera exposed through http by IP Webcam application and an LCD monitor as a background. Features of the photo platform are simple. You can control its rotation by sending relevant commands via serial port from your PC to Arduino. We coded a simple routine that takes twelve photos of a single lemon from different angles and sends them to the cloud.

After we acquired a decent sample from each category we proceeded with annotating our raw images. The task was to identify regions of fruits in the image. For the purpose of this task we’ve used VIA annotation tool.

We used this data to train an PSPNet (Inception-V3 backbone with ImageNet pretrained weights). PSPNet is a neural network architecture which is commonly used for semantic segmentation. Segmentation is a process of classifying pixels into categories. We wanted to classify the regions of the image that contain a lemon. This way we were able to extract the background information.