OptiRice - Automated Rice Quality Assessment & Auditable Reports

OptiRice is a computer vision–powered pilot system for a rice milling company that replaced manual gasket adjustments with real-time, data-driven decisions. By detecting head rice, broken rice, and whiteness levels through YOLO OBB models and synthetic datasets, the system helped mill workers optimize polishing pressure, reduce grain breakage, and maximize batch value — all without expensive hardware or disruptive process changes.


OptiRice: From Human Judgement to Data-Driven Milling



When the manufacturing head of a rice mill company approached me, the problem sounded simple on the surface: Can we make the polishing process more consistent and profitable by using AI?

But as with most things in production environments, the devil was in the details.

In rice polishing, the key control is an adjustable gasket that determines the pressure applied to the rice as it passes through the machine. Too little pressure, and the grains remain dull, lowering their value. Too much, and they break, instantly cutting the market price of the batch.

For decades, the decision on where to set that gasket had relied entirely on human judgement. Experienced workers could glance at the incoming paddy, feel a few grains between their fingers, and make the call. Their skill was real, but it was also subjective, inconsistent, and impossible to scale.

The company wanted something better. They wanted to measure moisture content and whiteness in real time, track the process continuously, and find the optimal gasket setting for every load. But they also wanted to know if such a system was technically possible and worth the cost.


That’s how OptiRice began as a pilot project to answer that question.


The First Plan: Cameras and Labels

Our first instinct was to throw hardware at the problem. We imagined a high-resolution camera rig, mounted over the conveyor, capturing every grain as it fell. Later, we’d label each grain and impurity manually and use that to train our model.

On paper, it was solid. In reality, it collapsed almost instantly.

The cost of the cameras, the sheer effort of labeling millions of grains, and the environmental chaos of a working mill made it completely impractical. We needed a plan B, and fast.


Hunting for Data

The next logical step was to look for public datasets. The search was discouraging at first. Most datasets were either too generic or focused on cooked rice. Then we found something promising: a collection of thousands of high-quality images of individual rice grains on a clean black background.

It wasn’t perfect, the grains weren’t from our client’s specific supply chain, and there were no impurities, but it was a start.

We processed these images with Sobel filters to extract grain boundaries and then created a synthetic dataset tailored to our needs. We injected impurities artificially, sometimes by breaking existing grain images and scattering them in random positions.


Training the Model

For object detection, we chose YOLO OBB to handle oriented bounding boxes. The model needed to not only detect grains but also classify them into head rice and broken rice.

We used bounding box sizes as a proxy for classification. Clustering helped separate the two categories, and from that we could calculate the percentage of head rice in real time.

Meanwhile, to measure whiteness, we kept the lighting and background uniform, then calculated the average pixel color within each grain. It was a simple approach, but in a production setting, simplicity often wins.


From Lab to Mill

With the models trained, we integrated them into a dashboard. The idea was simple: workers could see live percentages of head rice and broken rice as the polishing machine ran, along with a whiteness score.

On-site testing was the real moment of truth. We set up the system in the mill, ran a few loads, and watched the dashboard populate with numbers. The readings were stable, matched manual checks closely, and most importantly, were fast enough to be actionable.

For the first time, the gasket adjustment wasn’t just guesswork. Workers could look at the screen, see the data, and make informed tweaks to get the best value out of the stock.


The Result

The pilot proved two things. First, computer vision could indeed measure and track the key variables in rice polishing without requiring an expensive, high-maintenance setup. Second, it was economically viable. The system paid for itself by reducing broken grain percentages and improving consistency across batches.

OptiRice began as an experiment in replacing experience-based decisions with data. It ended as a working tool that could fit seamlessly into an existing mill, bringing consistency, transparency, and measurable value to every batch of rice processed.