Let's Learn .NET: C#
Did you miss Let's Learn .NET all about learning C#? Watch the session on demand.

Evolution Software improves hazelnut quality with ML.NET

Evolution Software Design, Inc.

Products & services
.NET Core
Entity Framework Core
SQL Server


Organization Size
Small (1-100 employees)


Evolution Software Design, Inc. is a consulting firm that helps other organizations apply technology more effectively through strategic technology solutions and by developing healthcare, e-commerce, agriculture, and enterprise applications. One of the company's recent ventures is in the hazelnut industry, partnering with various hazelnut processing companies to improve the quality of hazelnuts from farm to consumer using machine learning and ML.NET.

"ML.NET made it straightforward to leverage our existing .NET and C# skills and software assets to add machine learning capabilities into the application. Because the rest of the application is developed using the Microsoft technology stack and deployed on Azure, the integration of machine learning models was easy and straightforward."

Andy Gray, Executive Partner Evolution Software Design, Inc.

Business problem

For hazelnuts to be suitable for human consumption, they must fulfill certain requirements. One such requirement is that hazelnuts must be "well dried," or contain a specific level of moisture, which the industry has specified to be between 8.5% and 11.5%. For the nuts to be accepted by buyers, it is important to get the moisture content right: if it is too low, the nuts will shrink too much; if it is too high, the nuts may mold and spoil.

To ensure that hazelnuts reach this moisture level, after harvest they are brought from the farm to receiving stations and placed in commercial dryers, which can contain up to 50,000 pounds of hazelnuts each.

Determining the amount of time the hazelnuts must spend in the dryers to reach the target moisture can be an error-prone art and is influenced by multiple variables, such as the variety of hazelnut, the weight of the batch, the dryer being used, the location, and the weather. The standard way of determining the moisture content is a very manual process: somebody is sent periodically into the dryer to scoop a bucket of nuts out, weigh the kernels, dry them, and then look at the difference in weight. The process is repeated several times during the drying process, and conditions in the dryer are less than ideal with 120-degree Fahrenheit air blowing at 100 mph.

People who have been doing this process for a while often assume they know when the hazelnuts are ready without performing the sampling process, which can lead to incorrect moisture levels and inconsistencies from dryer to dryer, which in turn results in lost revenue for the receiving stations and hazelnut processors.

Further, since a large volume of hazelnuts is harvested and processed within a relatively short window each fall (in 2018, the participating hazelnut processing companies received sixty-eight million pounds of dried nuts from the receiving stations), there is high business value in optimizing the use of the dryers during their round-the-clock operation.

To address these business problems, the Hazelnut Monitor application uses ML.NET to predict the moisture content of the nuts within the drying batch and alert operators when the target level is reached.

"The goal of the app is to make it really simple for the people who are operating the dryers to know when the moisture of the nuts is close to the optimal moisture range while reducing the need to sample; eventually we'd like to get to the point where they don't have to sample the nuts as frequently."

Michael Gerfen, Executive Partner Evolution Software Design, Inc.


While machine learning seemed an intriguing strategy for addressing the business problem, it was unclear how easily this would be implemented within the application. However, the release of ML.NET dramatically accelerated the implementation, and after only four and a half weeks of development, Evolution Software had its first machine learning model for improving the prediction of hazelnut moisture level within 2.5-3% for 35 commercial dryers.

Impact of ML.NET

In addition to monitoring measured values such as temperature, humidity, and barometric pressure, the processors operating the dryers now have real-time predictions of moisture levels accessible to them through a mobile-friendly web client. The notification engine operates on both the measured and predicted values, so operators can receive SMS or email messages when the target moisture level is reached.

This additional information provides operators with increased visibility and more confidence about the state of the drying process through their mobile phones and other devices.

Solution architecture

Data processing

The app uses SignalR to get real time updates as data arrives at the server and stores the data in SQL databases. Each dryer has multiple sensors connected to a hub, which every minute sends the following collected data via REST to a Web API implemented in ASP.NET Core MVC:

Additional data needed to make predictions, such as start and end time, weight, hazelnut variety, structure (dryer), and location (drying facility) are manually collected and logged by workers at the facility:

The moisture levels from the samples of hazelnuts (used for training data) are also manually collected and logged:

Data transformations and machine learning algorithms

Hazelnut Monitor uses one-hot encoding to convert the categorical Features (variety of hazelnut, location of dryer, and bin/structure number) into float data types, which is the format accepted by ML.NET algorithms, and concatenates these Features with temperature delta, humidity delta, and weight. These Feature columns are then passed to a Fast Tree Regression algorithm, which predicts hazelnut moisture levels.

Last year, the training algorithm was run once a day as a scheduled task, and the trained model was then pushed as a zip file to Azure Blob storage. The model was then loaded in the Azure App Services cache and used on new data to make moisture level predictions. This season, Evolution Software plans to move this process to a scheduled Azure Function.

Client application

Hazelnut Monitor provides a web-based portal, built with .NET Core and Aurelia and hosted on Azure, that provides insight into drying operations across multiple locations. It also includes a rules engine and a notification system (using Azure Functions) that can alert key personnel via SMS and e-mail notifications when certain measurements are out of range (for example, the temperature is too hot or too cold), when sensors malfunction, or when the target moisture content is reached.

The release of ML.NET made it straightforward for Evolution Software to add machine learning capabilities into the Hazelnut Monitor application. The company was able to leverage its existing .NET and C# skills and software assets to go from scratch to a functioning machine learning model in a short amount of time and thereby address the targeted business problems.

Ready to Get Started?

Our step-by-step tutorial will help you get ML.NET running on your computer.

Supported on Windows, Linux, and macOS

Get Started