ArticlePDF Available

Detection of fish freshness using artificial intelligence methods

Authors:

Abstract and Figures

Fish is commonly acknowledged as a highly nutritious food in many regions worldwide, and humans have been consuming fish for centuries to meet their protein and nutritional requirements. The consumption of fresh fish offers numerous benefits, as they contain essential proteins and materials that may be challenging to obtain from alternative sources. However, the freshness of fish decreases after a few days. Humans can determine the freshness of fish by looking at its eyes, smelling it, and checking its gills. But, can machines do the same? This study proposes a novel approach to evaluate the freshness of fish using deep learning techniques. Despite the long-standing tradition of humans determining fish freshness by sensory analysis, the objective evaluation of fish freshness has been challenging. By employing deep learning algorithms (SqueezeNet and InceptionV3) to classify fish based on their freshness using a dataset of 4476 images of fish bodies categorized as fresh and stale, this study provides a new method to address this challenge. Analyzing the results of the study revealed that the SVM, ANN, and LR models result in an accuracy rate of 100% for each deep learning method. This outcome indicates a greater percentage than the previous research, which was 98.0%. This research's novelty lies in its application of deep learning techniques to determine fish freshness objectively, providing a reliable and cost-effective method to evaluate fish freshness. The significance of this study lies in its potential applications in the food industry, offering a reliable method for quality control and food safety.
Content may be subject to copyright.
Vol.:(0123456789)
1 3
European Food Research and Technology (2023) 249:1979–1990
https://doi.org/10.1007/s00217-023-04271-4
ORIGINAL PAPER
Detection offish freshness using artificial intelligence methods
ElhamTahsinYasin1· IlkerAliOzkan2· MuratKoklu2
Received: 14 March 2023 / Revised: 10 April 2023 / Accepted: 14 April 2023 / Published online: 27 April 2023
© The Author(s), under exclusive licence to Springer-Verlag GmbH Germany, part of Springer Nature 2023
Abstract
Fish is commonly acknowledged as a highly nutritious food in many regions worldwide, and humans have been consuming
fish for centuries to meet their protein and nutritional requirements. The consumption of fresh fish offers numerous benefits,
as they contain essential proteins and materials that may be challenging to obtain from alternative sources. However, the
freshness of fish decreases after a few days. Humans can determine the freshness of fish by looking at its eyes, smelling it,
and checking its gills. But, can machines do the same? This study proposes a novel approach to evaluate the freshness of fish
using deep learning techniques. Despite the long-standing tradition of humans determining fish freshness by sensory analysis,
the objective evaluation of fish freshness has been challenging. By employing deep learning algorithms (SqueezeNet and
InceptionV3) to classify fish based on their freshness using a dataset of 4476 images of fish bodies categorized as fresh and
stale, this study provides a new method to address this challenge. Analyzing the results of the study revealed that the SVM,
ANN, and LR models result in an accuracy rate of 100% for each deep learning method. This outcome indicates a greater
percentage than the previous research, which was 98.0%. This research's novelty lies in its application of deep learning
techniques to determine fish freshness objectively, providing a reliable and cost-effective method to evaluate fish freshness.
The significance of this study lies in its potential applications in the food industry, offering a reliable method for quality
control and food safety.
Keywords Deep learning· Machine learning· Fish freshness· Transfer learning· Classification· Skin coloration· Fish
body
Introduction
The main reasons behind the consumption of fish are its
freshness, quality, and taste (Tomic etal. 2016). The con-
sumer market has developed a preference for high-quality
seafood products that are immune to diseases in recent years.
In terms of safety, nutritional value, availability, freshness,
storage, and processing methods play an important role in
determining fish quality parameters. During the production,
transportation, sale, and food preparation of fish, there are
a number of factors that may affect the quality and fresh-
ness of the fish [1, 2]. Fish is a nutritious meal [3], Human
wellness depends on its nutrients, vitamins, and proteins [4,
5]. Protein, omega-3 fatty acids, and vitamins (health ben-
efits) are all found in this multi-nutrient food [6]. Since fish
is economical and fresh, people tend to prefer it as a meal
[7]. When fish is fresh, its nutritional quality increases. The
result is that when consumers are shopping for fish, it is dif-
ficult for them to determine whether it is fresh or not. The
flexibility of the fish’s body can be determined by touching
and squeezing it, and quickly decide the freshness of it. Nor-
mally fresh fish has higher elasticity. Unfortunately, utilizing
this approach can result in the contamination of food with
microorganisms, which can be harmful to fish and result in
food-borne illnesses [8, 9]. A fish's quality can vary greatly
depending on how it is handled, processed, and stored from
the moment it is caught until it is eaten. For fish to maintain
its highest quality after harvest, it must be kept at a specific
temperature for a specific period of time [1]. Furthermore,
* Murat Koklu
mkoklu@selcuk.edu.tr
Elham Tahsin Yasin
ilham.tahsen@gmail.com
Ilker Ali Ozkan
ilkerozkan@selcuk.edu.tr
1 Graduate School ofNatural andApplied Sciences, Selcuk
University, Konya, Türkiye
2 Department ofComputer Engineering, Selcuk University,
Konya, Türkiye
1980 European Food Research and Technology (2023) 249:1979–1990
1 3
with greater technical advancements, there have been
attempts to create a way of measuring and assessing sea-
food freshness that is more dependable. The criteria used
to determine freshness include sensory, physical, chemical,
and microbiological. Rapid protein liquid chromatography
and hyperspectral imaging techniques are also considered
[5]. It is thought that fish's eye region has a strong relation-
ship between its coloration and the period during which they
are stored. As a result of these characteristics, the degree of
freshness of the fish sample can be determined by observing
how they deteriorate over time [10].
There are two primary sources of decomposition once it
starts: biological spoilage and chemical spoiling [11]. As
bacteria enter the fish's body through its gills, they degrade
its tissues and organs. Due to chemical interactions, a chemi-
cal spoilage causes a disagreeable odor and also affects the
flavor [12]. Fish spoilage refers to the process whereby the
quality of fish is degraded, resulting in changes to its color,
odor, taste, and texture of flesh. When pH and nitrogen sub-
stances are increased, microorganisms multiply, changing
eyeballs, body surfaces, abdomens, and muscles after an
initial spoilage stage [6, 13].
The changeover from fresh to stale is indicated by colora-
tion in gills from brilliant pink to dark red or yellowish red.
Generally speaking, freshness is determined by the changing
color of the skin from a bright, shiny color to a faded color
when it has lost its freshness. When compared to fish that is
not fresh, fresh fish will have a shiny and bright skin, while
fish that is not fresh will have a dull color and less shine. The
freshness of fish is influenced by multiple factors, including
the hue of its flesh. As the fish ages, the flesh's color shifts
from cream to yellowish, brown, and ultimately blue, indi-
cating the degree of freshness. This color variation is a key
determinant of fish freshness [14].
The evaluation of fish freshness and quality is the paper's
key objective. This is achieved by utilizing deep learning
models. Training and testing of freshness are performed with
images. The study utilized a dataset to determine how fish
body color can be used as an indicator of freshness. The
skin slime is initially clear and fluid, but as bacterial growth
increases, it progressively turns murky and discolored [15].
AI subfields of deep learning method as well as a machine
learning method have been used in this study in combina-
tion. Multiple pre-built models exist, and each has its own
strengths and limitations that must be evaluated. Important
considerations include the size of the model, its accuracy
before retraining, and the rate at which it can predict new
inputs. The significance of these aspects varies based on how
the model is planned to be deployed. If you want to start with
transfer learning, it is suggested that you opt for a faster net-
work such as SqueezeNet or GoogLeNet and test out various
options for data preprocessing and training. After finding
the most effective settings, you can attempt using a more
precise network like Inception-v3 or a ResNet to enhance
your outcomes.
Our research employs SqueezeNet and InceptionV3 for
conducting feature extraction on the images in our dataset.
In the subsequent stage of the study, five machine learning
algorithms are utilized to make predictions.
Related works
Following the development of machine learning, classifica-
tion of fish becomes crucial [16]. Numerous studies have
concentrated on identifying fish body parts, and one tech-
nique for segmenting fish gills and eyes is to observe the
alteration in their color in various color spaces. This color
shift of fish gills and eyes has been studied as a means of
detecting these body parts [17], fish eyes and gills can be
segmented based on the degradation of color in different
colors [2], fish gills can be clustered to be segmented [1],
and there are several image processing techniques that can
be used to segment fish gills based on their color degradation
or clustering [9, 18].
It was Muri Knausg˚ard etal. who applied the YOLO or
You Only Look Once method to detect objects in their study.
They employed a Convolutional Neural Network (CNN)
within a Squeeze-and-Excitation (SE) architecture to grasp
the characteristics of each fish in the image by implement-
ing a Convolutional Neural Network (CNN) as part of the
second phase of this process for the purpose of categoriz-
ing each fish without the need for pre-filtering of any kind.
Due of the small number of temperate fish training data,
transfer learning is used to increase classification accuracy
[19]. They obtained the 99.27% of pre-training model accu-
racy and 83.68% and 87.74% in post-training model without
augmentation of images in Fish4Knowledge public dataset.
Three squid species were identified using a deep learning
model known as the "Improved faster recurrent convolu-
tional neural network” by Hu etal. The three metrics that
were utilized to evaluate the categorization were Accuracy,
Intersection-over-Union, and Average Running Time. 600
pictures of the squid were taken on a uniform black back-
ground. The test samples' average values for Average Run-
ning Time, which is used to assess the categorization, are
85.7%, 80.1%, and 0.144s, accordingly [20].
Prasetyo etal. proposed “You Only Look Once version 4
tiny (Yolov4-tiny)” which can recognize fish body sections
with a fair amount of detection accuracy. Fish and Fish Parts
Detection (FFPD) is a dataset consisting of 600 photos and
4486 annotations, from which it was determined that differ-
ent models could perform better than Yolo-based research
model when compared with it. The model's updated ver-
sion is called WCL-Yolov4-tiny. According to experimental
findings, Precision, Recall, AP, and mAP are, accordingly,
1981European Food Research and Technology (2023) 249:1979–1990
1 3
97.48%, 93.3%, 94.07%, and 92.38%. Using this model, it is
possible to detect fishes in their entirety, their eyes, and their
tails with more precision [9].
Wu etal. used a novel methodology called CNN_LSTM
(convolutional neural network_ long short-term memory)
that was able to determine freshness throughout a range of
temperature changes. Since under specific constant tempera-
ture settings, there has previously been an attempt to forecast
freshness for foods using microbial kinetic equations, but
they stopped working when the temperature was changed
[21].
The current work is the first to demonstrate the effective-
ness of a feature descriptor that is based on data generated
from pre-trained models, such as the VGG16, applying a
transfer learning strategy and AlexNet [2224]. Several deep
learning methods, such as the Artificial Neural Network
(ANN), are employed to categorize the characteristics after
extraction [2527], Convolution Neural Network (CNN)
[2832], Deep Learning Network (DLN) [23]. Numerous
recent articles proposed employing support vector machines
(SVM) and in addition to other machine learning approaches
[33].
In this paper, Abu Rayan etal. suggested a mixed deep
learning model-based technique for classifying fish fresh-
ness using image processing and Nile Tilapia as a model
fish. This model for machine learning (ML) was constructed
by extracting features based on the VGG-16 neural network
architecture and bi-directional long short-term memory
(LSTM) in addition to the suggested language set. When
tested against the testing dataset, the suggested model has
achieved 98% accuracy [34]. Fresh fish can be identified by
their bright, black eyes, white skin, and undamaged fins,
whereas stale fish have gray eyes, red skin, and a swollen
belly, among other signs [34].
Dutta etal. proposed a method of image processing that
does not cause damage to determine the level of freshness of
the fish. To extract the characteristics of the fish's gill tissues
in the wavelet transformation domain, the autosegmentation
method is used to segment the gill tissues using a clustering-
based method, and the Haar filter is then used to extract the
tissue characteristics of the sample [1].
In their study by Atasoy etal., a fish freshness system
was built using an electronic nose that was set up and
had eight metal oxide gas sensors. In this study, Artificial
Neural Networks (ANN) were utilized to accomplish the
classification procedure. There are 7 classes to be classi-
fied. The highest success rate recorded was 98.94% [35].
To address the background variant problems on FC,
Jany Arman etal. presented a fish classification method
incorporating salient object recognition. SVM, K-NN,
Logistic Regression, and Decision Tree ensemble layers
significantly contribute to the classification of fishes. On
model 1, the test result was 99.77%, while on model 2, it
was 100% [16]
Issac etal. gave an automated and effective approach
to perform segmentation of the gills in an image of a fish
sample. The developed algorithm's greatest correlation
with the expert-sourced ground truth findings was 92.4%.
Imaging was performed over the next 13days, with a two-
day interval between each image taken after the sample
had died. In total, four various species of fish were used
in the experiment [36].
Kaladevi etal. proposed a deep learning methodology
to improve the sardine fish's freshness detection precision.
The dataset contains 1049 fresh by 1078 stale sardine fish
images. DCNN was implemented and the performance
metrics yielded the following results: The performance
metrics for the model are as follows: precision of 99.5%,
true positive rate of 96.2%, true negative rate of 92.3%,
positive predictive value of 92.6%, negative predictive
value of 96%, and F1score of 94% [37].
The study presented Table1, which compiles previously
performed methods for detecting the freshness of fish. The
table includes details such as the number of images used,
the method of categorization, the techniques applied, and
the resulting accuracy ratio, all of which were mentioned
in the articles. Image number varies in each study with
the class of images that have been used. In their study
Abu Rayan etal. mentioned that other methods can be
used an tried for the classification, this lets a new study
objective and performing different AI methods for better
results [38].
Table 1 Summary of fish
freshness detection No. Images Class Method ACC (%) References
1 27,230 4 YOLO, CNN-SENet with SE 99.27 [19]
2 600 3 Improved Faster R-CNN 85.7 [20]
3 4486 3 Yolov4-tiny, WCL 94.07 [9]
4 102 - CNN_LSTM, TVC 95.0 [21]
5 4000 2 VGG-16, Bi-directional LSTM 98.0 [38]
6 110 7 ANN 98.94 [35]
7 2678 5 U2-net 99.77 [16]
8 2127 2 DCNN 99.5 [37]
1982 European Food Research and Technology (2023) 249:1979–1990
1 3
Materials andmethods
This study utilized algorithms of deep learning and machine
learning to categorize a dataset of fish bodies based on their
freshness. Figure1 illustrates the workflow of the study,
and the subsequent sections provide further details. The
deep learning models used in this study were SqueezeNet,
and InceptionV3. The freshness classification of fish was
achieved by integrating machine learning techniques such
as K-NN, SVM, ANN, LR, and RF with the models.
Fish body dataset
This study used a dataset from Kaggle consisting of images
of fish [38]. Even though the previous study did not utilize
all the images in the dataset, we opted to utilize the dataset
in its original form, without any modifications. The data-
set was separated into two categories, fresh and stale, and
included a total of 4476 images. 2581 images were of fresh
fish, while 1895 were of stale fish. The images were taken
from 50 Nile Tilapia fish using a Sony Alpha A6000 camera
with a 3.5–5.6/PZ 16-50mm lens and APS-C sensors with
24.3 megapixels. Sample of images in the dataset presented
in Fig.2.
Deep learning models
Convolutional Neural Networks (CNNs) are an artificial
neural network architecture which is primarily designed for
analyzing images. In an image, each pixel is represented by
a numerical value that forms a matrix. When an image is
input into the CNN, It is crucial to maintain the correlation
between pixel values [39]. To transform the input into an
output, the network applies multiple layers of mathemati-
cal operations. A CNN consists of three main operations:
convolution, pooling, and classification [4042]. The con-
volution operation is used in CNNs to detect features within
the input images. The 2 models we are going to apply in
this study are mentioned: SqueezeNet and InceptionV3 were
utilized for feature extraction to determine the freshness of
fish. Both models are pre-trained convolutional neural net-
works (CNNs) that have been widely used in image recogni-
tion tasks. The SqueezeNet model is a lightweight CNN that
uses small filters to reduce the number of parameters while
maintaining accuracy. The InceptionV3 model is a deeper
CNN that employs multiple filters with different sizes and
is capable of capturing features at different scales [43]. Dur-
ing feature extraction, each fish image was passed through
the network, and the resulting features were extracted from
the last pooling layer. InceptionV3 extracted 2048 features,
while SqueezeNet extracted 1000 features. These features
represent different characteristics of the image, such as color,
texture, and shape, and can be used as input to train the
machine learning models [44].
InceptionV3 has been pre-trained on a large dataset, mak-
ing it an effective feature extraction method. It is designed to
extract features from images at multiple scales, which makes
it suitable for a variety of image recognition tasks [45]. The
use of InceptionV3 for feature extraction in this study offers
several benefits [46].
Firstly, InceptionV3 has a large number of parameters,
allowing it to extract a wide range of features from the
input image. It is capable of capturing high-level features
such as edges, corners, and curves, as well as more com-
plex features such as textures and patterns. This makes
Fig. 1 Flow diagram of classification Models
(b) Stale Fish(a) Fresh Fish
Fig. 2 Sample of Fish Body Dataset
1983European Food Research and Technology (2023) 249:1979–1990
1 3
it a powerful feature extraction method that can identify
subtle differences between fresh and stale fish.
Secondly, InceptionV3 is designed to be computation-
ally efficient. It uses a combination of convolutional lay-
ers, pooling layers, and 1 × 1 convolutions to reduce the
number of parameters and increase the efficiency of the
network. This makes it suitable for use in applications
with limited computational resources.
Lastly, InceptionV3 has been extensively tested and used
in various image recognition tasks, making it a well-
established feature extraction method. This ensures that
the extracted features are reliable and accurate, and that
the resulting machine learning models are robust and
effective.
The use of InceptionV3 as a feature extraction method
in this study offers several benefits, including its ability to
extract a wide range of features, computational efficiency,
and reliability [45].
In this study, SqueezeNet was also used as a feature
extraction method to determine the freshness of fish [47].
There are several benefits of using SqueezeNet as a feature
extraction method:
Firstly, SqueezeNet has a small number of parameters
compared to other deep learning models. This makes
it a lightweight network that can be easily deployed on
resource-constrained devices, such as smartphones or
embedded systems.
Secondly, SqueezeNet uses a combination of 1 × 1 con-
volutions, which reduce the number of parameters, and
fire modules, which capture features at different scales.
This enables SqueezeNet to extract meaningful features
from images while maintaining high accuracy.
Thirdly, SqueezeNet was designed to be trained on small
datasets, making it suitable for use in applications where
only a limited number of training samples are available.
In this study, SqueezeNet was able to extract 1000 fea-
tures from the fish images, which were then used as input
for machine learning models to classify fresh and stale
fish.
Finally, SqueezeNet has been widely used in various
image recognition tasks, demonstrating its effectiveness
as a feature extraction method. It has achieved state-of-
the-art results on several image recognition benchmarks,
including the ImageNet Large Scale Visual Recognition
Challenge.
The use of SqueezeNet as a feature extraction method
offers several benefits, including its lightweight architecture,
ability to extract meaningful features, suitability for small
datasets, and demonstrated effectiveness in image recogni-
tion tasks [46, 47].
After the feature extraction process, the extracted features
from SqueezeNet and InceptionV3 were used to train five
different machine learning (ML) models, including support
vector machines (SVM), artificial neural networks (ANN),
k-nearest neighbors (K-NN), logistic regression (LR), and
random forest (RF) models. These ML models were trained
to identify patterns in the extracted features that differentiate
fresh fish from stale fish [48].
Machine learning algorithms
A type of algorithm that can perform particular tasks with-
out explicit coding instructions from a human, and it is a
branch of science that explores algorithms and statistical
models in the context of computer programs is machine
learning algorithm. These algorithms have various applica-
tions such as data mining, image processing, and predictive
analytics. One of the significant benefits of machine learning
is that once the algorithms learn how to handle data, they
can perform their work automatically. In this research, five
different algorithms were selected and employed for the clas-
sification process, and each algorithm's details are presented
in the study.
(a) K-NN: In machine learning, this model is among the
frequently used models. That is used for performing
classification tasks, since it does not learn from train-
ing data, but memorizes them instead. To classify a
new data point, the model looks for the closest neigh-
bors of that data point. The value of k, representing
neighbor’s number, is computed during the algo-
rithm's execution. The model then assigns the incom-
ing test data point to the appropriate class based on its
proximity to the k nearest neighbors [4951].
(b) SVM: Support Vector Machines (SVMs) were ini-
tially developed for solving binary classification
problems. The classification is achieved by applying
a hyperplane that separates the data into two classes.
However, when dealing with datasets that have mul-
tiple classes, more than one hyperplane is needed to
perform the classification. In such cases, multi-class
SVMs are used, which consist of SVM classifiers with
multiple hyperplanes [40, 42].
(c) ANN: Typically, neural networks have three layers:
an input layer that accepts the input data, a hidden
layer that lies between the input and output layers,
and an output layer that contains neurons equal to the
number of classes in the problem. The model utilizes
the input data to learn and generate predictions based
on the interconnections between these layers [52]. The
neural network model's architecture is based on the
connections between its input, hidden, and output lay-
1984 European Food Research and Technology (2023) 249:1979–1990
1 3
ers, which are improved through learning from data
[51].
(d) Logistic Regression: Logic Regression, also known
as Logistic Regression is a machine learning tech-
nique that allows for numerical or categorical clas-
sification of data. The process involves using the sig-
moid function, also known as the logistic function,
to describe the process. A normal distribution is not
necessary for the LR algorithm if the objective can
be inferred from one or more variables. Instead of
predicting outcomes, LR predicts the probability of a
given data point belonging to a certain category [40,
42, 53].
(e) Random Forest: There are a variety of classification
algorithms, but the Random Forest (RF) algorithm
is one that is made up of multiple Decision Trees,
where each decision tree provides a classification for
the input data. Based on these classifications, the RF
algorithm determines which one is the most popular
and creates a new classification. RF is able to handle
large datasets with a high number of variables, and it
is also highly effective at predicting missing data [54].
In this workout, these specific algorithms based on their
popularity and effectiveness in similar image recognition
tasks. Support Vector Machines (SVMs) and k-nearest
neighbors (K-NN) are well-known and widely used classi-
fication algorithms that are often used in image recognition
tasks. Artificial neural networks (ANNs) are also popular
and effective for image recognition, while logistic regression
(LR) is a simple and efficient classification algorithm that is
often used as a baseline in machine learning tasks. Random
forest (RF) is a powerful and versatile ensemble learning
algorithm that has been used in a variety of image recogni-
tion tasks. The selection of these algorithms chosen based on
their potential to provide accurate and reliable classification
results for the task of fish freshness evaluation, as well as
their effectiveness in similar tasks.
Cross‑validation
Cross-validation is a technique that involves dividing data
into subsets or "folds" for training and validation purposes.
A common way to evaluate learning models is to use this
method. During model training, to train a model, a set of
datasets is split into a training set and a testing set, in which
the training set is used for training, and the testing set is
used for testing the model. Cross-validation, also known
as K-fold, allows for the rotation of training and validation
across multiple folds of the data. K-fold refers to the number
of folds the dataset is divided into. Using cross-validation,
it's possible to estimate model performance using unseen
data that was not used during training. In this study, the
dataset was partitioned into ten folds, as illustrated in Fig.3.
The tenfold cross-validation used to evaluate the perfor-
mance of the machine learning models used to determine
fish freshness. This means that the available data were
divided into 10 subsets, and the models were trained and
evaluated 10 times, with each fold serving as the valida-
tion set once. The use of tenfold cross-validation provides
several benefits. Firstly, it helps to reduce overfitting, which
occurs when the model is too complex and fits the training
data too closely, leading to poor performance on new data.
Cross-validation allows the model to be evaluated on dif-
ferent subsets of the data, reducing the risk of overfitting.
Secondly, tenfold cross-validation provides a more reliable
Fig. 3 The performance Fish body dataset cross validation
1985European Food Research and Technology (2023) 249:1979–1990
1 3
estimate of the model's performance than a single split of the
data into training and testing sets. By averaging the results
over multiple splits, the estimate of the model's performance
is less affected by the specific choice of the training and
testing sets [55].
The number of folds used in cross-validation can be
adjusted based on the size of the dataset and the compu-
tational resources available. In general, a larger number of
folds (such as tenfold or fivefold cross-validation) can pro-
vide a more reliable estimate of the model's performance,
but it also requires more computational resources and longer
training time. On the other hand, a smaller number of folds
(such as twofold or threefold cross-validation) can be used
when the dataset is large, or the computational resources are
limited. However, a smaller number of folds may not provide
a reliable estimate of the model's performance, especially
when the dataset is small.
The choice of the number of folds should be based on the
size and complexity of the dataset, as well as the computa-
tional resources available. The use of tenfold cross-valida-
tion in this study helps to ensure that the machine learning
models used to determine fish freshness are reliable and
accurate, by reducing the risk of overfitting and providing a
more robust estimate of the models' performance [48].
Confusion matrix
Confusion matrices show how well a classification model
performs by comparing predicted and actual values [56].
The following expressions can be used to derive the val-
ues present in a confusion matrix: Confusion matrices are a
valuable resource for storing data related to the actual and
expected classifications of a classification model. Typically,
a matrix is employed to assess the model's performance,
by providing the necessary data to calculate various perfor-
mance metrics, including accuracy, precision, recall, and F-1
score, this can be computed from the measurements found
in the confusion matrix. In Table2, TP represents is cor-
rectly identified as Fresh fish and it was fresh actually, TN
is correctly identified as not fresh fish and truly it was not
fresh, FN is misidentified actually it was fresh but predicted
as not fresh, and FP is misidentified as fresh fish but it was
stale fish [49].
The accuracy measures the percentage of accurate predic-
tions out of the total number of predictions. It is a widely
used performance metric, but it may not always be the most
appropriate measure of model performance, especially when
the data are imbalanced or when the cost of misclassification
is not equal for all classes [5658].
Precision measures the proportion of true positive predic-
tions in relation to all the positive predictions produced by
the model. It measures the ability of the model to correctly
identify the positive class [5658]. Formula for Precision:
An analysis of the recall of a dataset is also referred to
as the sensitivity or the true positive rate, which is the per-
centage of true positive predictions in comparison to all
the actual positive examples in the dataset. It measures the
ability of the model to correctly identify the positive class
[5658].
F1score is a statistical measure that combines precision
and recall in a balanced way, utilizing the harmonic mean.
It is frequently used as a sole performance metric to evalu-
ate the efficacy of classification models [5658]. Formula
for F1score:
Experimental results anddiscussions
Here's a summary of the outcomes obtained from employing
deep learning methodologies to train convolutional neural
network structures, including SqueezeNet, and InceptionV3.
Orange data mining was utilized for creating the AI model
designs in the suggested study. The research employed a
computer running Windows 11 Enterprise version 22H2
equipped with an Intel® Core™ i7-870H processor clocked
at 2.20GHz and 16GB of RAM. The computer's storage
capacity included a 2TB HDD and a 250GB SSD, and it
featured an NVIDIA GeForce GTX 1050 Ti graphics card.
Table3 displays the learning parameters utilized in the pre-
sent study. The Orange data mining desktop software was
utilized to develop a classification model. Different param-
eters were utilized for each machine learning algorithm and
these values can be found in the table. The parameters for
machine learning used in the study were chosen from the
default parameters [59, 60] that are offered in the Orange
Data Mining tool.
The dataset was extracted at first step and the features that
were extracted and selected. After selecting and preparing
(1)
Accuracy = (TP + TN)∕(TP + FP + TN + FN) × 100
(2)
Precision = TP∕(TP + FP)
(3)
Recall = TP∕(TP + FN)
(4)
F1 score = 2× (Precision × Recall)∕(Precision + Recall)
Table 2 Confusion matrix for
fresh fish classification Predicted
Fresh Stale
Actual
Fresh TP FN
Stale FP TN
1986 European Food Research and Technology (2023) 249:1979–1990
1 3
the data, the Training-Test data distribution phase was
executed. This phase involved implementing a 10-layer
cross-validation methodology to classify the data. The clas-
sification process was completed during this stage. Five dif-
ferent categorization techniques were used to evaluate the
effectiveness of neural networks. These techniques included
Random Forest, artificial neural networks, support vector
machines, k-nearest neighbors, and logistic regression.
According to Table4, The SqueezeNet model had the
most successful results when used with SVM and LR mod-
els. All the images were accurately classified as either fresh
or stale, with no misclassified images. However, the results
differed when k-NN, ANN, and RF models were used, as
they did not perform as well as the SVM and LR models
with the SqueezeNet. In k-NN 2 predictions were misclas-
sified they were stale but predicted as fresh, and 1 fresh
image was predicted as stale. While in ANN algorithm1
stale and 1 fresh image were predicted wrongly. So far in
RF 9 stale images were predicted as fresh and 3 were fresh
but predicted incorrectly.
Depending on Table5, the InceptionV3 model was uti-
lized with 5 distinct machine learning models. The best
results were achieved with SVM and LR models, as they
accurately classified 2581 images as fresh, and predicted
them as fresh, while also correctly identifying 1895 images
as stale. While the k-NN model misclassified 5 images from
stale fish and 1 from fresh once. However, the RF model
produced different results, with 2575 images being correctly
classified, while 1881 images that were actually stale were
mistakenly classified as stale. So far for ANN model the
misclassified image was for a fresh fish that was predicted
as stale.
In accordance with the Tables6 and 7, the results
obtained from each model were almost identical to the
other algorithms. SVM, ANN, and LR produced accurate
results for the SqueezeNet algorithm, and this was also the
Table 3 Machine learning parameters in Orange
Models k-NN SVM ANN LR RF
Parameters Number of neighbors: 5 Cost(C): 1.00 Neurons in hidden layers: 100 Regularization
type: Ridge
(L2)
Number of trees: 10
Metric: Euclidean Regression loss epsilon(Ɛ): 0.10 Activation: ReLu Strength C = 1 Do not split subsets
smaller than: 5
Weight: Uniform Kernel: RBF
g: auto
Solver: Adam
Regularization,
α = 0.0001
Numerical tolerance: 0.0010 Maximal number of iterations:
200
Iteration limit: 100
Table 4 Confusion matrix with SqueezeNet
k-NN
Predicted
Fresh Stale
Actual
Fresh 2580 1
Stale 2 1893
SVM
Predicted
Fresh Stale
Actual
Fresh 2581 0
Stale 0 1895
ANN
Predicted
Fresh Stale
Actual
Fresh 2580 1
Stale 1 1894
LR
Predicted
Fresh Stale
Actual
Fresh 2581 0
Stale 0 1895
RF
Predicted
Fresh Stale
Actual
Fresh 2578 3
Stale 9 1886
1987European Food Research and Technology (2023) 249:1979–1990
1 3
case for the InceptionV3 algorithm. The two tables present
data on the performance measurements of machine learning
models, including accuracy, precision, recall, and F1 score.
The accuracy results are presented as percentages for each
model, while precision, recall, and F1 score are given as
decimal values. The results obtained from the models show
accuracy rates ranging from 99 to 100%, with the excep-
tion of the RF model which has a slightly lower accuracy
rate of 99.7%. The results indicate that there is minimal dif-
ference between the performance of the machine learning
models when using the features extracted by SqueezeNet
and InceptionV3. Both feature extraction methods yielded
comparable results when paired with the chosen machine
learning algorithms.
Our study produced better results when compared to a
previous study that used the same data set of 4000 images
with an equal number of fresh and stale images. The related
findings showed that a combination of VGG-16 and Bi-
directional LSTM methods achieved a success rate of 98.0%
[34].
The study's findings suggest that other machine learning
algorithms, which were not employed in this research, could
potentially yield similar accuracy results to those reported
in the study. However, given the reported high accuracy
rates of 100% achieved by the selected machine learning
algorithms and their performance superiority compared to
the previous study, it is recommended that future research
endeavors should focus on exploring the potential of these
other algorithms.
The prediction results presented. In terms of the ANN
model, the outcomes were 100%, and 100% for each of the
deep learning methods. On the other hand, the k-NN results
were 99.9%. For SqueezeNet 99.7% and 99.6% for RF was
obtained by InceptionV3 extraction. Results for SVM were
100% and 100% for both SqueezeNet and InceptionV3 mod-
els. So far the results don’t change in LR and they were both
100%. The results gained in RF were lower according to the
other model and it was 99.7% in SqueezeNet and 99.6% in
InceptionV3.
Since the freshness of fish is not detected easily, espe-
cially in the areas where they are far from sea or fish is
not the major food. Detecting the freshness of fish is not a
problem for cities that consume fish or for local fishermen.
However, it will be difficult to find fresh fish if we include
Table 5 Confusion matrix with InceptionV3
k-NN
Predicted
Fresh Stale
Actual
Fresh 2580 1
Stale 5 1890
SVM
Predicted
Fresh Stale
Actual
Fresh 2581 0
Stale 0 1895
ANN
Predicted
Fresh Stale
Actual
Fresh 2580 1
Stale 0 1895
LR
Predicted
Fresh Stale
Actual
Fresh 2581 0
Stale 0 1895
RF
Predicted
Fresh Stale
Actual
Fresh 2575 6
Stale 14 1881
Table 6 Evaluation of SqueezeNet-based metrics for ML models
Algorithms Accuracy (%) Precision Recall F1 score
k-NN 99.9 0.999 0.999 0.999
SVM 100 1.000 1.000 1.000
Random Forest 99.7 0.997 0.997 0.997
ANN 100 1.000 1.000 1.000
Logistic Regression 100 1.000 1.000 1.000
Table 7 Evaluation of InceptionV3-based metrics for ML models
Algorithms Accuracy (%) Precision Recall F1 score
k-NN 99.9 0.999 0.999 0.999
SVM 100 1.000 1.000 1.000
Random Forest 99.6 0.996 0.996 0.996
ANN 100 1.000 1.000 1.000
Logistic Regression 100 1.000 1.000 1.000
1988 European Food Research and Technology (2023) 249:1979–1990
1 3
other areas. For this reason, the study was conducted to
address this issue.
Machines that learn from experience and perform tasks
autonomously are the ultimate goal of artificial intelligence.
By adapting to various situations, making decisions based
on data analysis, and communicating with humans naturally,
these machines will be able to make better decisions. While
the artificial intelligence is used and the methods among this
science were applied to human’s daily life and utilizing the
deep learning with machine learning. The ultimate goal of
feature classification in deep learning is to enable machines
to learn and generalize from complex, unstructured data,
through the automated extraction of features, deep learn-
ing models have the potential to achieve higher levels of
accuracy and performance compared to traditional machine
learning models that heavily rely on manually crafted fea-
tures. This is the reason, DL models performed on the avail-
able dataset and then prediction taken place. The ultimate
goal of prediction in machine learning is to build models
that can make accurate and reliable predictions on new,
unseen data, which can be used to inform decision making
and improve outcomes.
This research presents a hybrid method of using deep
learning and machine learning models to evaluate the fresh-
ness of fish. While previous studies have tested different
algorithms through various methods and models of AI, this
study employs a unique approach that demonstrates the
potential of using these techniques for objective fish fresh-
ness evaluation. It is recommended that future research
endeavors should focus on exploring the potential of other
algorithms. As noted in the introduction, the freshness of a
fish can also be determined by examining its gills. Therefore,
this study's approach of using deep learning techniques to
evaluate fish freshness could be applied to a dataset con-
taining images of fish gills. Such a dataset could potentially
allow for the development of a model that is specifically
tailored to detecting fish freshness through gill images. The
use of SqueezeNet and InceptionV3 for feature extraction in
combination with the five different ML models proves to be
a promising and effective method for determining fish fresh-
ness. This approach has the potential for future applications
in the food industry, offering a reliable and objective method
for evaluating the freshness of fish.
Conclusion
Humans can assess the freshness of fish by examining its
eyes, smelling it, and inspecting its gills, but for machines
accomplishing the same task will not be easy. A method of
determining the freshness of fish using deep learning tech-
niques proposed in this study. In the conducted research,
a dataset was used to classify fish body freshness into two
categories, as fresh or stale to determine whether a fish was
fresh or stale. Several deep learning algorithms were used
in training machine learning models, including SqueezeNet,
and InceptionV3.
The results showed that the dataset was effective in suc-
cessfully determining the freshness of the fish. The results
were impressive, as the proposed model used a total of 4476
images of fresh and stale fish. For each of the algorithms
(SqueezeNet, and InceptionV3), various machine learn-
ing models (k-NN, SVM, LR, RF, and ANN) were used.
Briefly the dataset extracted its features with the mentioned
deep learning separately then the results were trained by the
machine learning one by one. The machine learning models
achieved high accuracy rates, ranging from 99.6 to 100%,
for evaluating the freshness of fish using SqueezeNet and
InceptionV3 feature extraction. The results demonstrate the
effectiveness of the approach in objectively determining fish
freshness.
Numerous research studies have been conducted on
detecting fish and categorizing its freshness using various
approaches such as chemical or biological methods or differ-
ent sensor types. Furthermore, research studies using deep
learning algorithms to detect freshness have been conducted.
This study's unique aspect is that it utilized the same data-
set as previous studies, without modifying the dataset, and
achieved a higher success rate using methods other than
the VGG-16 neural network architecture and Bi-directional
Long Short-Term Memory model which is used in the previ-
ous study.
Acknowledgements We would like to thank the Scientific Research
Coordinatorship of Selcuk University for their support with the pro-
ject titled “Data-Intensive and Computer Vision Research Laboratory
Infrastructure Project” numbered 20301027.
Author contributions ETY: conceptualization, methodology, software,
validation, formal analysis, writing—review and editing. IAO: concep-
tualization, methodology, software, validation, formal analysis, writ-
ing. MK: conceptualization, methodology, software, validation, formal
analysis, writing.
Data availability Contacting the corresponding authors Abu Rayan
[33], or accessing to the study's dataset can be found here,https:// www.
kaggle. com/ datas ets/ muham madab urayan/ fish- fresh ness- class ifica t ion
Declarations
Conflict of interest The authors have stated that they do not have any
known financial interests or personal relationships that could poten-
tially affect the work presented in this report.
References
1. Dutta MK, Issac A, Minhas N, Sarkar B (2016) Image processing
based method to assess fish quality and freshness. J Food Eng
177:50–58. https:// doi. org/ 10. 1016/j. jfood eng. 2015. 12. 018
1989European Food Research and Technology (2023) 249:1979–1990
1 3
2. MohammadiLalabadi H, Sadeghi M, Mireei SA (2020) Fish
freshness categorization from eyes and gills color features using
multi-class artificial neural network and support vector machines.
Aquacult Eng. https:// doi. org/ 10. 1016/j. aquae ng. 2020. 102076
3. Jose JA, Kumar CS, Sureshkumar S (2022) Tuna classification
using super learner ensemble of region-based CNN-grouped
2D-LBP models. Inform Process Agric 9(1):68–79. https:// doi.
org/ 10. 1016/j. inpa. 2021. 01. 001
4. Erasmus VN, Kadhila T, Thyberg K, Kamara EN, Bauleth-
D’Almeida G (2021) Public perceptions and factors affecting
domestic marine fish consumption in Namibia, southwestern
Africa. Region Stud Marine Sci. https:// doi. org/ 10. 1016/j. rsma.
2021. 101921
5. Prabhakar PK, Vatsa S, Srivastav PP, Pathak SS (2020) A com-
prehensive review on freshness of fish and assessment: analytical
methods and recent innovations. Food Res Int 133:109157. https://
doi. org/ 10. 1016/j. foodr es. 2020. 109157
6. Franceschelli L, Berardinelli A, Dabbou S, Ragni L, Tartagni M
(2021) Sensing technology for fish freshness and safety: a review.
Sensors 21(4):1373. https:// doi. org/ 10. 3390/ s2104 1373
7. Mitra S, Khatun MN, Prodhan MMH, Khan MA (2021) Consumer
preference, willingness to pay, and market price of capture and
culture fish: do their attributes matter? Aquaculture. https:// doi.
org/ 10. 1016/j. aquac ulture. 2021. 737139
8. Hashanuzzaman M, Bhowmik S, Rahman MS, Zakaria M, Vou-
mik LC, Mamun AA (2020) Assessment of food safety knowl-
edge, attitudes and practices of fish farmers and restaurants food
handlers in Bangladesh. Heliyon 6(11):e05485. https:// doi. org/ 10.
1016/j. heliy on. 2020. e05485
9. Prasetyo E, Suciati N, Fatichah C (2022) Yolov4-tiny with wing
convolution layer for detecting fish body part. Comput Electron
Agric. https:// doi. org/ 10. 1016/j. compag. 2022. 107023
10. Banwari A, Chandra Joshi R, Sengar N, Kishore Dutta M (2022)
Computer vision technique for freshness estimation from seg-
mented eye of fish image. Ecol Inform. https:// doi. org/ 10. 1016/j.
ecoinf. 2022. 101602
11. Ghaly AE, Dave D, Budge S, Brooks MS (2010) Fish spoilage
mechanisms and preservation techniques: review. Am J Appl Sci
7(7): 859–877. https:// schol ar. google. com. tr/ schol ar_ url? url=
https:// www. acade mia. edu/ downl oad/ 84498 071/ 6b665 5e245
85a48 7fa26 d8c42 932a5 4944d9. pdf& hl= en& sa= X& ei= 1haTY
7izKO iTy9Y Prsil 4Aw& scisig= AAGBf m0dlA 8O7YD 7MBbn
D3vFM q0PaJ jLoA& oi= schol arr
12. Saeed R, Feng H, Wang X, Zhang X, Fu Z (2022) Fish quality
evaluation by sensor and machine learning: a mechanistic review.
Food Control. https:// doi. org/ 10. 1016/j. foodc ont. 2022. 108902
13. Alasalvar C, Shahidi F, Miyashita K, Wanasundara U (2010) Sea-
food quality, safety, and health applications: an overview. Hand-
book of seafood quality, safety and health applications, 1–10.
14. Suresh A, Vinayachandran A, Philip C, Velloor JG, Pratap A
(2021) Fresko pisces: fish freshness identification using deep
learning. In: Raj JS, Iliyasu AM, Bestak R, Baig ZA (eds) Inno-
vative Data Communication Technologies and Application,
Singapore.
15. Taheri-Garavand A, Nasiri A, Banan A, Zhang Y-D (2020) Smart
deep learning-based approach for non-destructive freshness diag-
nosis of common carp fish. J Food Eng. https:// doi. org/ 10. 1016/j.
jfood eng. 2020. 109930
16. Jany Arman R, Hossain M, Hossain S (2022) Fish classification
using saliency detection depending on shape and texture. Comput
Sist 26(1): 303–310. https:// doi. org/ 10. 13053/ CyS- 26-1- 4174
17. Kunjulakshmi S, Harikrishnan S, Murali S, D’Silva JM, Binsi PK,
Murugadas V, Alfiya PV, Delfiya DSA, Samuel MP (2020) Devel-
opment of portable, non-destructive freshness indicative sensor
for Indian Mackerel (Rastrelliger kanagurta) stored under ice. J
Food Eng. https:// doi. org/ 10. 1016/j. jfood eng. 2020. 110132
18. Issac A, Dutta MK, Sarkar B (2017) Computer vision based
method for quality and freshness check for fish from segmented
gills. Comput Electron Agric 139:10–21. https:// doi. org/ 10.
1016/j. compag. 2017. 05. 006
19. Muri Knausgard K, Wiklund A, Knutsen Sørdalen T, Tal-
laksen Halvorsen K, Ring Kleiven A, Jiao L, Goodwin M
(2022) Temperate fish detection and classification: a deep
learning based approach. Appl Intell. https:// doi. org/ 10. 1007/
s10489- 020- 02154-9
20. Hu J, Zhou C, Zhao D, Zhang L, Yang G, Chen W (2020) A
rapid, low-cost deep learning system to classify squid spe-
cies and evaluate freshness based on digital images. Fish Res.
https:// doi. org/ 10. 1016/j. fishr es. 2019. 105376
21. Wu T, Lu J, Zou J, Chen N, Yang L (2022) Accurate prediction
of salmon freshness under temperature fluctuations using the
convolutional neural network long short-term memory model.
J Food Eng. https:// doi. org/ 10. 1016/j. jfood eng. 2022. 111171
22. Ali-Gombe A, Elyan E, Jayne C (2017) Fish classification in
context of noisy images. In: Engineering Applications of Neu-
ral Networks (pp. 216–226). https:// doi. org/ 10. 1007/ 978-3- 319-
65172-9_ 19
23. Abinaya NS, Susan D, Kumar R (2021) Naive Bayesian fusion
based deep learning networks for multisegmented classification
of fishes in aquaculture industries. Ecol Inform. https:// doi. org/
10. 1016/j. ecoinf. 2021. 101248
24. Singh CH, Kumar SA, Nijhawan R (2020) A hybrid deep learn-
ing approach for automatic fish classification. In: Proceedings
of ICETIT 2019. Springer, 427–436. https:// doi. org/ 10. 1007/
978-3- 030- 30577-2_ 37
25. Kaya E, Sarıtas I, Tasdemir S (2018) Classification of three
different fish species by artificial neural networks using shape,
color and texture properties. In: 7th International Conference
on Advanced Technologies (ICAT'18), 381–384.
26. Fouad MM, Zawbaa M, El-Bendaryl HN, Hassanien AE
(2013) Automatic nile tilapia fish classification approach using
machine learning techniques. In: 13th International Conference
on Hybrid Intelligent Systems (HIS 2013), 173–178. https:// doi.
org/ 10. 1109/ HIS. 2013. 69204 77
27. Pornpanomchai C, Lurstwut B, Leerasakultham P, Kitiyanan W
(2013) Shape- and texture-based fish image recognition system.
Kasetsart J (Nat Sci) 47(4): 624–634. https:// li01. tci- thaijo. org/
index. php/ anres/ artic le/ view/ 243105.
28. Chen G, Sun P, Shang Y (2017) Automatic fish classification
system using deep learning. In: 2017 IEEE 29th International
Conference on Tools with Artificial Intelligence (ICTAI)
29. dos Santos AA, Gonçalves WN (2019) Improving Pantanal fish
species recognition through taxonomic ranks in convolutional
neural networks. Ecol Inform. https:// doi. org/ 10. 1016/j. ecoinf.
2019. 100977
30. Kratzert F, Mader H (2018) Fish species classification in under-
water video monitoring using Convolutional Neural Networks.
EarthArXiv. https:// doi. org/ 10. 17605/ OSF. IO/ DXWTZ
31. Miyazono T, Saitoh T (2018) Fish species recognition based on
CNN using annotated image. IT Conv Secur 2017(449):156–163.
https:// doi. org/ 10. 1007/ 978- 981- 10- 6451-7_ 19
32. Rekha BS, Srinivasan GN, Reddy SK, Kakwani D, Bhattad N
(2020) Fish Detection and classification using convolutional neu-
ral networks. In: Computational Vision and Bio-Inspired Comput-
ing (pp. 1221–1231). https:// doi. org/ 10. 1007/ 978-3- 030- 37218-7_
128
33. Sayed GI, Hassanien AE, Gamal A, Ella HA (2018) An automated
fish species identification system based on crow search algorithm.
In: The International Conference on Advanced Machine Learn-
ing Technologies and Applications (AMLTA2018) (pp. 112–123).
https:// doi. org/ 10. 1007/ 978-3- 319- 74690-6_ 12
1990 European Food Research and Technology (2023) 249:1979–1990
1 3
34. Abu Rayan M, Rahim A, Rahman MA, Abu Marjan M, Ehsan Ali
UAM (2021) Fish freshness classification using combined deep
learning model. In: 2021 International Conference on Automation,
Control and Mechatronics for Industry 4.0 (ACMI), 1–5. https://
doi. org/ 10. 1109/ ACMI5 3878. 2021. 95281 38
35. Atasoy A, Ozsandikcioglu U, Guney S (2015) Fish freshness
testing with artificial neural networks. In: 2015 9th International
Conference on Electrical and Electronics Engineering (ELECO),
700–704. https:// doi. org/ 10. 1109/ ELECO. 2015. 73946 29
36. Issac A, Kishore Dutta M, Sarkar B, Burget R (2018) An efficient
image processing based method for gills segmentation from a digi-
tal fish image. In: 2016 3rd International Conference on Signal
Processing and Integrated Networks (SPIN). https:// doi. org/ 10.
1109/ SPIN. 2016. 75667 76
37. Kaladevi AC, Perumal R, Priya KA (2021) Detection of sardine
fish freshness using deep convolution neural network. Ann Roma-
nian Soc Cell Biol 25(4): 16063–16070. https:// annal sofrs cb. ro/
index. php/ journ al/ artic le/ downl oad/ 5348/ 4214
38. Abu Rayan M (2021) Fish Freshness classification [Images].
https:// www. kaggle. com/ datas ets/ muham madab urayan/ fish- fresh
ness- class ifica tion
39. Singh D, YavuzSelim T, Kursun R, Cinar I, Koklu M, Ozkan IA,
Lee H-N (2022) Classification and analysis of pistachio species
with pre-trained deep learning models. Electronics 11(7):981.
https:// doi. org/ 10. 3390/ elect ronic s1107 0981
40. Taspinar YS, Dogan M, Cinar I, Kursun R, Ozkan IA, Koklu
M (2022) Computer vision classification of dry beans (Pha-
seolus vulgaris L.) based on deep transfer learning techniques.
Eur Food Res Technol 248:2707–2725. https:// doi. org/ 10. 1007/
s00217- 022- 04080-1
41. Unal Y, Taspinar YS, Cinar I, Kursun R, Koklu M (2022) Appli-
cation of pre-trained deep convolutional neural networks for cof-
fee beans species detection. Food Anal Methods 15:3232–3243.
https:// doi. org/ 10. 1007/ s12161- 022- 02362-8
42. Taspinar YS, Cinar I, Koklu M (2022) Classification by a stack-
ing model using CNN features for COVID-19 infection diag-
nosis. J Xray Sci Technol 30(1):73–88. https:// doi. org/ 10. 3233/
XST- 211031
43. Koklu M, Taspinar YS (2021) Determining the extinguishing sta-
tus of fuel flames with sound wave by machine learning methods.
IEEE Access 9:86207–86216.https:// doi. org/ 10. 1109/ ACCESS.
2021. 30886 12
44. Dara S, Tumma P (2018) Feature extraction by using deep learn-
ing: a survey. In: 2018 Second international conference on elec-
tronics, communication and aerospace technology (ICECA)
45. Ramaneswaran S, Srinivasan K, Vincent PDR, Chang C-Y (2021)
Hybrid inception v3 XGBoost model for acute lymphoblastic leu-
kemia classification. Comput Math Methods Med 2021:1–10
46. Ali M, Kumar D (2021) A combination between deep learning for
feature extraction and machine learning for recognition. In: 2021
12th International Conference on Computing Communication and
Networking Technologies (ICCCNT)
47. Kishore B, Yasar A, Taspinar YS, Kursun R, Cinar I, Shankar VG,
Koklu M, Ofori I (2022) Computer-aided multiclass classifica-
tion of corn from corn images integrating deep feature extraction.
Comput Intell Neurosci 2022.
48. Kursun R, Cinar I, Taspinar YS, Koklu M (2022) Flower rec-
ognition system with optimized features for deep features. In:
2022 11th Mediterranean Conference on Embedded Computing
(MECO)
49. Cinar I, Koklu M (2022) Identification of rice varieties using
machine learning algorithms. J Agric Sci: 9–9.
50. Koklu M, Kursun R, Taspinar YS, Cinar I (2021) Classification of
date fruits into genetic varieties using image analysis. Math Prob
Eng 2021
51. Koklu M, Cinar I, Taspinar YS, Kursun R (2022) Identification
of sheep breeds by CNN- based pre-trained inceptionv3 model.
In: 2022 11th Mediterranean Conference on Embedded Comput-
ing (MECO), 01–04. https:// doi. org/ 10. 1109/ MECO5 5406. 2022.
97972 14
52. Koklu M, Sabancı K (2016) Estimation of credit card customers
payment status by using kNN and MLP. Int J Intell Syst Appl Eng
4(Special Issue-1): 249–251
53. Ahmed A, Jalal A, Kim K (2020) A novel statistical method for
scene classification based on multi-object categorization and
logistic regression. Sensors 20(14): 3871. https:// www. mdpi. com/
1424- 8220/ 20/ 14/ 3871
54. Cinar I, Koklu M (2019) Classification of rice varieties using
artificial intelligence methods. Int J Intell Syst Appl Eng 7(3):
188–194. https:// doi. org/ 10. 18201/ ijisae. 20193 55381
55. Xiong Z, Cui Y, Liu Z, Zhao Y, Hu M, Hu J (2020) Evaluating
explorative prediction power of machine learning algorithms for
materials discovery using k-fold forward cross-validation. Comput
Mater Sci 171:109203
56. Butuner R, Cinar I, Taspinar YS, Kursun R, Calp MH, Koklu M
(2023) Classification of deep image features of lentil varieties with
machine learning techniques. Eur Food Res Technol. https:// doi.
org/ 10. 1007/ s00217- 023- 04214-z
57. Dogan M, Taspinar YS, Cinar I, Kursun R, Ozkan IA, Koklu M
(2022) Dry bean cultivars classification using deep cnn features
and salp swarm algorithm based extreme learning machine. Com-
put Electron Agric 204:1–13. https:// doi. org/ 10. 1016/j. compag.
2022. 107575
58. Yacouby R, Axman D (2020) Probabilistic extension of precision,
recall, and f1 score for more thorough evaluation of classification
models. In: Proceedings of the first workshop on evaluation and
comparison of NLP systems
59. Atalan A (2023) Forecasting drinking milk price based on eco-
nomic, social, and environmental factors using machine learning
algorithms. Agribusiness 39(1):214–241
60. Itsari MYI, Budi I (2022) Classification of complaint categories in
e-commerce: a case study of PT bukalapak. In: 2022 5th Interna-
tional Conference on Information and Communications Technol-
ogy (ICOIACT)
Publisher's Note Springer Nature remains neutral with regard to
jurisdictional claims in published maps and institutional affiliations.
Springer Nature or its licensor (e.g. a society or other partner) holds
exclusive rights to this article under a publishing agreement with the
author(s) or other rightsholder(s); author self-archiving of the accepted
manuscript version of this article is solely governed by the terms of
such publishing agreement and applicable law.
... Fish consumption is motivated by its taste, health, quality, and freshness. The demand for high-quality and immune fish products has increased over the past few years due to recent changes in consumer lifestyles [23,53,54]. There are several factors associated with fish quality parameters that range from harvesting to consumption, such as safety, nutrition, availability, and freshness, which are affected by storage and processing methods [49]. ...
... The criteria used to determine freshness include sensory, physical, chemical, and microbiological. Rapid protein liquid chromatography and hyperspectral imaging techniques are also considered [37,53,54]. It is thought that a fish's eye region has a strong relationship between its coloration and the period during which they are stored. ...
... Consequently, it can be challenging for most consumers to determine whether a fish is fresh while they are shopping. By touching and squeezing the fish's body to determine its flexibility, you may quickly determine how fresh it is [53,54]. Normally fresh fish has higher elasticity. ...
Article
Full-text available
Fish is commonly ingested as a source of protein and essential nutrients for humans. To fully benefit from the proteins and substances in fish it is crucial to ensure its freshness. If fish is stored for an extended period, its freshness deteriorates. Determining the freshness of fish can be done by examining its eyes, smell, skin, and gills. In this study, artificial intelligence techniques are employed to assess fish freshness. The author’s objective is to evaluate the freshness of fish by analyzing its eye characteristics. To achieve this, we have developed a combination of deep and machine learning models that accurately classify the freshness of fish. Furthermore, an application that utilizes both deep learning and machine learning, to instantly detect the freshness of any given fish sample was created. Two deep learning algorithms (SqueezeNet, and VGG19) were implemented to extract features from image data. Additionally, five machine learning models to classify the freshness levels of fish samples were applied. Machine learning models include (k-NN, RF, SVM, LR, and ANN). Based on the results, it can be inferred that employing the VGG19 model for feature selection in conjunction with an Artificial Neural Network (ANN) for classification yields the most favorable success rate of 77.3% for the FFE dataset. Graphical Abstract
... As a result, they reported that the proposed NasNet-LSTM approach achieved impressive Matthew correlation coefficient (MCC) and Cohen's kappa coefficient (KC) scores of 99.1% (Lanjewar & Panchbhai, 2023). Yasin et al. (2023) using a dataset consisting of 4476 fish body images classified as fresh and stale, SVM (Support Vector Machines), ANN (Artificial Neural Networks), and LR (Logistic Regression) models from deep learning algorithms to classify fish according to their freshness resulted in 100% accuracy for each deep learning method (Yasin et al., 2023). ...
... As a result, they reported that the proposed NasNet-LSTM approach achieved impressive Matthew correlation coefficient (MCC) and Cohen's kappa coefficient (KC) scores of 99.1% (Lanjewar & Panchbhai, 2023). Yasin et al. (2023) using a dataset consisting of 4476 fish body images classified as fresh and stale, SVM (Support Vector Machines), ANN (Artificial Neural Networks), and LR (Logistic Regression) models from deep learning algorithms to classify fish according to their freshness resulted in 100% accuracy for each deep learning method (Yasin et al., 2023). ...
Article
Full-text available
Fish is regarded as an important protein source in human nutrition due to its high concentration of omega-3 fatty acids In traditional global cuisine, fish holds a prominent position, with seafood restaurants, fish markets, and eateries serving as popular venues for fish consumption. However, it is imperative to preserve fish freshness as improper storage can lead to rapid spoilage, posing risks of potential foodborne illnesses. To address this concern, artificial intelligence techniques have been utilized to evaluate fish freshness, introducing a deep learning and machine learning approach. Leveraging a dataset of 4476 fish images, this study conducted feature extraction using three transfer learning models (MobileNetV2, Xception, VGG16) and applied four machine learning algorithms (SVM, LR, ANN, RF) for classification. The synergy of Xception and MobileNetV2 with SVM and LR algorithms achieved a 100% success rate, highlighting the effectiveness of machine learning in preventing foodborne illness and preserving the taste and quality of fish products, especially in mass production facilities.
... Modifying the parameters of the SVM model [33][34][35], such as the regularization parameter (C) or the kernel function, will inevitably alter the classification results, while employing different datasets with the same parameters may yield varied outcomes due to the inherent characteristics and distributions of the data (Figure 3). ...
Article
This research examines the potential of machine learning methods in the classification of Mulberry leaf diseases. By applying SqueezeNet's deep feature extraction, the study aimed to identify disease patterns efficiently. The dataset used in the study consisted of ten distinct classes of Mulberry leaf diseases, which was divided into an 80% training set and a 20% testing set. The Support Vector Machine (SVM) supervised machine learning algorithm was used to classify the diseases, and the classification model achieved an accuracy of 77.5%. The results of the study demonstrate the effectiveness of machine learning approaches in aiding the detection and management of Mulberry leaf diseases, which can contribute to advancements in agricultural disease monitoring and mitigation strategies.
... Likewise, the term true negative (TN) represents the negative examples that have been accurately classified. The terms false positive (FP) and false negative (FN), on the other hand, refer to the positive and negative examples that the model has misclassified, respectively [59,60]. Table 1 presents a 5-class confusion matrix. ...
Article
Full-text available
The automatic detection of diseases in tomato leaves significantly contributes to tomato production and enables farmers to manage these issues more effectively. Tomatoes are a crucial commercial crop for local markets and exports, representing a significant agricultural sector in our country. Diseases affecting tomato leaves directly influence tomato yield and quality, making early detection and intervention paramount. Our study aims to address tomato losses due to leaf diseases using computer technology. Recently, Convolutional Neural Networks (CNN) have been employed in various fields including agriculture, military, robotics, and medicine for classification, object detection, and segmentation tasks. The integration of computer vision and image processing with deep learning architectures has led to notable advancements in these areas, offering solutions with higher accuracy and reducing human error. In our research, a dataset was created using images of tomato leaf diseases selected from Kaggle. Algorithms such as k-Nearest Neighbors (KNN), Random Forest (RF), Logistic Regression (LR), Support Vector Machine (SVM), and Neural Networks (NN) were applied using Orange, a data visualization and analysis software. Moreover, a custom algorithm developed in Python demonstrated the highest accuracy. while the highest classification accuracy of classification made with machine learning algorithms was 95.6%, the classification accuracy was achieved about 96% with the developed deep learning model. This system was integrated into an Amazon Web Services (AWS) Lambda function, subsequently utilized in a mobile application developed using Flutter for the UI and Dart for backend, ensuring connectivity with the Lambda function.
... In a recent study, Yasin used SqueezeNet and InceptionV3 to extract the feature changes of fish body images during storage in 2023, and finally used a machine learning algorithm to classify the freshness. This outcome indicated an accuracy of 99.6-100% [33]. These studies demonstrated the potential application of deep learning in the determination of fish freshness, providing a reliable approach for quality control and food safety. ...
Article
Full-text available
Conventional evaluation of fish freshness based on physiological and biochemical methods was destructive, complicated and costly. In this study, the new model was trained on the eye images of 100 large yellow croakers along with their total volatile basic nitrogen (TVB-N) value as freshness indicators in the storage of nine consecutive days at 4 °C. The experiment was divided into three stages (0–2 days, 3–6 days, and 7–8 days) based on TVB-N value, about 1000 images in each stage were used for freshness classification. A non-destructive and rapid fish freshness detection method based on the eye region images of large yellow croaker was proposed by mathematical modeling. The features of large yellow croaker images were extracted automatically by ResNet-34 structure, and then the key extracted feature was focused on the pupil of the fish eye by mixed attention mechanism. Finally, the features of pupil were used to classify the freshness of large yellow croaker. The results showed the accuracy of the model to classify the fish freshness was reached to 99.4%. The model constructed based on the eye images was non-destructive, and could well monitor and distinguish the freshness of large yellow croakers at different storage stages.
... It helps normalize the activations within each layer. ResNet has achieved state-of-the-art results in various image classification challenges, including the ImageNet Large Scale Visual Recognition Challenge (ILSVRC) [6]. ...
Article
Full-text available
Image classification has widespread applications in computer vision, with significant advancements in performance due to deep learning models. Cat and dog image classification, as a classic problem, has attracted considerable research interest. This study aims to conduct a comprehensive analysis and comparison of deep learning models, including LeNet, ResNet, and VGG, in the context of cat and dog image classification. This paper employed two datasets: traditional cat and dog images and non-traditional, diverse images. Data preprocessing and augmentation were applied, and various model architectures were constructed. Through training and testing, this paper assessed the performance of these models under different conditions. The research findings indicate that ResNet excels in handling various datasets and different dataset sizes, demonstrating outstanding image classification performance. LeNet performs well on traditional datasets but experiences performance degradation when dealing with non-traditional datasets and smaller dataset sizes. VGG performs reasonably well on the original dataset but needs help processing non-traditional datasets. These results provide valuable insights for guiding model selection and optimization in image classification tasks.
... CNN architectures extract features through layers based on input data and learn and classify using these features. Essentially, CNN architectures consist of five layers: convolutional layer, pooling layer, activation layer, fully connected layer, and softmax layer [36][37][38][39][40]. The learning process is one of the most important and challenging stages in CNN architectures. ...
Article
Full-text available
Nowadays, it is crucial to transfer official documents such as invoices, dispatch notes, and receipts into digital environments and establish correct semantic relationships. However, understanding and processing these documents is a difficult process that requires significant time and effort. In recent years, the use of deep learning, image preprocessing, text detection, and optical character recognition (OCR) technologies have made this process easier. However, for text recognition and processing techniques to produce accurate results, documents must be clean and readable. Additionally, difficulties arising from time-consuming, tiring, error-prone, and cost-incurring human-powered digitalization processes must be reduced. The aim of this study is to digitize and archive scanned invoices and similar official documents using current artificial intelligence technologies, thereby enabling the most effective use of components such as time, cost, and human resources. The dataset used in the study includes 10,000 ".jpg" image files and 10,000 ".xml" data files. The model trained with the ResNet-50 architecture can detect text with accuracy rates of up to 97% on randomly selected images from the dataset. In an environment where a person can process an average of 2,112 documents per month, it is predicted that the trained artificial intelligence model can process 108,000 documents per month. With this developed method, businesses can quickly digitize and archive official documents such as invoices, dispatch notes, and receipts. Future studies propose the development of new methods that can produce better results using larger and more diverse datasets.
Article
Full-text available
Determination of the condition factor in fish is an indispensable element in protecting fish health and improving the status of the population. In this study, the condition factor (CF) of fish was predicted using three input parameters including length, weight and sex. In this paper, the results obtained with six machine learning algorithms; Support vector machine (SVM), Neural Network/Multilayer Perceptron (MLP), Ensemble Learning, Gaussian Process Regression (GPR), Decision Tree and Linear Regression were compared with a multilayer perceptron artificial neural network (MLP-ANN), which is one of the statistical tools to predict the condition factor value obtained in this paper. As a result of the benchmarking, the Levenberg-Marquardt learning algorithm with 3-9-1 architecture neurons was found to be the best network for the hidden layer. The output of this model was the most effective for condition factor modeling with R2 values (R2= training (1), testing (0.99), validation (1) and overall (0.99)). This value is indicative of the high quality of this model compared to other existing models. Up to now, multilayer perceptron artificial neural network (MLP-ANN) has achieved significant success in predicting the condition factor.
Article
Fish freshness is an essential feature of the fishing industry because it affects the safety and quality of the product. Precisely estimating seafood freshness is critical for consumer pleasure and waste reduction. This study presented a fish freshness prediction framework using two datasets from Kaggle, which were combined but highly imbalanced. Both upscaling (SMOTEENN) and downscaling (Random Under Sampler) methods were used to address the dataset imbalance. Neural Architecture Search Network (NasNet) and Long Short-Term Memory Networks (LSTM) models were employed to extract features from images. A feature selection technique was also applied to identify the most relevant features from the extracted features. The proposed NasNet-LSTM approach achieved impressive Matthew's correlation coefficient (MCC) and Cohen's kappa coefficient (KC) scores of 99.1%. The models were also cross-validated using a 5-fold method, resulting in MCC and KC values of 97%. Moreover, the p-value and confidence intervals of the proposed method were analyzed.
Article
Full-text available
Today, image classification methods are widely utilized on agricultural products or in agricultural applications. However, many of these methods based on traditional approaches remain unsatisfactory in terms of obtaining effective results. Within this context, this study aimed to classify lentil images by machine learning algorithms, a current and effective method. In line with this purpose, first of all, a camera system was prepared primarily and a dataset was created by recording lentil grains at 225 × 225 resolution via this system. The dataset contains a total of 33,938 data obtained from 3 lentil species as green, yellow, and red. SqueezeNet, InceptionV3, DeepLoc, and VGG16 architectures, among the CNN methods, were used in order to extract features from the recorded images. Lastly, Artificial Neural Network (ANN), Naive Bayes (NB), Random Forest (RF), Adaptive Boosting (AB), and Decision Tree (DT) algorithms were utilized with the aim of creating models for lentil images’ classification. The classification success of the created machine learning models was calculated and the results were analyzed. The highest classification success with the deep features obtained from the SqueezeNet model, 99.80%, was achieved in the ANN algorithm. The results also revealed that grain size and shape features in image classification can yield much more detailed and precise data than can be obtained practically with manual quality assessment.
Article
Full-text available
Corn has great importance in terms of production in the field of agriculture and animal feed. Obtaining pure corn seeds in corn production is quite significant for seed quality. For this reason, the distinction of corn seeds that have numerous varieties plays an essential role in marketing. This study was conducted with 14,469 images of BT6470, Calipso, Es_Armandi, and Hiva types of corn licensed by BIOTEK. The classification of images was carried out in three stages. At the first stage, deep feature extraction of the four types of corn images was performed with the pretrained CNN model SqueezeNet 1000 deep features were obtained for each image. In the second stage, in order to reduce these features obtained from deep feature extraction with SqueezeNet, separate feature selection processes were performed with the Bat Optimization (BA), Whale Optimization (WOA), and Gray Wolf Optimization (GWO) algorithms among optimization algorithms. Finally, in the last stage, the features obtained from the first and second stages were classified by using the machine learning methods Decision Tree (DT), Naive Bayes (NB), multi-class Support Vector Machine (mSVM), k-Nearest Neighbor (KNN), and Neural Network (NN). In the classification processes of the features obtained in the first stage, the mSVM model has achieved the highest classification success with 89.40%. In the second stage, as a result of the classifications performed through the active features selected by using three types of feature selection algorithms (BA, WOA, GWO), the classification success obtained with the mSVM model was 88.82%, 88.72%, and 88.95%, respectively. The classification accuracies of the tested methods and the classification accuracies obtained in the first stage are close to each other in terms of classification success. However, with the algorithms used in feature selection, successful classification processes have been carried out with fewer features and in a shorter time. The results of the study, in which classification was carried out in the inexpensive, the objective, and the shorter time of processing for the corn types, present a different perspective in terms of classification performance.
Article
Full-text available
There are many types of haricot beans, the nutrient consumed all over the world. Each type differs in terms of features such as taste, size, economic value, etc. But even if they are different types, bean grains are frequently confused with each other. For these reasons, it is important to separate the bean grains of different species. For this purpose, a haricot bean dataset consisting of 33,064 images of 14 different bean types was created. By using these images, 3 different pre-trained Convolutional Neural Networks (CNN) were trained via the transfer learning method. Within the scope of the study, InceptionV3, VGG16, and VGG19 CNN models were used. These models were utilized for both end-to-end classification and extraction of image features. Firstly, the images were classified via Inception V3, VGG16, and VGG19 models. As a result of this classification, 84.48%, 80.63%, and 81.03% classification success were obtained from InceptionV3, VGG16, and VGG19 models, respectively. Secondly, the image features of these 3 models were taken from the layer just before the classification layer. Then, these features were given as input to the Support Vector Machine (SVM) and Logistic Regression (LR) models. Images were classified using six different models, InceptionV3 + SVM, VGG16 + SVM, VGG1 + SVM and InceptionV3 + LR, VGG16 + LR, VGG1 + LR. Classification successes obtained from InceptionV3 + SVM, VGG16 + SVM, and VGG19 + SVM were 79.60%, 81.97%, 80.64%, respectively. And, the classification successes obtained from InceptionV3 + LR, VGG16 + LR, and VGG19 + LR were 82.35%, 83.71%, and 83.54%, respectively. The InceptionV3, among all models, was determined to be the best classification model with a classification success of 84.48%. On the other hand, the model with the lowest classification success was determined to be the InceptionV3 + SVM. Detailed analysis of the created models was also carried out with precision, recall, and F-1 score metrics. It is thought that the proposed models can be used to distinguish haricot bean types in a quick and accurate way. Furthermore, the proposed computer vision methods can be combined with robotic systems and used to the distinction of bean types. By means of image processing, varieties can be determined on conveyor belts, and dry bean varieties can be purified with delta robots.
Article
Full-text available
Coffee is an important export product of the tropical countries where it is grown. Therefore, the separation of coffee beans in the world in terms of the quality element and variety forgery is an important situation. Currently, the use of manual control methods leads to the fact that the parsing processes are inconsistent, time-consuming, and subjective. Automated systems are needed to eliminate such negative situations. The aim of this study is to classify 3 different coffee beans by using their images, through the transfer learning method by utilizing 4 different Convolutional Neural Networks-based models, which are SqueezeNet, Inception V3, VGG16, and VGG19. The dataset used in the models’ training was created specially for this study. A total of 1554 coffee bean images of Espresso, Kenya, and Starbucks Pike Place coffee types were collected with the created mechanism. Model training and model testing processes were carried out with the obtained images. In order to test the models, the cross-validation method was used. Classification success, Precision, Recall, and F-1 Score metrics were used for the detailed analysis of the models of performances. ROC curves were used for analyzing their distinctiveness. As a result of the tests, the average classification success of the models was determined as 87.3% for SqueezeNet, 81.4% for Inception V3, 78.2% for VGG16, and 72.5% for VGG19. These results demonstrate that the SqueezeNet is the most successful model. It is thought that this study may contribute to the subject of coffee beans of separation in the industry.
Article
Full-text available
Classification of fishes becomes important after the advancement of machine learning. As fishes play a vital role in the economy of Bangladesh, a proper monitoring system will maximize the cultivation. It will also contribute to the overall economy. Therefore, here introduce a system that can detect the fishes and compare various methods with explanations to understand the selected methods. This paper have considered 5 categories of local fishes of Bangladesh in the dataset. The technique consists of preprocessing with segmentation, feature descriptor, and ensembles to produce the final result. U2-net is used in the preprocessing layer to obtain two types of features namely shaped images and colored images with removed backgrounds. To get the features, we have used a histogram of oriented gradient (HOG) and an ensemble layer is used for classification purposes. Experimental results illustrate the accuracy of 99.77% for the first ensemble and 100% for the second ensemble layer on our dataset of 2678 fishes of 5 distinguishing classes. Various layers were used to compare the predicted results using different performance metrics.
Article
Since dry bean varieties have different qualities and economic values, their separation is of great importance in the field of agriculture. In recent years, the use of artificial intelligence-supported and image-based systems has become widespread for this process. This study aims to create a data set consisting of 14 classes in the detection of dry beans and to investigate the effectiveness of the hybrid structure of the extreme learning machine (ELM) model with GoogLeNet transfer learning on this dataset. At the same time, the salp swarm algorithm (SSA), which is one of the swarm intelligence algorithms, was used to test its applicability in ELM classifier by optimizing ELM parameters. The performance of these models was compared with ELM-based particle swarm optimization, harris hawks optimization, artificial bee colony, and traditional machine learning algorithms such as support vector machine and k-nearest neighbor. The suggested SSA-ELM model successfully classifies 14 different types of dry beans with a success rate of 91.43%. The comparable results demonstrate that the proposed hybrid model had better classification accuracy and performance metrics than traditional machine learning algorithms. In addition, it is seen that the use of image data, extraction of deep features, and classification with optimized ELM in the classification of dry beans have achieved comparable success in the literature.
Article
The study aimed to describe and test machine learning (ML)‐based algorithms to evaluate the unit price of drinking milk. The algorithms were applied to the data collected over 8 years in 2014 and 2021 related to the price of drinking milk in Turkey. The economic, social, and environmental factors that have an impact on the unit price of drinking milk were evaluated. Five ML algorithms, including random forest, gradient boosting, support vector machine (SVM), neural network, and AdaBoost algorithms, were utilized to predict the drinking milk unit price. ML also applied hyperparameter tuning with nested cross‐validation to calculate the prediction accuracy for each algorithm. The results show that the random forest algorithm based on the features of the ML algorithms has the best performance, with the accuracy of 99.30% for training and 98.10% for testing the dataset. The average accuracy of gradient boosting, SVM, neural network, and AdaBoost are obtained as 97.30%, 96.15%, 95.65%, and 96.05%, respectively. Random forest performed best as the target variable with the lowest deviation values of mean squared error (MSE) (0.004), root mean square error (RMSE) (0.060), and mean absolute error (MAE) (0.029) in the training and MSE (0.009), RMSE (0.096), and MA (0.055) in the testing dataset. This study presents an interesting perspective with practical potential to adopt ML methods in the dairy industry. The developed ML algorithms can provide dairy investors and policymakers with important decision‐support information. [EconLit Citations: C13, C53, L66, C88].