Food Grain Sorting with Computer Vision Case Study (1)

Food Grain Sorting with Computer Vision: Case Study

Food grain sorting is traditionally a labor-intensive process, relying heavily on manual inspection by skilled technicians.

This case study examines an innovative project aimed at automating grain sorting using advanced image processing and deep learning techniques.

Conducted by EasyODM, this project seeks to improve the efficiency and accuracy of grain sorting, specifically targeting oats and their impurities.

The project’s objectives include developing a high-accuracy sorting system to replace the monotonous and error-prone manual sorting process.

The Client

This case study was conducted for a prominent grain processing company in Lithuania, known for its dedication to quality and innovation in the agricultural sector.

The company specializes in producing and processing high-quality grain products, including oats and oat-based products.

By investing in advanced technologies and modernizing its operations, the company aims to enhance productivity, reduce costs, and maintain its competitive edge in the market.

This project aligns with the company’s commitment to leveraging cutting-edge solutions to improve its processes and deliver superior products to its customers.


Grain sorting typically involves a technician manually inspecting and sorting a sample of around 100 g. of raw material.

This process can take up to 25 minutes for a 60 g. sample, even for experienced technicians, and requires high levels of concentration.

The manual nature of the task increases the likelihood of errors due to its repetitive and monotonous nature.

The project aimed to create an automated system to assist in sorting raw materials more efficiently, thereby reducing human error and increasing productivity.


The primary goal of the project was to analyze and implement traditional image processing and deep learning methods to achieve high accuracy in food grain sorting.

The project sought to test the effectiveness of visible light and near-infrared (NIR) spectrum cameras, combined with sophisticated image processing algorithms, in accurately segmenting and classifying grains.

Grain classification pipeline
Food grain sorting pipeline (source)

Data Collection

The study utilized visible light and near-infrared (NIR) cameras to capture detailed images of grain defects. Data was collected under experimental conditions using sample oats.

Images were collected in three stages to assess the impact of different backgrounds and lighting conditions on sorting accuracy. The collected data was then used to train and test the sorting algorithms.


Grain Semantic Segmentation

Initial tests used classical image processing methods such as thresholding, edge detection, and marker-based watershed segmentation.

These methods helped separate the grains from the background and detect individual grains. Morphological operations like dilation and erosion were applied as needed.

Grain Classification

For segmentation and classification, the YOLO (You Only Look Once) model was used. The dataset was split into 80% for training and 20% for testing, with images resized to 640×640 pixels.

Deep learning models like the Segment Anything Model (SAM) and SegmentEveryGrain were also tested for their ability to segment and classify grains without requiring extensive data labeling.


The project achieved significant success, with the automated system demonstrating high accuracy in both segmentation and classification. Key results include:

Segmentation: 100% accuracy.

Classification: 96% accuracy.

These results highlight the system’s effectiveness in accurately identifying and classifying different types of grains, particularly in distinguishing unhulled oats from hulled oats.

The EasyODM software played a critical role in achieving these results, providing a robust platform for integrating advanced image processing and deep learning algorithms.

Food grain classification and segmentation
Food grain classification and segmentation


The automated food grain sorting project conducted by EasyODM successfully demonstrated the potential of using advanced image processing and deep learning techniques to improve the efficiency and accuracy of grain sorting.

The project’s clear objectives, detailed methodology, and impressive results underscore the strengths of the EasyODM software.

By leveraging sophisticated imaging technologies and processing algorithms, EasyODM has created a highly effective and reliable system for automating grain sample analysis.

This success not only enhances productivity and reduces human error but also paves the way for broader applications of this technology in other areas of agriculture.

Unlock Your Business Potential With AI!

Book a consultation with our expert and discover tailored solutions to boost your business success. Don’t miss out on this opportunity to gain personalized insights and strategies.


Gediminas Mickus
Business Development Manager

Limited seats available - Act now!

Scroll to Top