1. Introduction
Liquor production is part of the tradition of almost all nations around the world. Famous examples of liquors with worldwide popularity are Scotch whisky and French cognac. Many more local national drinks exist such as rakija—fruit spirits manufactured in Balkan nations, Italian grappa made from grapes, Japanese sake made from fermented rice, etc.
The technology of liquor production has been perfected over centuries and involves two key technological processes—fermentation and distillation. Fermentation is common in the production of all alcoholic beverages. During alcoholic fermentation, yeasts convert sugar to ethanol, carbon dioxide, and other metabolic byproducts. Yeasts can typically survive up to 18% ethanol concentration, therefore the maximum concentration of ethanol in the fermented mash is around 18%. Liquors typically have an ethanol concentration of 30% or more, so fermented mash needs to be distilled in order to increase the concentration of ethanol in the beverage to the desired level. Distillation is the process of separating liquid mixture components through selective boiling and condensation. Mash is a complex mixture that dominantly contains water, ethanol, and other aromatic components. During distillation, each component has a different dynamic of transfer from the mash to the distillate. Some components of mash are desirable (pleasant aromatic components, ethanol) and some are undesirable (e.g., fusel oils) or even toxic (methanol). Therefore, distillate is typically separated into three fractions or “cuts“—heads, hearts, and tails. Heads come out first out of the still and contain a large concentration of methanol, aldehydes, and other alcohols [
1]. Hearts is a desirable part of distillate; it has a good balance of pleasant aromatic compounds and a high concentration of ethanol. Tails are the fraction collected at the end of distillation; it contains undesirable fusel oils and low concentrations of ethanol [
1].
There are two common methods for determining the moment of fraction separation. The first one is by organoleptic properties of distillate (by smelling and tasting samples of distillate). The other is by measuring the concentration of ethanol in distillate on the output of the still. The organoleptic method requires experienced and skilled experts, and it is vulnerable to the subjective criteria of each individual. Another important drawback of the organoleptic approach is poor scalability, i.e., if multiple stills have to be operated concurrently additional experts must be hired.
The ethanol concentration approach to fraction separation is based on the physical properties of output distillate [
2]. Few empirical rules were established for separating fractions during the long history of liquor production. The common rule of thumb is to separate fractions when the alcohol concentration of distillate on the output still falls under some threshold. Threshold values are determined empirically and may vary concerning the quality of mash, type of fruit or grain in the mash, etc.
The most important benefits of distillation process automation are the increase in consistency of liquor quality, power consumption reduction, and easier scaling of production. Several underlying processes of the distillation process can be automated. Thermal processes such as boiler and condenser temperature can be easily automated with industry-standard control algorithms such as PI regulation or bang-bang regulation. Today’s modern equipment for batch distillation often has some or all of these processes automated. One realization of the modern automated distillation unit is illustrated in
Figure 1.
The fraction separation process is still mostly performed manually. The alcohol concentration fraction separation approach is objective and quantifiable criteria for fraction separation. Therefore, it is suitable for use in the automation of the distillation process. In order to close the control loop with the ethanol concentration approach, measurement of ethanol concentration is needed. There is a plethora of industrial-grade ethanol concentration sensors. However, the high price of industrial-grade sensors keeps them out of the reach of small and medium liquor producers and the conventional technique of measuring by alcoholmeter is a purely manual technique that requires a human operator.
This paper proposes a novel approach to ethanol concentration measurement. The proposed system combines the existing alcoholmeter and accompanying infrastructure with a deep learning-based measurement reading system. The system captures an image of an alcoholmeter which measures ethanol concentration and extracts measurement information from the image. A convolutional neural network (CNN) is used to extract ethanol concentration information from images. Two approaches to model architecture were analyzed based on the type of output layer—the regression and classification approach. The main motivation to use the regression model is the continual nature of its output which corresponds to the continual nature of ethanol concentration. The motivation to use the classification model comes from the discrete nature of alcoholmeter graduations. Both models were based on ResNet18 architecture [
3], with output layer modification only. Due to specific application scenarios, models trained to start from pretrained ResNet18 models gave poor classification and regression performance. Therefore, models were randomly initialized and completely trained on the dataset generated for this paper.
Digitalization of analog instruments with gauge using vision-based systems has been demonstrated successfully many times since the vast majority of legacy instruments have gauge, such as aircraft instruments [
4], water meter [
5], energy meters [
6], voltmeters [
7], pressure gauges [
8] and ammeters [
9], power meters [
10] etc.
Compared to typical gauges, even with fixed cameras, the alcoholmeter is not fixed in the frame; instead, it floats up or down and it can rotate, therefore making the automated alcoholmeter reading a significantly more complex problem. The image processing approach was used in the past for hydrometer alignment of measurement scale marks during calibration via immersion [
11]. Exhaustive patents and the literature search did not yield the sensing approach proposed by this paper.
Artificial intelligence (AI) techniques are increasingly used in the field of food and beverage sensorics. New AI-powered sensing techniques enhance the tracking quality of products during production and ensure both the quality and safety of finished products.
Tonezzer et al. [
12] developed a portable and inexpensive resistive gas sensor for distinguishing methanol from ethanol by using machine learning. Voss et al. [
13] demonstrated alcohol detection in beers based on an electronic nose as an indirect method of ethanol concentration detection. Kuswandi et al. [
14] developed a visual ethanol biosensor for halal verification of fermented beverage samples; however, this approach is not suitable for automation purposes due to its manual nature and only ethanol detection is achieved, not concentration measurement. Erfkamp et al. [
15] developed a novel ethanol concentration sensor based on ethanol-sensitive hydrogels. The novel sensor shows promising performance as it demonstrated robustness with respect to a wide ethanol concentration range, pH variation, and salt concentration. The low technology readiness level (TRL) of this novel sensor prevents widespread use for now. Other techniques [
16,
17,
18,
19] for ethanol detection and concentration measurement are also the focus of many researchers.
This paper’s main goal is to demonstrate the ability of the deep learning-based system to digitalize visual alcoholmeter measurement, thus enabling the use of affordable and non-invasive sensing platforms in distilling automation. In addition to the proposed use in distillation automation, the system proposed in this paper can be reused for non-invasive reading of any human-readable instrument by retraining the model with an adequate dataset.
In
Section 2, materials and methods, physical and practical aspects of traditional alcoholmeter are given first. Then, the proposed alcoholmeter reading system is described and the dataset acquisition setup apparatus and description are given. Image and label pre-processing are described afterward, and regression and classification models are defined at the end of
Section 2. Results and dataset sample is presented in
Section 3. Regression and classification performances are given visually and numerically.
Section 4 represents the discussion. Results are discussed with respect to the initial proposal and methodology. Methodology improvements are also proposed based on the results.
Section 5 is the conclusion. Final conclusions are given based on the previous discussion along with suggestions for further direction of research.
4. Discussion
The dataset acquisition apparatus produces uniformly distributed samples (
Figure 10b) with voltage labels due to the constant speed of the linear actuator. However, due to the non-linear mapping of voltage to alcohol concentration (
Figure 10a), skewness appears in the alcohol concentration domain of labels. One aspect of apparatus improvement could be automatic control of the linear actuator, eliminating the need for manual control. With closed-loop speed/position control of the actuator, uniform distribution of samples could be achieved in the alcohol concentration domain of labels. Further improvement of the apparatus can be made by introducing an additional rotary actuator for the alcoholmeter to eliminate manual rotation and generate a more continuous dataset.
Regression model evaluation on the test dataset yielded an excellent performance as shown in
Figure 11. Readings produced by the model are densely grouped near the ideal reading characteristic of
Figure 11a. This is backed by the fact that RMSE and MAE have values of less than 1% (
Table 6). Reading error is additionally visualized with the residual plot (
Figure 11b) which suggests that slight variation of reading error with respect to alcohol concentration. Further analysis of reading error indicates Gaussian distribution of reading error (
Figure 11c) with bias less than 0.1% (
Table 6) which can be compensated. A value of 0.9988 for the R-squared metric additionally testifies to excellent reading performance.
Classification model evaluation on the test dataset also yielded more than satisfactory performance as shown in
Figure 12. By classifying rather than fitting the regression model output, the model is quantized to 1% quant. Accuracy of ±1% is effectively achieved as shown in the scatter plot (
Figure 12a) and confusion matrix plot (
Figure 12b), with only a handful of outliers. With the reading rate being significantly larger (circa 500 ms per sample) than the rate of change in alcohol concentration, outlier rejection can be easily implemented by filtering the model’s output with a simple median filter.
5. Conclusions
The paper presents a novel approach to the digital measuring of alcohol concentration using a traditional alcoholmeter and deep learning visual perception-based system for measurement reading. Alcohol concentration measurement is important in the automation of the distillation of liquor. Available alcohol concentration sensors for automation purposes exist; however, their high price keeps them out of the reach of small and medium producers. Approach to alcohol concentration sensing proposed by this paper addresses this problem in two ways. Firstly, it presents a low-cost solution by demonstrating the use of affordable shelf hardware. Secondly, it represents a non-invasive solution with no need for structural modification of any kind to existing distillation equipment.
The core problem of reading alcoholmeter measurement was treated both as a regression and classification deep learning problem. Resnet18 convolutional neural network architecture proved to be a good choice for addressing the core problem as it demonstrated excellent performance in both regression and classification approaches. Considering the satisfactory performance of the proposed network architectures for automation purposes, no other network architectures were tested.
The density of liquid depends on its temperature. Therefore, measurement correction must be performed if the temperature of the sample is not equal to the temperature of alcoholmeter calibration. Temperature compensation is often linear function which makes temperature compensation simple. One aspect of future improvements of alcoholmeter measurement accuracy is the implementation of automatic temperature compensation.
The proposed system can be integrated as a part of new automated distillation equipment, and due to its non-invasive nature, it can be used in the retrofitting and modernization of existing distillery equipment with minimal modifications to existing infrastructure.
The scope of application of the proposed system can be further expanded to reading other types of instruments used in the industry by simply training models on the appropriate dataset. Significant cost reduction in retrofitting or modernization of existing control and supervision systems can be achieved with the proposed approach of instrument digitalization, as it minimizes downtime during integration and eliminates the need for buying new digital sensors.