Next Article in Journal
Fourth-Order Quadratic Buck Converter Controller Design
Previous Article in Journal
Improved LEACH Protocol Based on Underwater Energy Propagation Model, Parallel Transmission, and Replication Computing for Underwater Acoustic Sensor Networks
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Convolutional Neural Network (CNN) Model for the Classification of Varieties of Date Palm Fruits (Phoenix dactylifera L.)

1
Department of Agronomy, Poznań University of Life Sciences, Dojazd 11, 60-632 Poznań, Poland
2
Department of Genetics and Plant Breeding, Poznań University of Life Sciences, Dojazd 11, 60-632 Poznań, Poland
3
Department of Cellular and Molecular Biology, Faculty of Natural Sciences and Life, University of El Oued, El Oued 39000, Algeria
4
Laboratory of Biodiversity and Application of Biotechnology in the Agricultural Field, Faculty of Natural Sciences and Life, University of El Oued, El Oued 39000, Algeria
5
Department of Microbiology and Biochemistry, Faculty of Sciences, Mohamed Boudiaf-M’sila University, M’sila 28000, Algeria
6
Department of Agricultural Sciences, University of El Oued, El Oued 39000, Algeria
7
Department of Agricultural Chemistry and Environmental Biogeochemistry, Poznań University of Life Sciences, Ul. Wojska Polskiego 71F, 60-625 Poznań, Poland
8
Department of Biosystems Engineering, Poznań University of Life Sciences, Wojska Polskiego 50, 60-637 Poznań, Poland
*
Author to whom correspondence should be addressed.
Sensors 2024, 24(2), 558; https://doi.org/10.3390/s24020558
Submission received: 23 October 2023 / Revised: 29 December 2023 / Accepted: 10 January 2024 / Published: 16 January 2024
(This article belongs to the Section Intelligent Sensors)

Abstract

:
The popularity and demand for high-quality date palm fruits (Phoenix dactylifera L.) have been growing, and their quality largely depends on the type of handling, storage, and processing methods. The current methods of geometric evaluation and classification of date palm fruits are characterised by high labour intensity and are usually performed mechanically, which may cause additional damage and reduce the quality and value of the product. Therefore, non-contact methods are being sought based on image analysis, with digital solutions controlling the evaluation and classification processes. The main objective of this paper is to develop an automatic classification model for varieties of date palm fruits using a convolutional neural network (CNN) based on two fundamental criteria, i.e., colour difference and evaluation of geometric parameters of dates. A CNN with a fixed architecture was built, marked as DateNET, consisting of a system of five alternating Conv2D, MaxPooling2D, and Dropout classes. The validation accuracy of the model presented in this study depended on the selection of classification criteria. It was 85.24% for fruit colour-based classification and 87.62% for the geometric parameters only; however, it increased considerably to 93.41% when both the colour and geometry of dates were considered.

1. Introduction

The date palm (Phoenix dactylifera L.) is the oldest perennial fruit tree, cultivated since ancient times, originating from Mesopotamia, and characterised by a strongly developed root system that can extend to 1500 m in well-drained and sandy soil. The date palm belongs to the palm family (Arecaceae) and includes over 2500 varieties, with its fruits and seeds (pits) playing an important role in the national economies of many countries, especially the Middle East, South Asia, North Africa, and Central America [1,2,3,4,5,6,7]. Fruits and seeds are a rich and inexpensive source of many nutrients and macro- and microelements. The dominant ingredients of dates are carbohydrates, including soluble sugars and fibre. There is 8.1% to 12.7% of fibre in fruits and about 15% in seeds, of which 84% to 94% is in the form of insoluble fibre. Date fibre has important functional properties, namely the ability to retain water and oil. Date palm fruits are also very rich in phenolic antioxidants (1–2%), mainly flavonoid glycosides such as quercetin, luteolin, apigenin, chrysoeriol, kaempferol, and isorhamnetin [8,9,10,11]. They also contain important nutraceuticals with a wide range of effects, including anti-mutagenic, antioxidant, antimicrobial, anti-inflammatory, hepatoprotective, anticancer, and immunostimulatory properties [12,13,14].
In addition to direct consumption, date fruits are used as a flavouring ingredient in dairy products, sweets, desserts, food mousses, and others. Dried date fruits have a longer shelf life, but their nutritional value is typically lower than that of fresh ones. The quality of dates is usually determined based on their physical properties, such as colour, shape, size, and texture, while their nutritional value is assessed on the basis of their chemical properties and sensory characteristics, which depend primarily on the fruit’s ripeness stage and its variety [9,15]. The physical characteristics of date palm fruits are used as criteria for initial evaluation and qualitative and varietal classification, with colour being one of the more important features.
The nutritional and phytochemical properties of dates vary depending on the harvesting period, variety, and storage and processing method. Date palm fruits develop and ripen in several stages. The first stage is Hababouk, during which the fruits attain their proper shape but are still inedible. The next stage is Kimri, where fruits turn green but are still unripe and inedible. The subsequent stage is Khalal, in which the fruits become full-sized and are already edible, followed by Rutab, where fruits become soft, ranging in colour from brown to black, and are edible. The last stage of date palm fruit development and ripening is Tamr, during which they obtain their colour, brown or black depending on the variety, and their moisture content decreases while sugar content increases [5,16].
Generally, date palm fruits are sorted and classified manually, which is very labour-intensive and time-consuming. Numerous studies are currently being conducted to develop intelligent methods for the accurate, fast, and fully automatic sorting of date palm fruits. Artificial intelligence and machine learning methods can undoubtedly be helpful here.
The dynamic development of artificial intelligence (AI), machine learning (ML), and computer image analysis (CIA) has facilitated the process of extracting quality features of agricultural products, fruits, and vegetables based on shape [17,18,19], colour [20,21], texture [22], and light spectrum [23].
A modern and intensively developing artificial intelligence tool are convolutional neural networks (CNN), characterised by the ability to extract high-level features of objects, thanks to which they are used to solve various multi-level complex problems, such as road traffic monitoring [24], facial and human movement recognition [25], and object recognition [26]. CNN models also play an important role in medicine for understanding the genetic basis and treatment of diseases such as brain [27], breast [28], and skin cancer [29], as well as aneurysms and autism in humans [30,31,32]. CNN is also used in robotics for visual navigation [33], controlling the driving path of autonomous vehicles [34], planning the movement paths of ground robots [35], programming production manipulators [36], and assessing the quality of products, agricultural produce, and other biological materials [37,38]. Modern digital techniques and computer data analysis methods allow for precise and automated control of food quality [39] and the identification of weeds, diseases, or pests in crop plants [40]. Computer image analysis has become one of the main techniques used in agriculture to evaluate seeds and grains in terms of quality losses, quantifying their ripeness stage, and the degree of disease infestation, mechanical damage, or contamination with other plant species. Thanks to the non-invasiveness of these methods and the increasing computing power of computers, image analysis and CNN have a significant advantage over the labour-intensive and expensive methods currently in use [41,42,43]. Artificial intelligence and computer techniques enable the use of precision agriculture technologies in fertilisation, the application of plant protection products, and precise agricultural and technical operations such as sowing, planting potatoes or vegetable seedlings, etc. [44,45,46,47,48,49].
Digital techniques and methods provide new knowledge that can be applied to control the quality of food and agricultural products with high accuracy [50,51,52].
The ongoing research on date palm fruits can be divided into three groups, i.e., classification of varieties [2], analysis of their degree of ripeness [53], and qualitative classification [54]. However, most research on date palm fruit focuses on the qualitative classification of fruits, where the basic criteria are: moisture, sugar content, hardness, surface damage, or disease infection. For example, Ismail and Al-Gaadi [55] classified date palm fruits into moist, semi-moist, and dry using a developed electronic sensor to measure their moisture content. Manickavasagan et al. [56] used hardness as a criterion for classifying date palm fruits and applied linear discriminant analysis (LDA) to distinguish soft, semi-hard, and hard dates. The LDA used by researchers and the related Fisher’s linear discriminant (FLD) allowed for the use/application of machine learning to find a linear combination of features determining the fruit hardness.
Many researchers have proposed methods for classifying date palm fruits according to their surface defects. For example, AI-Janobi [57,58] proposed techniques using grey-level co-occurrence matrices (GLCMs) and computer image analysis for date grading. The GLCMs used by the author were used for the examination of textures, taking into account the spatial relationships of pixels. GLCM functions characterise the texture of an image by calculating how often pairs of pixels with specific values and in a specified spatial relationship appear in the image, creating GLCMs, and then extracting statistical measures from the matrix. Nasiri et al. [54] used a backpropagation neural network to classify dates into three quality classes, considering their size, shape, colour, and surface damage, while Alavi [59] applied fuzzy inference to measure the quality of dates based on features such as length and freshness. Schmilovitch et al. [60] used spectrometry and near-infrared to assess the ripeness of dates, and Zhang et al. [61] classified the ripeness of dates of one variety through colour analysis and backpropagation. Pourdarbani et al. [51] also classified the ripeness of date palm fruit of one variety using taxonomy with colour and texture analysis, including contrast, entropy, and uniformity of dates. A neural network-based date classification system was proposed by Hobani et al. [62] and Albarrak et al. [63]. Haidar et al. [64] used size, shape, colour, and texture to classify images of single fruits into seven classes depending on their variety. Similar to his predecessors, Muhammad [65] also used shape, size, and texture criteria to distinguish four classes of dates based on images of individual dates.

2. Materials and Methods

2.1. Data Set Preparation

The main objective of the study is to develop a model for the automatic classification of date palm fruit varieties based on their colour and an algorithm for evaluating the geometric parameters of the fruit. The geometric shape of dates determined in the model is their length and diameter. The empirical material in the development of the CNN model and the code automating the classification process consisted of photos of five varieties of date palm fruit, which were taken during the Tamr development phase. The analysed dates were sourced from the south-eastern Algeria region.
The following date varieties were examined: Deglet Nour (DN), Degla Baida (DB), Ghars (GH), Tenicin (TE), and Tantboucht (TA) (Figure 1), and their detailed characteristics are presented in Table 1. The analysed varieties differed in fruit colour, of which the Degla Baida variety was the lightest and the Tenicin variety was the darkest. The fruits of individual varieties also differed in shape, from elongated in the case of Deglet Nour to nearly spherical for Tantboucht, respectively. The highest average length (47.20 ± 0.11 mm) and average weight (9.92 ± 0.44 g) were observed in the Degla Baida variety. Tantboucht had the shortest fruits, with an average length of 25.80 ± 0.08 mm, while Tenicin had the lightest fruits, with an average fruit weight of 7.45 ± 0.79 g.
The smoothness of the fruit surface is extremely important when analysing the geometric shape of date palm fruits and classifying their varieties using machine learning and CNN methods. In the Tamr development stage, the fruits of Tantboucht and Ghars were the most and the least smooth, respectively.
The images of dates were taken with a Xiaomi digital camera equipped with a sensor with a resolution of 12,000 × 9000 (108 million) pixels. Date palm fruits were photographed in a laboratory on a white background and in natural light. Initially, the image files were stored in the camera’s internal memory and then saved in jpg format at a resolution of 216 dpi and dimensions of 1600 × 1204 pixels in the computer’s memory. Each photo was marked with a variety symbol and a reference number, i.e., Deglet Nour: DN001–DN100, Degla Baida: DB001–DB100, Ghars: GH001–GH100, Tenicin: TE001–TE100, and Tantboucht: TA001–TA100.

2.2. Loading and Pre-Processing a Data Set

In the first stage of the analysis, the content of the files was checked, and a list of names of the date palm fruit photos was generated using the pathlib library. Then they were visualised, and their size was determined according to code 3 in //github.com/piotrrybacki/date-palm-CNN.git (accessed on 27 September 2023). The images of date palm fruits were loaded into NumPy tables as 8-bit fixed-point numbers with values in the range of <0–255>. The tf.io and tf.image modules from the TensorFlow 2.0 library were used to prepare the dataset. The tf.io module was used to load and store the images of date palm fruits, and the tf.image module was used to decode the raw content and to resize the images.
The displayed list of files shows that the set of input data contain 500 photos of date palm fruits, 100 for each variety, and its size is 188 MB (Figure 2). The photos of the date palm fruits were randomly divided into three subsets, i.e., a training set containing 300 photos (60 photos of each variety) and validation and test sets containing 100 photos each (20 photos of each variety). Listing 1 (//github.com/piotrrybacki/date-palm-CNN.git) shows code 1 for automatic copying of images from the source directory to the training, validation, and test directories.

2.3. Image Pre-Processing

Image analysis by a computer system requires conversion from analogue to digital form through digitization. This is achieved through discretization and quantization. Image discretization can be spatial or amplitude-based and is done through two-dimensional sampling at precisely defined points, usually grid nodes. In this paper, spatial discretization was applied to a square grid using code 2 (://github.com/piotrrybacki/date-palm-CNN.git). The results of discretizing the images of date palm fruits are presented in Figure 3.
Quantization, on the other hand, involves dividing the continuous range of colour brightness values into intervals and assigning each point a selected discrete value representing that interval. To evaluate the results of colour quantization (Table 2), the most common metrics are: MSE (mean square error) or RMSE (root mean square error), and the peak signal to noise ratio (PSNR) expressed logarithmically in dB, according to Equations (1)–(3):
R M S E = 1 3 m n j = 1 M i = 1 N R i j R i j * 2 + G i j G i j * 2 + B i j B i j * 2 ,
M S E = 1 3 m n j = 1 M i = 1 N R i j R i j * 2 + G i j G i j * 2 + B i j B i j * 2 ,
P S N R = 20   log 10 255 R M S E ,
where:
Rij, Gij, Bij—the colour components of the original image,
R i j * , G i j * , B i j * —the colour components of the image resulting from quantization,
M, N—spatial resolution of the image.
Table 2. Average values of the discretization process parameters of date palm fruit images.
Table 2. Average values of the discretization process parameters of date palm fruit images.
Image Codes
Average
DN001–DN100DB001–DB100GH001–GH100TE001–TE100TA001–TA100
PSNR [dB]150.55189.98235.09145.87120.54
MSE89.3493.67113.5685.0679.57
Figure 4 shows quantized images of dates of five varieties according to algorithm 3 (://github.com/piotrrybacki/date-palm-CNN.git). Each image point was assigned a discrete value.

2.4. Defining the Criteria for Classifying Date Palm Fruits

In practice, images are characterised by a large excess of information, so it is extremely important to extract the key features of the imaged objects, in this case, date palm fruits. These features are both criteria for classification and qualitative evaluation.
The basis for defining the criteria for classifying date palm fruits using the CNN model was their colour, size, shape, and surface. Evaluation of the results of discretization and quantization of date palm fruit colour was carried out using the CIELAB methodology, based on the theory of Euclidean distance in a perceptually uniform space. The non-uniformity of this space is evident from the fact that perceptual colour differences cannot be clearly determined. Colour can be described mathematically by calculating the parameter ΔE according to equation 4 using three components. L—brightness (luminance), a—colour from green to magenta, b—colour from blue to yellow.
Δ E = 1 M N j = 1 M i = 1 N L i j L i j * 2 + a i j a i j * 2 + b i j b i j * 2 ,
where:
Lij, aij, bij—colour components of the original image,
L i j * , a i j * , b i j * —colour components of the image resulting from quantization.
In the analysis, a criterion was used according to which the absolute colour differences in date palm fruits (ΔE) between 0 and 1 are imperceptible and the colour deviation of dates is unnoticeable, characteristic of the same variety, for example. A difference in the range of 1 to 2 indicates a minor deviation, 2 to 3.5 a moderate deviation, 3.5 to 5 a noticeable deviation, while ΔE above 5 is a major deviation in colour, which can clearly indicate different varieties of date palm fruits.
The diameter and length of the fruits were adopted as the second criterion for geometric classification. Numerical limits for each analysed variety were determined based on empirical measurements and the average values of these parameters, taking into account measurement errors. Detailed data can be found in Table 3.
The hypothesis was made that incorporating these two classification criteria for date palm fruits would significantly improve the accuracy of the models and streamline the process.

2.5. Multilayer Architecture of CNN

The proposed CNN architecture for automatic classification of date palm fruits, marked as DateNET, consisted of an alternating system of five layers: MaxPooling2D, Dropout, and Conv2D with the ReLu activation function, implemented using the Keras interface. MaxPool2D is a class that creates pooling layers, where the parameter strides = 1 is used to configure these layers. The argument pool size = 2 specifies the size of the window used for computing the maximum value. The Dropout class allows the user to define a dropout layer for regularisation, where the argument rate determines the probability of input units being dropped during network learning. When calling this dropout layer, its operation is adjusted by the training argument, which determines if the call is to occur during learning or inference. By default, the Conv2D class assumes that the input data are compatible with the NWHC format, where N stands for the number of images in the group, W and H designate the width and height of the image, and C is the number of channels. As shown in Figure 5, each convolutional layer was followed by a pooling layer for subsampling, i.e., reducing the size of the feature map. Listing 4 posted at //github.com/piotrrybacki/date-palm-CNN.git. shows the code programming this model.
The developed input code automatically transforms the data tensor into feature maps with dimensions of 200 × 200, which ultimately results in obtaining object maps of 7 × 7 just before the flattening layer. This transformation of the input tensor also allowed for increasing the depth of object maps in the network from 32 to 128. The use of binary classification in the developed model allowed the network to be completed with dense layers, i.e., a layer with a dimension of 512 and the ReLu activation function, as well as a layer with a dimension of 1 and the Sigmoid activation function.
The algorithm proposed in the paper automatically sorts dates based on colour and geometric parameters, such as diameter and length, considering the name of each date’s image. It then copies them to the test directory, from which they are retrieved by the DateNET algorithm. Based on the evaluation of the accuracy of date palm fruit classification, loss curves, analysis, and prediction accuracy values are plotted in the next stage according to code 5 (//github.com/piotrrybacki/date-palm-CNN.git).
The proposed DateNET architecture and the algorithm describing it allow for displaying the prediction result as probabilities of date palm fruit images belonging to particular classes (varieties). The tf.argmax function can search for an image with the highest probability of belonging and assign an appropriate label, which is the name of the date variety and the assumed geometric parameters, i.e., the surface of the fruit in the image, its circumference, diameter, and length. This was done for a group of 50 examples, and both input data and predicted labels were visualised according to code 6 (//github.com/piotrrybacki/date-palm-CNN.git).
The performance of the developed date palm fruit classification model was also evaluated using the measures of speed and prediction accuracy. The speed of the model was measured by the classification rate, which expressed the number of assigned images per second and the average classification time for a single date image. The model’s accuracy was evaluated using positive predictive value (PPV), true positive rate (TPR), the result correction factor (f), and its accuracy (ACC). These measures were determined using Equations (5)–(8).
P P V X = T P X T P X + F P X   ,
T P R X = T P X T P X + F N X   ,
f s c o r e X = 1 P P V X + T P R X   ,
where:
TPx—true positive,
FPx—false positive,
FNx—false negative,
= 0.5 gives equal weight to TPR and PPV,
A C C = i = 1 n T P i I i n   ,
where: n = no. of classes, Ii = no. of images in classe i
For class X, in this analysis of date palm fruit varieties, TPX is a true positive, i.e., the number of images correctly ecognized and assigned to class X. PPVX is the number of true positive results divided by the total number of images predicted to belong to class X. TPRX is defined as the number of true positive results divided by the actual number of images in class X. The f-scoreX is used to combine PPVX and TPRX into a single measure using the harmonic mean. The overall accuracy in Equation (8) was calculated using balanced accuracy, which normalises the true positive result for each class by the number of images in the class and divides their sum by the number of date palm fruit varieties. Balanced accuracy ensures that all classes contribute equally to the overall accuracy calculation, even if the number of fruit images in the classes is unequal. To illustrate the classification accuracy for date palm fruits, confusion matrices of the models were used according to the format in Figure 6.
Additionally, the proposed DataNet model was compared with the ResNet, MobileNet, and ShuffleNet algorithms. A Residual Neural Network (ResNet, ang. Residual Network) was developed by He et al. [66] in order to improve the quality of object classification computer accuracy. ResNet is a deep learning model in which the weight layers learn residual functions with reference to the layer inputs. A residual network is a network with skip connections that perform identity mappings, merged with the layer outputs by addition. ResNet is a multi-variant, multi-layer neural network model that works in the same manner. In our experiment, the ResNet50 model was applied, which was based on a 50 layer neutral network. MobileNet is an advanced convolutional neural network for mobile vision applications, which, according to Srinivasu et al. [67], can be used especially in medical applications, i.e., dentistry. It uses depthwise convolutions to significantly reduce the number of parameters compared to other networks, resulting in a lightweight deep neural network. The third of the analysed models is ShuffleNet, which is a convolutional neural network designed especially for mobile devices with very limited computing power. The architecture of those models utilises two operations, i.e., pointwise group convolution and channel shuffle, to reduce computation costs while maintaining accuracy [68].

3. Results

The final result of the analysis is the proposal of a DateNET architecture and an algorithm enabling automatic classification of date palm fruit varieties and evaluation of their geometric shape. Table 4 presents a comparison of the changes in the sizes of maps for the developed DateNET model depending on the layer number for 30 epochs. The data show that each hidden layer of the DateNET model results in a reduction of maps, producing a total output of 4,459,332 parameters.
The designed DateNET architecture and the accompanying code allowed for the automatic sorting of images into training, validation, and test directories. Then, the computational algorithm randomly selected the order of unsupervised model training and validation based on the colour and geometric parameters of the fruit. The accuracy of date palm fruit classification for individual varieties depended on the type of criteria chosen. As shown in Figure 7 and Figure 8, the accuracy of the model’s training and validation processes increased with the number of repetitions. However, multiple tests of the model revealed that a limit to the increase in accuracy and decrease in training loss was 30 computational repetition cycles (30 epochs).
Displaying the prediction results as probabilities of belonging to specific classes, according to code 5, was the final result of the analysis. The developed algorithm searched for the image with the highest probability of belonging, gave its value, and assigned the appropriate label, which was the code of the date palm fruit variety. When classifying based on geometric parameters, the algorithm assigned an appropriate label, which was a set of information calculated based on the shape of the image and the number of pixels with the size and shape of the fruit. The label contains information about the surface area of the date, its perimeter, diameter, and length. It also includes an eccentricity index, which is the ratio of the length of the radii from the centre of gravity to the analysed cross-section. An eccentricity index close to 1.00 indicated that the axis of symmetry of the date palm fruit at each dx is a straight line.
If there were different results in the two-stage classification, which is based on colour and geometry, the affiliation was determined by the higher probability of the correct result. As presented in Figure 9, the DN image by colour was incorrectly assigned (77.50%), but it was correctly assigned as the DB variety by geometric parameters, with a probability of 81.09%.
Table 5 lists the geometric parameters generated by the proposed model and the constructed DateNET architecture, which were compared with empirical measurements of the diameters and lengths of date palm fruits. Columns 8 and 10 of Table 5 show deviations from the actual average value of the diameter and length of dates. The minus sign before it indicates a smaller diameter, while the plus sign means a diameter larger than the average value. The analyses show that 89.12% of the read values are within the criteria adopted and presented in Table 5. Column 12 also shows that the incorrect image assignment occurred at a low value of the ΔE index, which indicates that the model does not recognise differences in fruit colours and classifies them randomly, making an error. It can also be noticed that the varieties marked as TE (Tenicin) and TA (Tantboucht) were characterised by a high value of the ΔE index.
Figure 10 presents the performance of the proposed DateNET model on the validation data set using the confusion matrix. It is clear that when using the colour of dates for classification, the Deglet Nour variety produced the following coefficients: TPR at 79.00% and PPV at 84.95%. By additionally including geometric parameters in the classification, the TPR index and the PPV index increased to 91.00% and 93.81%, respectively. Even higher values were recorded for the Tantboucht variety, where the TPR and PPV indices were 92.00% and 93.88%, respectively, and with the geometric parameters of date palm fruit, they both reached the value of 96.00%. This demonstrates that out of 100 date images, four were misclassified.
The average time for classifying date images using GPUs depended on the adopted criteria. Images were classified the fastest when based solely on colour (20.43 ms/image), while it took slightly longer, 23.57 ms/image, to assign a photo based on the geometric parameters of the fruit. Photos were classified for the longest time, i.e., 27.88 ms/image, when using a combination of criteria, i.e., colour and geometric parameters (Table 6). However, the combination of classification criteria significantly increased the process accuracy, reaching 93.40% for the proposed CNN model and architecture.
According to Table 7, comparing the DateNet model proposed in this work with randomly selected models, i.e., ResNet, MobileNet, and ShuffleNet, it can be concluded that it is characterised by similar positive predictive value (PPV), true positive rate (TPR), as well as the result correction factor (f) and its accuracy (ACC). However, the main advantage of the proposed DateNet model is that it enables the assessment of geometric date parameters. This allows not only variety classification but also distinction in terms of fruit size. This increases the average classification time compared to the fastest model by 7.12 ms/image.

4. Discussion

Comparing the effectiveness of the proposed classification method in this study, which achieved an accuracy of 93.41%, with methods presented in other scientific papers on recognising varieties of date palm fruits and classifying their ripeness stages, identifying palms, and recognising plant sex, it can be concluded that it does not significantly deviate in terms of accuracy and precision. In their studies, Bin Naeem et al. [69] applied supervised machine learning methods (KNN, SVM, Naive Byes, AdaBoost) to identify the sex of date palms. The results obtained by the authors indicated that the SVM algorithm is the most accurate (97%) for the identification of sex. This algorithm allows for quick and accurate testing of DNA markers and can greatly improve the efficiency of date palm genetics and cultivation due to the fact that the genotypes of male and female individuals can be identified before ripening, therefore reducing the costs and time of cultivation. Albarrak et al. ([63]) proposed a network model based on the following architects: AlexNet, VGG16, InceptionV3, ResNet, and MobileNetV2, of which MobileNetV2 was the most precise, with an accuracy of 97%. The authors verified the network on data from eight different classes of date palm fruits, and in order to increase the accuracy, they used various image processing techniques, e.g., magnification, model checkpoints, and hybrid adjustment.
Jintasuttisak et al. [70] used a CNN model and the YOLO-V5 architecture to detect date palms in images captured by a camera on a drone flying at an altitude of 122 m over agricultural fields. To prepare the data, they randomly selected 125 images and divided them into three datasets: training (60%), validation (20%), and testing (20%). The results of using the YOLO-V5 architecture to detect date palm in photos taken by the drone were compared by the authors with the results from other popular CNN architectures, i.e., YOLO-V3, YOLO-V4, and SSD300. The results show that the YOLO-V5m model has the highest accuracy, with an average precision of 92.34%. In addition, this neural network architecture enables the detection and localization of date palms of different sizes among different plants and occurring in different environments, in which date palms are relatively rare. The authors concluded that this method could be a useful part of an automatic date palm plantation management system and make it easier to forecast the volume of fruit production and monitor the condition of date palms. Muhammad [65] applied machine learning methods to classify date palm fruit types using local binary pattern (LBP) and Weber local descriptor (WLD) for textures combined with geometric features, dimensions, and shape. The author classified images of four types of dates, achieving a model accuracy of 98.1%.
Haidar et al. [64] achieved a classification accuracy of 98.6% for date palm fruits based on their species using neural networks and fifteen parameters, including colour, shape, geometric dimensions, and texture. However, it should be noted that only 140 images were used for date classification. Oussama and Kherfi [71] used a much larger dataset of 5000 images for the classification of 10 date palm fruit varieties. They used an RGB colour matrix, grayscale levels, and four shape features combined with a Gaussian Mixture Model (GMM), achieving a model accuracy of 97.5% with a classification time of 0.029 s. Similar to this study, images of a single date with a uniform background were used.
Zhang et al. [61] used image analysis and backpropagation colour decomposition to classify one date type into four ripeness classes in images of single fruits, achieving an accuracy of 97.5%. In their study, Pourdarbani et al. [51] presented a model for classifying dates into four ripeness classes through the taxonomic classification method with RGB colours and texture features, achieving an overall accuracy of 88.33% with a classification time of 0.34 s. In more recent publications, Hossain et al. [72] proposed date classification based on a pre-trained CNN model, achieving an accuracy of 99.2%. They used images of both single and multiple dates for four varieties. However, it is noticeable that the imaged fruits were characterised by high inter-species variability.

5. Conclusions

The paper proposes a CNN architecture and a model DateNET for automatic classification of date palm fruits of five varieties based on their colour and geometric parameters. The fixed CNN architecture consists of an alternating system of five Conv2D, MaxPooling2D, and Dropout classes, for which a computational algorithm was developed in the Python 3.9 language. The developed algorithm, described in code, allows the user to define any number of classes (varieties of date palm fruits) and analyse any number of images copied to training, validation, and test catalogues, which greatly increases its utility.
The validation accuracy of the model presented in this study depended on the selection of classification criteria. It was 85.24% for fruit colour-based classification and 87.62% for the geometric parameters only; however, it increased considerably to 93.41% when both the colour and geometry of dates were considered.
To sum up, it can be concluded that the classification of diverse fruits like dates solely based on geometric parameters, even within one variety, is a complicated process, as dates are characterised by great diversity in terms of texture, and the DateNET model can treat them as distinct.
In the DateNet model, the ability to recognise geometric fruit parameters is the main advantage over the models for which the only classification criterium is colour, as it allows for stimultaneuos distinction. With appropriate technical equipment, the proposed model can provide measurable benefits, despite the longer classification time compared to the existing ones.

Author Contributions

Conceptualization, P.R. and J.N.; methodology, P.R. and J.N.; software, P.R.; validation, P.R., J.N., S.D., S.C., I.B., A.O. and J.D.; formal analysis, J.N.; investigation, N.M.S.; resources, J.N.; data curation, S.D.; writing—original draft preparation, P.R. and J.N.; writing—review and editing, J.N.; visualization, P.R. and J.N.; supervision, P.R. and J.N. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Hachani, S.; Hamia, C.; Boukhalkhal, S.; Silva, A.M.S.; Djeridane, A.; Yousfi, M. Morphological, physico-chemical characteristics and effects of extraction solvents on UHPLC-DAD-ESI-MS n profiling of phenolic contents and antioxidant activities of five date cultivars (Phoenix dactylifera L.) growing in Algeria. NFS J. 2018, 13, 10–22. [Google Scholar] [CrossRef]
  2. Kamal-Eldin, A.; Ghnimi, S. Classification of date fruit (Phoenix dactylifera, L.) based on chemometric analysis with multivariate approach. J. Food Meas. Charact. 2018, 12, 1020–1027. [Google Scholar] [CrossRef]
  3. Altaheri, H.; Alsulaiman, M.; Muhammad, G. Date Fruit Classification for Robotic Harvesting in a Natural Environment Using Deep Learning. IEEE Access 2019, 7, 117115–117133. [Google Scholar] [CrossRef]
  4. Mrabet, A.; Hammadi, H.; Rodríguez-Gutiérrez, G.; Jiménez-Araujo, A.; Sindic, M. Date palm fruits as a potential source of functional dietary fiber: A review. Food Sci. Technol. Res. 2019, 25, 1–10. [Google Scholar] [CrossRef]
  5. Hussain, M.I.; Farooq, M.; Syed, Q. A Nutritional and biological characteristics of the date palm fruit (Phoenix dactylifera L.)—A review. Food Biosci. 2020, 34, 100509. [Google Scholar] [CrossRef]
  6. AlFaris, N.A.; AlTamimi, J.Z.; AlGhamdi, F.A.; Albaridi, N.A.; Alzaheb, R.A.; Aljabryn, D.H.; Aljahani, A.H.; AlMousa, L.A. Total phenolic content in ripe date fruits (Phoenix dactylifera L.): A systematic review and meta-analysis. Saudi J. Biol. Sci. 2021, 28, 3566–3577. [Google Scholar] [CrossRef]
  7. Kamel, B.M.; Messaoud, R.; Madjed, D.A.; Ahmed, S.; Zineddine, B. Varietal diversity and calendar of maturation of dates at low Sahara; what economic perspective. Alger. J. Arid Reg. J. 2022, 14, 72–81. [Google Scholar]
  8. Abu-Reidah, I.M.; Gil-Izquierdo, Á.; Medina, S.; Ferreres, F. Phenolic composition profiling of different edible parts and by-products of date palm (Phoenix dactylifera L.) by using HPLC-DAD-ESI/MSn. Food Res. Int. 2017, 100, 494–500. [Google Scholar] [CrossRef] [PubMed]
  9. Ghnimi, S.; Umer, S.; Karim, A.; Kamal-Eldin, A. Date fruit (Phoenix dactylifera L.) An underutilized food seeking industrial valorization. NFS J. 2017, 6, 1–10. [Google Scholar] [CrossRef]
  10. Ghnimi, S.; Al-shibli, M.; Al-Yammahi, H.R.; Al-dhaheri, A.; Al-Jaberi, F.; Jobe, B.; Kamal-Eldin, A. Reducing sugars, organic acids, size, colour, and texture of 21 Emirati date fruit varieties (Phoenix dactylifera, L.). NFS J. 2018, 12, 1–10. [Google Scholar] [CrossRef]
  11. Cherif, S.; Le Bourvellec, C.; Bureau, S.; Benabda, J. Effect of storage conditions on ‘Deglet Nour’ date palm fruit organoleptic and nutritional quality. LWT 2021, 137, 110343. [Google Scholar] [CrossRef]
  12. Khalid, S.; Khalid, N.; Khan, R.S.; Ahmed, H.; Ahmad, A. A review on chemistry and pharmacology of Ajwa date fruit and pit. Trends Food Sci. Technol. 2017, 63, 60–69. [Google Scholar] [CrossRef]
  13. Echegaray, N.; Pateiro, M.; Gullón, B.; Amarowicz, R.; Misihairabgwi, J.M.; Lorenzo, J.M. Phoenix dactylifera products in human health—A review. Trends Food Sci. Technol. 2020, 105, 238–250. [Google Scholar] [CrossRef]
  14. Hilary, S.; Tomás-Barberán, F.A.; Martinez-Blazquez, J.A.; Kizhakkayil, J.; Souka, U.; Al-Hammadi, S.; Habib, H.; Ibrahim, W.; Platat, C. Polyphenol characterisation of Phoenix dactylifera L. (date) seeds using HPLC-mass spectrometry and its bioaccessibility using simulated in-vitro digestion/Caco-2 culture model. Food Chem. 2020, 311, 125969. [Google Scholar] [CrossRef] [PubMed]
  15. Abdul-Hamid, N.A.; Mustaffer, N.H.; Maulidiani, M.; Mediani, A.; Ismail, I.S.; Tham, C.L.; Shadid, K.; Abas, F. Quality evaluation of the physical properties, phytochemicals, biological activities and proximate analysis of nine Saudi date palm fruit varieties. J. Saudi Soc. Agric. Sci. 2020, 19, 151–160. [Google Scholar] [CrossRef]
  16. AlYammahi, J.; Darwish, A.S.; Lemaoui, T.; AlNashef, I.M.; Hasan, S.W.; Taher, H.; Banat, F. Parametric analysis and machine learning for enhanced recovery of high-value sugar from date fruits using supercritical CO2 with co-solvents. J. CO2 Util. 2023, 72, 102511. [Google Scholar] [CrossRef]
  17. Deng, L.; Du, H.; Han, Z. A Carrot Sorting System Using Machine Vision Technique. Appl. Eng. Agric. 2017, 33, 149–156. [Google Scholar] [CrossRef]
  18. Deng, L.; Li, J.; Han, Z. Online defect detection and automatic grading of carrots using computer vision combined with deep learning methods. LWT 2021, 149, 111832. [Google Scholar] [CrossRef]
  19. Xie, W.; Wei, S.; Yang, D. Morphological measurement for carrot based on three-dimensional reconstruction with a ToF sensor. Postharvest Biol. Technol. 2023, 197, 112216. [Google Scholar] [CrossRef]
  20. Abdulridha, J.; Ampatzidis, Y.; Kakarla, S.C.; Roberts, P. Detection of target spot and bacterial spot diseases in tomato using UAV-based and benchtop-based hyperspectral imaging techniques. Precis. Agric. 2020, 21, 955–978. [Google Scholar] [CrossRef]
  21. Rybacki, P.; Niemann, J.; Bahcevandziev, K.; Durczak, K. Convolutional neural network model for variety classification and seed quality assessment of winter rapeseed. Sensors 2023, 23, 2486. [Google Scholar] [CrossRef] [PubMed]
  22. Grinblat, G.L.; Uzal, L.C.; Larese, M.G.; Granitto, P.M. Deep learning for plant identification using vein morphological patterns. Comput. Electron. Agric. 2016, 127, 418–424. [Google Scholar] [CrossRef]
  23. Sun, D.; Robbins, K.; Morales, N.; Shu, Q.; Cen, H. Advances in optical phenotyping of cereal crops. Trends Plant Sci. 2022, 27, 191–208. [Google Scholar] [CrossRef] [PubMed]
  24. Lemley, J.; Bazrafkan, S.; Corcoran, P. Deep Learning for Consumer Devices and Services: Pushing the limits for machine learning, artificial intelligence, and computer vision. IEEE Consum. Electron. Mag. 2017, 6, 48–56. [Google Scholar] [CrossRef]
  25. Schroff, F.; Kalenichenko, D.; Philbin, J. Facenet: A unified embedding for face recognition and clustering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Boston, MA, USA, 7–12 June 2015; pp. 815–823. [Google Scholar] [CrossRef]
  26. Raghu, S.; Sriraam, N. Classification of focal and non-focal EEG signals using neighborhood component analysis and machine learning algorithms. Expert Syst. Appl. 2018, 113, 18–32. [Google Scholar] [CrossRef]
  27. Jermyn, M.; Mok, K.; Mercier, J.; Desroches, J.; Pichette, J.; Saint-Arnaud, K.; Bernstein, L.; Guiot, M.C.; Petrecca, K.; Leblond, F. Intraoperative brain cancer detection with Raman spectroscopy in humans. Sci. Transl. Med. 2015, 7, 274ra19. [Google Scholar] [CrossRef]
  28. Zheng, N.; Yao, Z.; Tao, S.; Almadhor, A.; Alqahtani, M.S.; Ghoniem, R.M.; Zhao, H.; Li, S. Application of nanotechnology in breast cancer screening under obstetrics and gynecology through the use of CNN and ANFIS. Environ. Res. 2023, 234, 116414. [Google Scholar] [CrossRef]
  29. Esteva, A.; Kuprel, B.; Novoa, R. Dermatologist-level classification of skin cancer with deep neural networks. Nature 2017, 542, 115–118. [Google Scholar] [CrossRef]
  30. Tomihama, R.T.; Camara, J.R.; Kiang, S.C. Machine learning analysis of confounding variables of a convolutional neural network specific for abdominal aortic aneurysms. JVS-Vasc. Sci. 2023, 4, 100096. [Google Scholar] [CrossRef]
  31. Li, P.; Liu, Y.; Zhou, J.; Tu, S.; Zhao, B.; Wan, J.; Yang, Y.; Xu, L. A deep-learning method for the end-to-end prediction of intracranial aneurysm rupture risk. Patterns 2023, 4, 100709. [Google Scholar] [CrossRef]
  32. Torres, J.M.M.; Medina-DeVilliers, S.; Clarkson, T.; Lerner, M.D.; Riccardi, G. Evaluation of interpretability for deep learning algorithms in EEG emotion recognition: A case study in autism. Artif. Intell. Med. 2023, 143, 102545. [Google Scholar] [CrossRef] [PubMed]
  33. Bachute, M.R.; Subhedar, J.M. Autonomous Driving Architectures: Insights of Machine Learning and Deep Learning Algorithms. Mach. Learn. Appl. 2021, 6, 100164. [Google Scholar] [CrossRef]
  34. Shalev-Shwartz, S.; Shammah, S.; Shashua, A. Safe, Multi-Agent, Reinforcement Learning for Autonomous Driving. arXiv 2016. [Google Scholar] [CrossRef]
  35. Pfeiffer, M.; Schaeuble, M.; Nieto, J.; Siegwart, R.; Cadena, C. From Perception to Decision: A Data-driven Approach to End-to-end Motion Planning for Autonomous Ground Robots Robotics. arXiv 2017. [Google Scholar] [CrossRef]
  36. Levine, S.; Pastor, P.; Krizhevsky, A.; Ibarz, J.; Quillen, D. Learning Hand-Eye Coordination for Robotic Grasping with Deep Learning and Large-Scale Data Collection. Int. J. Robot. Res. 2018, 37, 4–5. [Google Scholar] [CrossRef]
  37. Xie, W.; Wang, F.; Yang, D. Research on Carrot Grading Based on Machine Vision Feature Parameters. IFAC Pap. 2019, 52, 30–35. [Google Scholar] [CrossRef]
  38. Xie, W.; Wang, F.; Yang, D. Research on Carrot Surface Defect Detection Methods Based on Machine Vision. IFAC Pap. 2019, 52, 24–29. [Google Scholar] [CrossRef]
  39. Franco, M.O.K.; Suarez, W.T.; dos Santos, V.B.; Resque, I.S. A novel digital image method for determination of reducing sugars in aged and non-aged cachaças employing a smartphone. Food Chem. 2021, 338, 127800. [Google Scholar] [CrossRef]
  40. Hadipour-Rokni, R.; Asli-Ardeh, E.A.; Jahanbakhshi, A.; Paeen-Afrakoti, I.E.; Sabzi, S. Intelligent detection of citrus fruit pests using machine vision system and convolutional neural network through transfer learning technique. Comput. Biol. Med. 2023, 155, 106611. [Google Scholar] [CrossRef]
  41. Baser, P.; Saini, J.R.; Kotecha, K. TomConv: An Improved CNN Model for Diagnosis of Diseases in Tomato Plant Leaves. Procedia Comput. Sci. 2023, 218, 1825–1833. [Google Scholar] [CrossRef]
  42. Cheung, L.; Wang, Y.; Lau, A.S.M.; Chan, R.M.C. Using a novel clustered 3D-CNN model for improving crop future price prediction. Knowl. Based Syst. 2023, 260, 110133. [Google Scholar] [CrossRef]
  43. Kaya, Y.; Gürsoy, E. A novel multi-head CNN design to identify plant diseases using the fusion of RGB images. Ecol. Inform. 2023, 75, 101998. [Google Scholar] [CrossRef]
  44. Rybacki, P.; Przygodziński, P.; Osuch, A.; Blecharczyk, A.; Walkowiak, R.; Osuch, E.; Kowalik, I. The Technology of Precise Application of Herbicides in Onion Field Cultivation. Agriculture 2021, 11, 577. [Google Scholar] [CrossRef]
  45. Coulibaly, S.; Kamsu-Foguem, B.; Kamissoko, D.; Traore, D. Deep learning for precision agriculture: A bibliometric analysis. Intell. Syst. Appl. 2022, 16, 200102. [Google Scholar] [CrossRef]
  46. Rybacki, P.; Przygodziński, P.; Blecharczyk, A.; Kowalik, I.; Osuch, A.; Osuch, E. Strip spraying technology for precise herbicide application in carrot fields. Open Chem. 2022, 20, 287–296. [Google Scholar] [CrossRef]
  47. Bhat, S.A.; Hussain, I.; Huang, N.F. Soil suitability classification for crop selection in precision agriculture using GBRT-based hybrid DNN surrogate models. Ecol. Inform. 2023, 75, 102109. [Google Scholar] [CrossRef]
  48. Huihui, Y.; Daoliang, L.; Yingyi, C. A state-of-the-art review of image motion deblurring techniques in precision agriculture. Heliyon 2023, 9, e17332. [Google Scholar] [CrossRef]
  49. Sanaeifar, A.; Guindo, M.L.; Bakhshipour, A.; Fazayeli, H.; Li, X.; Yang, C. Advancing precision agriculture: The potential of deep learning for cereal plant head detection. Comput. Electron. Agric. 2023, 209, 107875. [Google Scholar] [CrossRef]
  50. Li, L.; Wang, Y.; Jin, S.; Li, M.; Chen, Q.; Ning, J.; Zhang, Z. Evaluation of black tea by using smartphone imaging coupled with micro-near-infrared spectrometer. Spectrochim. Acta Part A Mol. Biomol. Spectrosc. 2021, 246, 118991. [Google Scholar] [CrossRef]
  51. Meenu, M.; Cai, Q.; Xu, B. A critical review on analytical techniques to detect adulteration of extra virgin olive oil. Trends Food Sci. Technol. 2019, 91, 391–408. [Google Scholar] [CrossRef]
  52. Minz, P.S.; Sawhney, I.K.; Saini, C.S. Algorithm for processing high definition images for food colourimetry. Measurement 2020, 158, 107670. [Google Scholar] [CrossRef]
  53. Pourdarbani, R.; Ghassemzadeh, H.R.; Seyedarabi, H.; Nahandi, F.Z.; Vahed, M.M. Study on an automatic sorting system for date fruits. J. Saudi Soc. Agric. Sci. 2015, 14, 83–90. [Google Scholar] [CrossRef]
  54. Nasiri, A.; Taheri-Garavand, A.; Zhang, Y.D. Image-based deep learning automated sorting of date fruit. Postharvest Biol. Technol. 2019, 153, 133–141. [Google Scholar] [CrossRef]
  55. Ismail, K.M.; Al-Gaadi, K.A. Development of an electronic sensor for Date sorting based on moisture content. King Saud Univ. Agric. Res. Cent. 2009, 26, 1923–1932. [Google Scholar] [CrossRef]
  56. Manickavasagan, A.; Al-Mezeini, N.K.; Al-Shekaili, H.N. RGB colour imaging technique for grading of dates. Sci. Hortic. 2014, 175, 87–94. [Google Scholar] [CrossRef]
  57. AI-Janobi, A.A. Application of Co-Occurrence Matrix Method in Grading Date Fruits. In Proceedings of the ASAE Annual International Meeting, Orlando, FL, USA, 12–16 July 1998. [Google Scholar]
  58. Al-Janobi, A.A. Data inspection by colour machine vision. J. King Saud Univ. 2000, 12, 69–79. [Google Scholar]
  59. Alavi, N. Quality determination of Mozafati dates using Mamdani fuzzy inference system. J. Saudi Soc. Agric. Sci. 2013, 12, 137–142. [Google Scholar] [CrossRef]
  60. Schmilovitch, Z.; Mizrach, A.; Hoffman, A.; Egozi, H.; Fuchs, Y. Determination of mango physiological indices by near-infrared spectrometry. Postharvest Biol. Technol. 2000, 19, 245–252. [Google Scholar] [CrossRef]
  61. Zhang, D.; Lee, D.J.; Tippetts, B.J.; Lillywhite, K.D. Date maturity and quality evaluation using colour distribution analysis and back projection. J. Food Eng. 2014, 131, 161–169. [Google Scholar] [CrossRef]
  62. Hobani, A.I.; Thottam, A.M.; Ahmed, K.A. Development of a neural network classifier for date fruit varieties using some physical attributes. King Saud Univ. Agric. Res. Cent. 2003, 126, 5–18. [Google Scholar]
  63. Albarrak, K.; Gulzar, Y.; Hamid, Y.; Mehmood, A.; Soomro, A.B. A Deep Learning-Based Model for Date Fruit Classification. Sustainability 2022, 14, 6339. [Google Scholar] [CrossRef]
  64. Haidar, A.; Dong, H.; Mavridis, N. Image-based date fruit classification. In Proceedings of the Computer Science IV International Congress on Ultra Modern Telecommunications and Control Systems, St. Petersburg, Russia, 3–5 October 2012. [Google Scholar]
  65. Muhammad, G. Date fruits classification using texture descriptors and shape-size features. Eng. Appl. Artif. Intell. 2015, 37, 361–367. [Google Scholar] [CrossRef]
  66. He, K.M.; Zhang, X.Y.; Ren, S.Q.; Sun, J. Spatial pyramid pooling in deep convolutional networks for visual recognition. IEEE Trans. Pattern Anal. Mach. Intell. 2015, 37, 1904–1916. [Google Scholar] [CrossRef] [PubMed]
  67. Srinivasu, P.N.; SivaSai, J.G.; Ijaz, M.F.; Bhoi, A.K.; Kim, W.; Kang, J.J. Classification of skin disease using deep learning neural networks with MobileNet V2 and LSTM. Sensors 2021, 21, 2852. [Google Scholar] [CrossRef] [PubMed]
  68. Yang, H.; Liu, J.; Mei, G.; Yang, D.; Deng, X.; Duan, C. Research on real-time detection method of rail corrugation based on improved ShuffleNet V2. Eng. Appl. Artif. Intell. 2023, 126, 106825. [Google Scholar] [CrossRef]
  69. Bin Naeem, A.; Khalid, F.; Soomro, A.M.; Del Mundo, A.D.; Zaidi, A.; Senapati, B.; Doshi, O.P. Early Gender Identification of Date Palm Using Machine Learning. J. Comput. Biomed. Inform. 2023, 4, 1–14. [Google Scholar] [CrossRef]
  70. Jintasuttisak, T.; Edirisinghe, E.; Elbattay, A. Deep neural network based date palm tree detection in drone imagery. Comput. Electron. Agric. 2022, 192, 106560. [Google Scholar] [CrossRef]
  71. Oussama, A.; Kherfi, M.L. A new method for automatic date fruit classification. Int. J. Comput. Vis. Robot. 2017, 7, 692–711. [Google Scholar] [CrossRef]
  72. Hossain, M.S.; Muhammad, G.; Amin, S.U. Improving consumer satisfaction in smart cities using edge computing and caching: A case study of date fruits classification. Future Gener. Comput. Syst. 2018, 88, 333–341. [Google Scholar] [CrossRef]
Figure 1. Imaged date palm fruit at the Tamr stage of varieties: (a) Deglet Nour, (b) Degla Baida, (c) Ghars, (d) Tenicin, (e) Tantboucht.
Figure 1. Imaged date palm fruit at the Tamr stage of varieties: (a) Deglet Nour, (b) Degla Baida, (c) Ghars, (d) Tenicin, (e) Tantboucht.
Sensors 24 00558 g001
Figure 2. Visualisation of date palm fruit images.
Figure 2. Visualisation of date palm fruit images.
Sensors 24 00558 g002
Figure 3. Discretized images of date palm fruit varieties: (a) Deglet Nour, (b) Degla Baida, (c) Ghars, (d) Tenicin, (e) Tantboucht.
Figure 3. Discretized images of date palm fruit varieties: (a) Deglet Nour, (b) Degla Baida, (c) Ghars, (d) Tenicin, (e) Tantboucht.
Sensors 24 00558 g003
Figure 4. Quantified images of date palm fruits of varieties: (a) Deglet Nour, (b) Degla Baida, (c) Ghars, (d) Tenicin, (e) Tantboucht.
Figure 4. Quantified images of date palm fruits of varieties: (a) Deglet Nour, (b) Degla Baida, (c) Ghars, (d) Tenicin, (e) Tantboucht.
Sensors 24 00558 g004
Figure 5. Schematic of the implemented CNN network (DateNET). (a) Deglet Nour, (b) Degla Baida, (c) Ghars, (d) Tenicin, (e) Tantboucht.
Figure 5. Schematic of the implemented CNN network (DateNET). (a) Deglet Nour, (b) Degla Baida, (c) Ghars, (d) Tenicin, (e) Tantboucht.
Sensors 24 00558 g005
Figure 6. Confusion matrix scheme for the classification of date palm fruit varieties. “+” is the background/fill.
Figure 6. Confusion matrix scheme for the classification of date palm fruit varieties. “+” is the background/fill.
Sensors 24 00558 g006
Figure 7. Visualisation of loss function curves and learning accuracy and model validation, based on date palm fruit colour, for 30 cycles of computational repetition of the created DateNET.
Figure 7. Visualisation of loss function curves and learning accuracy and model validation, based on date palm fruit colour, for 30 cycles of computational repetition of the created DateNET.
Sensors 24 00558 g007
Figure 8. Visualisation of loss function curves and learning accuracy and model validation, based on colour and geometric parameters of date palm fruit, for 30 cycles of computational repetitions of the created DateNET.
Figure 8. Visualisation of loss function curves and learning accuracy and model validation, based on colour and geometric parameters of date palm fruit, for 30 cycles of computational repetitions of the created DateNET.
Sensors 24 00558 g008
Figure 9. Example outputs of imaged date palm fruits with their predicted labels. red color is a misclassification.
Figure 9. Example outputs of imaged date palm fruits with their predicted labels. red color is a misclassification.
Sensors 24 00558 g009
Figure 10. Confusion matrix of date palm fruit variety classification model DateNET based on: (a) colour, (b) geometric parameters, (c) colour and geometric parameters; DN-Deglet Nour, DB-Degla Baida, GH-Ghars, TE-Tenicin, TA-Tantboucht.
Figure 10. Confusion matrix of date palm fruit variety classification model DateNET based on: (a) colour, (b) geometric parameters, (c) colour and geometric parameters; DN-Deglet Nour, DB-Degla Baida, GH-Ghars, TE-Tenicin, TA-Tantboucht.
Sensors 24 00558 g010
Table 1. Morphological characterization of dates varieties.
Table 1. Morphological characterization of dates varieties.
Fruit (Tamr Stage)Deglet NourDegla BaidaGharsTenicinTantboucht
Fruit’ shapeSub cylindricalSub cylindricalSub cylindricalSub cylindricalSpherical
Fruit shape at distal endFlat sharpFlat sharpOval obliqueOval obliqueLarge round
Fruit shape of stalk endOval obliqueOval obliqueSharpFlat ovalLarge round
Average fruit length
(mm)
41.20 ± 0.1047.20 ± 0.1142.20 ± 0.1639.60 ± 0.1425.80 ± 0.08
Average fruit diameter
(mm)
19.20 ± 0.5322.62 ± 0.1122.20 ± 0.1629.60 ± 0.1425.89 ± 0.08
Average fruit weight (g)9.39 ± 0.179.92 ± 0.448.18 ± 0.617.45 ± 0.798.91 ± 0.62
Colour
at Tamar stage
BrownYellowish brownBrownBlackish brownBlackish brown
Fruit
consistency
Semi-DryDrySoftSemi-SoftSemi-Soft
Aspect of fruit epicarp (skin)Semi-SmoothSemi-SmoothSmoothSmoothSmooth
Alteration of the epicarp (skin) colourBrownYellowish brownDark brownBlackBlack
Fruit
flesh texture
FibrousMealyFibrousFibrousFibrous
Fruit flesh colourWhitish yellowWhiteYellowWhitish yellowWhitish yellow
Taste and flavor of the dateSugarySugarySugary-acidulousSugary-acidulousSugary-acidulous
Fruit
aroma
PresentAbsentPresentPresentPresent
Length of the date cavity (mm)35.20 ± 0.0839.60 ± 0.1037.80 ± 0.0932.60 ± 0.1020.90 ± 0.09
Width of the date cavity (mm)09.40 ± 0.0511.50 ± 0.0409.30 ± 0.0409.20 ± 0.0415.00 ± 0.08
Length of the seed (mm)2.65 ± 0.023.02 ± 0.092.70 ± 0.032.59 ± 0.101.88 ± 0.037
Average seed weight (g)0.83 ± 0.041.75 ± 0.110.96 ± 0.110.86 ± 0.130.99 ± 0.05
Seed shapeSub cylindricalSub cylindricalSub cylindricalSub cylindricalOval
Harvest periodLate (In November)Late (In November)Early (At the end of August)Early (At the end of August)Early (At the end of August)
Utilization (by-product)Export for all usesFlourUsed as a paste and RobeUsed as RobeUsed as a paste and Robe
Table 3. Criteria for the geometric classification of date palm fruit.
Table 3. Criteria for the geometric classification of date palm fruit.
Fruit (Tamr Stage)Deglet NourDegla BaidaGharsTenicinTantboucht
Average fruit length
(mm)
41.20 ± 0.1047.20 ± 0.1142.20 ± 0.1639.60 ± 0.1425.80 ± 0.08
Minimum fruit length
(mm)
41.1047.0942.0439.4625.72
Maximum fruit length
(mm)
41.3047.3132.3639.7425.88
Average fruit diameter
(mm)
19.20 ± 0.5322.62 ± 0.1122.20 ± 0.1629.61 ± 0.1425.89 ± 0.08
Minimum fruit diameter
(mm)
18.6722.5122.0429.4725.81
Maximum fruit diameter
(mm)
19.7322.7322.3629.7525.97
Source: own study based on empirical research.
Table 4. Changing the size of DateNET model maps depending on layer number.
Table 4. Changing the size of DateNET model maps depending on layer number.
Layer (Type)Output ShapeParam
conv2d (Conv2D)(None, 198, 198, 32)645
max_pooling2d (MaxPooling2D)(None, 99, 99, 32)0
dropout (Dropout)(None, 99, 99, 32)0
conv2d_1 (Conv2D)(None, 97, 97, 64)12,421
max_pooling2d_1 (MaxPooling2D)(None, 48, 48, 64)0
dropout_1 (Dropout)(None, 48, 48, 64)0
conv2d_2 (Conv2D)(None, 46, 46, 128)59,959
max_pooling2d_2 (MaxPooling2D)(None, 23, 23, 128)0
dropout_2 (Dropout)(None, 23, 23, 128)0
conv2d_3 (Conv2D)(None, 21, 21, 128)121,664
max_pooling2d_3 (MaxPooling2D)(None, 10, 10, 128)0
dropout_3 (Dropout)(None, 10, 10, 128)0
flatten (Flatten)(None, 12,800)0
dense (Dense)(None, 512)4,454,424
dense_1 (Dense)(None, 1)527
Total params: 4,459,332; trainable params: 4,459,332; non-trainable params: 0.
Table 5. Geometric parameters of dates from labels generated by the DateNET model.
Table 5. Geometric parameters of dates from labels generated by the DateNET model.
Code PhotosArea
[mm2]
ECPE
[mm]
MD
[mm]
DAD
[mm]
Length
[mm]
DAL
[mm]
DFV ΔECR
1234567891011
DN001735.800.99104.0919.31+0.1141.03+0.03DN2.7True
DN002672.980.97100.4419.25+0.0541.19−0.01DN2.8True
DN003665.680.98100.2419.27+0.0741.12−0.08DN2.6True
DN004554.740.9993.7418.98−0.2241.30+0.10DN2.4True
DN005663.451.0098.7519.25+0.8540.99−0.21DN2.9True
DN099635.770.98101.2219.25+0.0541.04−0.16DN2.0True
DN100555.650.99100.2419.17−0.0341.12−0.08DN2.7True
DB001764.690.99109.6321.84−0.7846.68−0,52DB3.6True
DB002871.331.00120.5021.87−0.7548.78+1.58DB2.9True
DB003853.850.99116.3322.89+0.2746.83−0.37DB1.9True
DB004924.100.95123.2023.10+0.4849.55+2.35DB2.4True
DB005868.780.98115.8023.40+0.7847.12−0.08DB2.2True
DB099851.850.99117.3722.87+0.2545.83−1.37DB3.2True
DB100921.100.97125.2023.15+0.5347.55+0.35DB0.7False
GH001740.180.99105.2521.65−0.5540.88−1.32GH4.2True
GH002764.180.99108.7822.09−0,1143.36+1.16GH4.5True
GH003794.690.97109.0724.03+1.8342.42+0.22GH5.1True
GH004761.430.95109.7323.15+0.9541.66−0.54GH4.9True
GH005701.841.00106.4120.06−2.1440.83−1.37GH5.0True
GH099762.430.95108.7822.15−0.0541.68−0.52GH2.9True
GH100721.841.00107.4721.06−1.1441.23−0.97GH3.1True
TE001956.431.00112.4929.83+0.2239.07−0.53TE5.9True
TE002982.990.99115.1631.62+2.0139.77+0.17TE3.6True
TE003805.701.00104.4029.16−0.4538.90−0.70TE3.3True
TE004817.350.98196.8728.83−0.7839.12−0.48TE0.9False
TE005873.470.99108.7028.57−1.0440.02+0.42TE3.9True
TE099805.751.00105.4529.15−0.4638,90−0.70TE4.4True
TE100815.550.98195.8528.85−0.7639.12−0.48TE5.5True
TA001482.171.0079.6425.14−0.7525.23−0.57TA4.2True
TA002482.091.0079.0024.67−1.2225.45−0.35TA5.4True
TA003490.131.0080.1724.92−0.9724.48−1.32TA4.7True
TA004499.181.0080.7825.18−0.7125.04−0.76TA3.6True
TA005612.141.0091.7329.52+3.6324.44−1.36TA4.1True
TA099485.091.0079.5524.56−1.3325.55−0.25TA5.6True
TA100490.441.0080.4424.94−0.9524.44−1.36T TA1.2False
EC—eccentricity, PE—perimeter, MD—maximum diameter, DAD—deviation from average diameter, DAL—deviation from average length, DFV—date palm fruit variety, CR—correction.
Table 6. Performance of the proposed date palm fruit variety classification model DateNET.
Table 6. Performance of the proposed date palm fruit variety classification model DateNET.
Classification Type ACC
[%]
PPV
[%]
TPR
[%]
fscore
[%]
Average Classification Time
GPU *
[ms/Image]
Colour85.2485.2985.2086.8920.43
Geometric parameters 87.6287.6687.6090.7623.67
Colour and geometric parameters93.4193.4093.4095.0327.88
* GPU: NVIDIA GeForce RTX Studio 2060, 32 GB (NVIDIA, Santa Clara, CA, USA).
Table 7. Comparison of DateNet, ResNet, Mobilenet, and ShuffleNet classification performance and time.
Table 7. Comparison of DateNet, ResNet, Mobilenet, and ShuffleNet classification performance and time.
Classification TypeACC
[%]
PPV
[%]
TPR
[%]
fscore
[%]
Average Classification Time
GPU *
[ms/Image]
DateNET93.4393.4193.4195.0327.89
ResNet93.2494.2794.2894.0920.77
MobileNet91.9894.2794.2794.2721.42
ShuffleNet89.6291.6691.6690.7622.66
* GPU: NVIDIA GeForce RTX Studio 2060, 32 GB.
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Rybacki, P.; Niemann, J.; Derouiche, S.; Chetehouna, S.; Boulaares, I.; Seghir, N.M.; Diatta, J.; Osuch, A. Convolutional Neural Network (CNN) Model for the Classification of Varieties of Date Palm Fruits (Phoenix dactylifera L.). Sensors 2024, 24, 558. https://doi.org/10.3390/s24020558

AMA Style

Rybacki P, Niemann J, Derouiche S, Chetehouna S, Boulaares I, Seghir NM, Diatta J, Osuch A. Convolutional Neural Network (CNN) Model for the Classification of Varieties of Date Palm Fruits (Phoenix dactylifera L.). Sensors. 2024; 24(2):558. https://doi.org/10.3390/s24020558

Chicago/Turabian Style

Rybacki, Piotr, Janetta Niemann, Samir Derouiche, Sara Chetehouna, Islam Boulaares, Nili Mohammed Seghir, Jean Diatta, and Andrzej Osuch. 2024. "Convolutional Neural Network (CNN) Model for the Classification of Varieties of Date Palm Fruits (Phoenix dactylifera L.)" Sensors 24, no. 2: 558. https://doi.org/10.3390/s24020558

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop