Now with added cucumbers

Working here at Pi Towers, I’m always a little frustrated by not being able to share the huge number of commercial businesses’ embedded projects that use Raspberry Pis. (About a third of the Pis we sell go to businesses.) We don’t get to feature many of them on the blog; many organisations don’t want their work replicated by competitors, or aren’t prepared for customers and competitors to see how inexpensively they’re able to automate tasks. Every now and then, though, a company is happy to share what they’re using Pis for.


Makoto Koike, centre, with his parents on the family cucumber farm

Here’s a great example: a cucumber farm in Japan, which is using a Raspberry Pi to sort thorny cucumbers, saving the farmer eight to nine hours’ manual work a day.

Makoto Koike is the son of farmers, who works as an embedded systems designer for the Japanese car industry. He started helping out at his parents’ cucumber farm (which he will be taking over when they retire), and spotted a process that was ripe for automation.


Cucumbers from the Makotos’ farm

At the Makotos’ farm, cucumbers are graded into nine categories: the straightest, thickest, freshest, most vivid cucumbers (which must have plenty of characteristic spurs) are the best, and can be sold at the highest price. Makoto-san’s mother was in charge of sorting the cucumbers every day, which took eight hours at the peak of the harvest. Makoto-san had an epiphany after reading about Google’s AlphaGo beating the world number one professional Go player. He realised that machine learning and deep learning meant the sorting process could be automated, so he built a process using Google’s open-source machine learning library, TensorFlow, and some machinery to process the cucumbers into graded batches.


Sorting in action


Camera interface

Google have put together a diagram showing how the system works:


There are difficulties in building this sort of system, not least the 7000 cucumbers, pre-graded by his mother, that Makoto-san had to photograph and label over a period of three months to give the model material to train with. He says:

“When I did a validation with the test images, the recognition accuracy exceeded 95%. But if you apply the system with real use cases, the accuracy drops down to about 70%. I suspect the neural network model has the issue of “overfitting” (the phenomenon in neural networks where the model is trained to fit only the small training dataset) because of the insufficient number of training images.”

Still, it’s an impressive feat, and a real-world >95% accuracy rate is not unfeasible with a big enough data set. We’d be interested to see how the setup progresses, especially as more automation is added; right now, cucumbers are added to the processing hopper by hand, and a human has to interact with the touchscreen grading panel. Here’s the system at work:

TensorFlow powered cucumber sorter by Makoto Koike

Uploaded by Kazunori Sato on 2016-08-05.

We’re hoping to see some updates from the Makoto family as the system evolves. And in the meantime, if you have an embedded project you’d like to share with us, let us know in the comments!