Three years, two countries, and a camera on a tractor: here is how Dilepix developed a vision-based tool to measure food loss in vegetable fields within the FOLOU project.
After harvest, edible vegetables are often left in the field, for many reasons. Some do not meet market requirements on size, shape or appearance. In other cases, another harvesting round would cost more than the remaining vegetables could be sold for. Today, quantifying them relies on a manual protocol: field teams delimit small sampling areas across the plot, collect and weigh the edible vegetables remaining in each, then extrapolate the result to the whole field. This is slow and labour-intensive, and the result depends heavily on where the samples are taken. Our goal was to see whether an embedded RGB camera, combined with deep learning and computer vision, could make this measurement faster, cheaper and more reliable.
This article walks through each step: how we collected data, how detections first helped field teams sample better, and how we then built a fully automatic estimate running on a tractor.
Each year, a significant amount of food is lost at the primary production stage, before it even leaves the farm.
FOLOU (2023–2026) brings together 16 multidisciplinary partners from 10 countries to prevent and reduce food loss at primary production. The project acts on four levers: understanding the drivers and impacts of food loss, measuring it with new cost-effective tools and a harmonised methodology, training stakeholders, and supporting adoption through recommendations and a twinning programme between regions.
Dilepix takes part in the measuring lever, within a work package where six innovative tools for measuring and estimating food loss are developed and validated. The rest of this article focuses on ours.
The presented work focuses on two types of crops: cauliflower and lettuce. Data were collected before, during and after harvest, in Brittany (France) and Catalonia (Spain), with the support of local farmers and our project partner Espigolador.
During the development and testing phases, the embedded camera was simulated with a drone flying at low altitude. This was a transition in the methodology, which made acquisitions and tests easier while the method matured. The system was then moved onto the tractor for validation.
The campaigns ran in three phases:
2023, development: first acquisitions in cauliflower fields in Brittany, used to develop the solution and train a first detection model.
Detecting vegetables in images is only the first brick. Turning those detections into food loss figures was done in two successive steps, each with its own objective:
A modular software design made this possible: the same detection module feeds both approaches, and only the metrics computed from it change.
Because teams can only measure a small part of each plot by hand, where they sample matters a lot. A field is rarely uniform, and random sampling can easily miss its extremes.
The detections give us a measure of field homogeneity: how much vegetable sizes vary within an area, expressed as a coefficient of variation (the standard deviation divided by the mean). A field can be heterogeneous for many reasons, such as disease, soil or water conditions, or uneven planting and harvesting.
We used this to map each field. The plot is cut into a grid of cells the size of a manual sampling area. For each cell, we compute the number of detected vegetables and how much their sizes vary. Cells are then grouped into homogeneity zones, and the map tells field teams which cells to measure in each zone.
To validate this, we gleaned and weighed, together with Espigolador, every edible cauliflower left after harvest on two plots in Catalonia, giving an exact reference. Compared with it, guided sampling reduced the estimation error of random sampling by up to 60%.
The second approach removes sampling altogether: detect every vegetable left after harvest, estimate its weight from its size in the image, and add them up for the whole plot.
The key is a reliable size-to-weight relationship. We created a dataset linking the size of individual cauliflowers in the images to their weight, measured on site, and built a weight model from it.
Comparing the automatic estimates with the gleaning reference was very instructive. It highlighted two sources of underestimation: some cauliflowers are hidden under foliage and cannot be seen from above, and the weight model has to match the maturity stage of the plot, since for bolting cauliflowers, visible size is no longer directly related to weight. Once the model was adapted to the maturity stage and visible missed heads were added, the automatic approach reached up to 77% accuracy compared with the gleaning reference, the remaining gap being mostly heads hidden by leaves.
With the method established, the system was moved onto the tractor, where it works in real time. This is where Dilepix's core expertise comes in: designing custom vision solutions that are embedded directly on agricultural machines and run reliably in real field conditions, from camera integration and positioning to onboard processing.
The methodology remains the same as with the drone, but the workflow had to be adapted. With the drone, images were stitched into an orthomosaic and analysed afterwards. On the tractor, an industrial camera and an onboard computer do everything during the drive. Each video frame is matched with a precise GNSS position, a detection neural network finds the vegetables, and every detection is geolocated. No post-processing is needed.
The estimation method was adapted accordingly. Instead of a full orthomosaic, it works directly on the stream of geolocated frames, so overlapping images never count the same vegetable twice. The camera height is even recovered automatically, by comparing how far the image moves with how far the GNSS says the tractor moved.
The tractor system was validated in two ways:
These tests confirmed that the method counts reliably once the detector is adapted to the field. They also showed that each crop needs its own weight rule: for lettuce, weight is only loosely related to visible size, so counting heads and multiplying by an average weight works best, while for cauliflower, both size and maturity stage matter.
Vision-based food loss measurement has shown its potential, and it now runs on a real tractor in real time. Guided sampling opens interesting perspectives, as it roughly halves the error of today's manual protocol. To be adopted, the process still needs to be improved so that it stays acceptable for field teams in terms of time and logistics. It also requires mapping the field beforehand, either with a drone, with its own operating constraints, or with an equipped tractor. Fully autonomous estimation is not yet a complete replacement for manual measurement, but it is a credible complement for large-scale or repeated monitoring.
The remaining errors come from a few well-identified sources rather than from the core technology:
That last point is also our main recommendation: the next leap will come less from better algorithms than from shared calibration references, built as a common resource for anyone measuring food loss in the field.
More broadly, this work shows that embedded vision and artificial intelligence open new perspectives for tackling complex agricultural challenges such as food loss, turning what was once slow, partial and costly to measure into data that can be collected across entire fields, season after season.