Sorting Cucumbers with Machine Learning

Sorting Cucumbers with Machine Learning

Is sorting cucumbers the job of machine learning? Well, apparently it is. Japanese farmer Makoto Koike – who did not have any prior knowledge of machine learning – used TensorFlow and employed deep learning to identify and sort different classes of cucumbers, while helping at his parents’ cucumber farm.


A variety of thorny cucumber, especially fresh and crispy, was Makoto San’s father’s specialty. The straight and thick ones with vivid colours and plenty of prickles were premium quality and fetched a higher price. Makoto was soon overwhelmed by the volume of work needed to sort them by size, shape, colour and other attributes. Japanese farms have their own classification standards and there’s no industry benchmark. Makoto’s farm sorts them into nine different classes, all done by his mother — spending up to eight hours per day during peak harvest seasons.

Inspired by what machines could do after watching AlphaGo, Makoto began experimenting with deep learning using Google’s open source machine learning library, TensorFlow. He downloaded the sample code and read the tutorials, and soon enough started off in training the systems to recognize images of different types of cucumbers.

According to a Google Cloud website, Makoto San used the sample TensorFlow code Deep MNIST for Experts with minor modifications to the convolution, pooling and last layers, changing the network design to adapt to the pixel format of cucumber images and the number of cucumber classes. To train the model, Makoto spent about three months taking 7,000 pictures of cucumbers sorted by his mother, but it’s probably not enough. Working with test images, the accuracy was over 95%, but in real life scenario it dropped to 70%.

Makoto San is now working at it by increasing the training data set to deliver 90%+ accuracy. He is planning to use Google Cloud ML, a low-cost cloud platform for training and prediction that uses hundreds of cloud servers to train a network with TensorFlow. For now, even with 70% accuracy, his mother’s workload has been significantly reduced!

Leave a comment

Your email address will not be published. Required fields are marked *

© 2024 Praxis. All rights reserved. | Privacy Policy
   Contact Us