Sorting Farm Produced Cucumbers using TensorFlow’s Machine Learning



Today there are immense opportunities of Artificially Intelligent solutions in every possible field owing to TensorFlow’s open-source models that can be easily trained and implemented in innovative projects.

In the Agriculture field, there is a tried and tested method by Google to intelligently automate the process of sorting farm produce with the help of TensorFlow.

The sorting process of fruits and vegetable post-production is very lengthy. Time spent by a farmer in classifying the produced cucumbers is much more than that used in the farming process. It’s a task that requires intricate precision, so not anyone can take this task up. One needs to be trained and experienced to approve quality and classify the cucumber.

However, with the help of TensorFlow’s Machine Learning in agriculture a process can be taken up by a machine, farmers can convey all their efforts in their upscale task of farming.

Here, Artificial Intelligence can be used to automate the sorting of produced cucumbers that would not require an experienced farmer.

A customized machine can be made, fed with the machine learning program using TensorFlow’s open-source neural network model (code) with some modifications.

This use case shows the possibility of sorting and classifying farm produced cucumbers according to varying lengths, shapes, and colors using the Image Recognition technique of AI using TensorFlow’s machine learning in agriculture.

Would You Like More Cases On Bleeding Edge Technologies?

If you like we can notify you each time a new interesting content is uploaded.


1) Cucumber Sorting Machine


Custom-built machine using Arduino and Raspberry Pi 3 micro controllers, attached with conveyor belt, and sorting arms arranged at distinct positions to classify cucumbers in varied categories. Depending on the number of categories of cucumbers, collector bins should be placed below the conveyor, where the sorting arm disposes the classified cucumbers.



2) Machine user


One that places cucumber on the Arduino machine at regular intervals. And to feed training data-sets into this program of machine learning in agriculture.

Looking For Unique Business Ideas For A Startup

Get Inspired


  • The machine’s software program should be fed by two TensorFlow neural networks. The first one to identify if the image processed is of cucumber or not.
  • The second neural network should use AI code altered from the TensorFlow’s open-source model of Deep MNIST for experts with little modification of network design to remodel the pixels format of cucumber image and the number of cucumber classification categories.
  • The categories for cucumber classification must be pre-decided and fed in the Cloud program. Categories can be based on shape and size like very large 2L, large L, medium M, small S, very small 2S, etc.
  • The system should be supported by a large database to collect the training datasets. Ideally, that’s possible using Google Cloud.
  • The user should train the deep learning system by sufficient sorted cucumber images along with their classifications to gain accurate sorting of cucumbers.


  • The user places the cucumbers one by one on the sorting machine under the camera focus.
  • The camera takes the image of the placed cucumber from three sides and the picture is passed to Google Cloud.
  • The first TensorFlow neural network identifies if the image is of cucumber or not. It continues ahead only if it is a cucumber.
  • Next, the system executes the second TensorFlow neural network on the cucumber image.
  • The machine executes the AI code for image recognition that uses deep learning and identifies cucumber’s category.
  • The machine passes the cucumber on the conveyor and depending on its classification, it is thrown in the allocated section bin-collector.

The Power Lies In Your Hands.

If you like this blog, then please do share it.

Share This Article On


  • After sorting a new sample of cucumber with the help of this cucumber sorter AI programmed machine, the user must verify its accuracy
  • Also, he/she should match the sorted cucumber with the AI program’s training data-set. If the dimensions of the test cucumber are not present in the data, then the user must feed them in the model for better accuracy for upcoming cucumber sorting tests.

More About Author

Vishal Nakum

Vishal Nakum is a tech enthusiast with a passion for exploring the latest developments in the world of technology. He has a keen interest in emerging technologies such as Artificial Intelligence, Machine Learning, and Blockchain, and enjoys keeping up-to-date with the latest trends and advancements in these fields. Vishal is an avid learner and is always on the lookout for new ways to expand his knowledge and skills. He is also a creative thinker and enjoys experimenting with new ideas and concepts. In his free time, Vishal enjoys playing video games and reading books on technology and science.