AGRICULTURAL AND FOOD SCIENCE Agricultural and Food Science (2024) 33: 40–54 40 https://doi.org/10.23986/afsci.135986 Convolutional neural network model for the qualitative evaluation of geometric shape of carrot root Piotr Rybacki1, Zuzanna Sawinska1, Miroslava Kačániová2, Przemysław Ł. Kowalczewski3, Andrzej Osuch4 and Karol Durczak4 1Department of Agronomy, Faculty of Agronomy, Horticulture and Bioengineering, Poznan University of Life Sciences, Dojazd 11, 60-632 Poznan, Poland 2Institute of Horticulture, Faculty of Horticulture and Landscape Engineering, Slovak University of Agriculture, 94976 Nitra, Slovakia 3Department of Food Technology of Plant Origin, Poznań University of Life Sciences, 31 Wojska Polskiego St., 60-624 Poznań, Poland 4Department of Biosystems Engineering, Faculty of Environmental and Mechanical Engineering, Poznan University of Life Sciences, Wojska Polskiego 50, 60-637 Poznan, Poland e-mail: piotr.rybacki@up.poznan.pl The main objective of the study is the development of an automatic carrot root classification model, marked as CR- NET, with the use of a Convolutional Neural Network (CNN). CNN with a constant architecture was built, consisting of an alternating arrangement of five Conv2D, MaxPooling2D and Dropout classes, for which in the Python 3.9 programming language a calculation algorithm was developed. It was found that the classification process of the carrot root images was carried out with an accuracy of 89.06%, meaning that 50 images were misclassified. The highest number of 21 erroneously classified photographs were from the extra class, of which 15 to the first class, thus not resulting in significant loss. However, assuming the number of refuse as the classification basis, the model accuracy greatly increases to 98.69%, as only 6 photographs were erroneously assigned. Key words: food quality, Python, machine learning, CNN Introduction Carrot (Daucus carota L.) is one of the world’s most popular root vegetable, characterised by high content of carotene, carotenoids, fibre, amino acids, trace elements (J, Fe, Cu, Zn, Mn); and vitamins (A, C, B1, B2, B3, B6, B12, D, E) (Rinne et a. 2019, Xie et al. 2019a, Jahanbakhshi & Kheiralipour 2020, Szczepańska et al. 2020). According to FAO data (2022) the global production of carrot in 2022 amounted to 44.80 M tonnes, of which 21.40 M tonnes, were produced by continental China, amounting to 47.77% of the vegetable’s global production. As per Eurostat (2022) the EU produced 5.27 M tonnes, with Germany (961.97 thousand tonnes), France (706.75 thousand tonnes), the Netherlands (643.19 thousand tonnes) and Poland (638.40 thousand tonnes) being the largest producers. With this production level, it is important to obtain root yield of appropriate quality, above all in terms of nutrient content, but also their morphological traits, primarily: colouration, shape, length, diameter. Unfortunately, defects may occur on carrot roots, such as: cracks, deformities caused by natural factors (soil, climate) and by human actors (harvesting technique, transport and storage conditions), which reduce their commercial value, which is of great and quantifiable importance for producers. Deformed or damaged carrot roots are more difficult to store, because they are more frequently subject to infections. That is why it is of significant importance to sort carrot roots and classify them into quality classes directly after harvest, which may improve their market competitiveness (Zhu et al. 2021a, Zhu et al. 2021b). Currently carrot root classification is based on three-dimensional variables, e.g. volume, length, diameter. Traditional classification of roots and measurement of their geometric parameters is highly labour-intensive, offers little efficiency and it is burdened by a high likelihood of errors (Brainard et al. 2021). That is why it is necessary to develop new, fast and accurate methods enhancing this process. Modern digital techniques based on artificial intelligence (AI), usability (Cappelli et al. 2019), machine learning (ML), and computer image analysis offer a great help for the distinction of qualitative traits of agricultural products based on colour (Abdulridha at al. 2020, Rybacki et al. 2023), shape (Deng et al. 2017, Deng et al. 2021, Xie et al. 2023), texture (Grinblat et al. 2016) and light spectrum (Sun et al. 2022). Digital techniques and methods provide new knowledge that can be used for the control of quality of food and agricultural products with high accuracy (Franco et al. 2021). Received 23 August 2023 / Accepted 8 March 2024 The Scientific Agricultural Society of Finland ©This is an open access article under the CC BY 4.012 P. Rybacki et al. 41 A modern and intensively developing artificial intelligence tool is the Convolutional Neural Networks (CNN) meth- od, which is used to solve a range of problems complex on numerous levels, e.g. assessment of the quality of products, crops and other biological material (Xie et al. 2019a, Xie et al. 2019b), object identification (Raghu et al. 2018), human face and movement action in people (Arunnehru et al. 2018), traffic monitoring (Lemley et al. 2017). Models generated by CNNs play a significant role in medicine for the understanding of the genetics and treatment of such diseases as skin (Esteva et al. 2017), brain (Jermyn et al. 2015) and breast cancer (Zheng et al. 2023) and aneurysm or autism in children (Torres et al. 2023). CNNs are also used in robotics for the purpose of visual navi- gation (Bachute et al. 2021), terrestrial robot route movement planning (Madridano et al. 2021), controlling the route of autonomous vehicles (Lazar et al. 2021), programming of production manipulators (Levine et al. 2016). The possibility of utilising CNNs and image analysis for the assessment of the quality of food products, roots and tubers of root crops, identification of weeds, diseases or pests of crops is currently a subject of interest for several researchers (Hadipour-Rokni et al. 2023, Momeny et al. 2023, Yu et al. 2023). Computer image analysis has become one of the main techniques used in agriculture to assess seed and grain in terms of qualitative losses, quantifying the degree of their mechanical damage, maturity phase, infection with diseases or contamination with other plant species. The lack of invasiveness of these methods and the increasing computing power of computers results in the image analysis and CNNs having a significant advantage over the labour-intensive and costly methods destroying the assessed material (Kaya et al. 2023, Singh et al. 2023). Computer techniques and artificial intelli- gence enable the use of precision agriculture in sustainable fertilization and point application of plant protection products, as well as precise agrotechnical treatments, e.g. sowing, planting seedlings (Osuch et al. 2020, Rybacki et al. 2021, Coulibaly et al. 2022, Rybacki et al. 2022, Gkillas et al. 2023, Raptis et al. 2023, Sanaeifar et al. 2023). Already in the previous century numerous researchers used computer image analysis for the qualitative assess- ment of carrot, yet due to the hardware limitations and low computing power of the computers it was solely used to identify the external traits of roots. Batchelor and Searcy (1989) used image analysis to identify the stem and root contact, Howarth (1990) analysed discolorations of root surface, Howarth and Searcy (1991) analysed root shape defects, and Howarth et al. (1992) traits of root tip shape traits. With the rapid development of com- puter techniques and the emergence of new programming languages, more detailed and in-depth studies on the classification of carrot roots were commenced. Hahn and Sanchez (2000) developed an algorithm for a precise prediction of carrot volume with two images separated by 90°. Literature includes studies proposing algorithms used to identify image based on specific traits of each carrot defect (Deng et al. 2017, Xie et al. 2019a, Xie at al. 2020). Xie et al. (2019b) in turn distinguished carrot image traits, and then by using Back Propagation in Neural Network (BPNN), Support Vector Machines (SVM) and Extreme Learning Machines (ELM) classified the roots into four classes. On the other hand, Zhu et al. (2019) and Ni et al. (2020) used machine learning to identify defective and normal carrots and to identify a specific type of defect. The main objective of the study is the development of an automatic carrot root classification model with the use of a convolutional neural network (CNN). CNN with a constant architecture was built, consisting of an alternating arrangement of five Conv2D, MaxPooling2D and Dropout classes, for which in the Python 3.9 programming lan- guage a calculation algorithm was developed. Purpose, material and study methodology Definition of carrot root classification criteria The quality requirements for fresh fruit and vegetables covered by the common market organization have been assumed as the basis for the definition of carrot root classification criteria with the use of CNN model. These standards are introduced via the Commission regulations, that is general application legal acts, applicable in whole in all member states. The commercial quality standard for carrot root is outlined in the Commission Regulation (EC) nr 730/1999 of 7 April 1999 including amendments to the standard introduced with Regulation (EC) nr 46/2003 of 10 January 2003, with appendix no. 1. In all quality classes, including the detailed requirements for the given class and the permissible tolerances, carrot should be whole and healthy. It must not have any damage that occurred both during the growth phase, harvest, top removal, packing, as well as other activities related to its preparation for consumption, storage or processing. Carrot roots must not have heads, broken off lateral roots, symptoms of diseases, decay processes, spots, mould or other changes making it unfit for consumption or storage. Independently of its intended use, carrot should be Agricultural and Food Science (2024) 33: 40–54 42 free of contamination with foreign bodies and pests or damage caused by pests, without signs of wilting, drying or lignification. Carrot should only have a single root, without any bifucractions or lateral branching. In terms of quality, carrot roots are divided into three classes: extra, first and second. In the extra class, carrot should be of the highest quality and possess traits characteristic of the given cultivar. The roots should be free of damage with the exception for superficial, minor ones that do not affect the overall appearance and quality. Roots with green or violet-purple heads are not acceptable. In the first class, carrot should be of the good quality and possess traits characteristic of the given cultivar. No cracks, breakings or other mechanical damage are permissible. The second class includes carrot, which does not meet the requirements of the higher classes, but it meets the above requirements to a minimum level. Second class carrot should have an appropriate commercial quality. Minor defects are permissible, on the condition that the carrot maintains its characteristic traits in terms of quality and shelf-life. It has been assumed that if the carrot is sorted according to its diameter, it should not be lower than 30 mm for the commercial yield (Table 1). When sorting according to the weight, the roots should weigh no less than 50 g. In the extra class, carrot root diameter should not exceed 45 mm, if the carrot is sorted according to its diameter. When sorting according to the weight, the roots should not weigh more than 200 g. The difference in the diameter between the smallest and largest carrot root in the commercial yield weight unit should not exceed 20 mm (when sorted due the diameter) and when sorted due to the weight, the difference should not exceed 150 g. In the first class, the difference in the diameter between the smallest and largest carrot root in the weight unit should not exceed 30 mm (when sorted due the diameter) and when sorted due to the weight, the difference should not exceed 200 g. In the second class, carrot root should only fulfil minimum diameter or weight requirements. For the carrot, which does not meet the quality and size requirements set out for the given class, certain tolerances are permissible. These are expressed numerically or by weight and amount for the extra class to 5%, for first and second class –10% for quality tolerances and 10% for all classes in the case of size tolerances. Preparation of the data set The empirical material in the preparation of the CNN model for the geometric classification consisted of car- rot root photographs, which according to breeder data is characterized by strong foliation, good tolerance for fungal diseases and cylindrical roots. Carrot used for the digital analysis was cultivated on ridges with a trapezoid cross section and distance between the ridges of 75 cm. The main purpose of the roots were fresh consumption, storage and processing for: juices, frozen food, cubes and slices. The carrot harvest from the fields was performed in one stage, which was significant for the possible mechanical damage. Figure 1 presents example images of carrot roots collected from the fields. Figure 1a presents the cylindrical (correct) shape of the root, without damage and deformations, which is evaluated and classified to the appropriate quality class. On the other hand, Figures 1b to 1e present carrot roots that are: broken (Fig. 1b), cracked (Fig. 1c), deformed (Fig. 1d) and bruised (Fig. 1e), considered as out of class in terms of quality. The carrot root photographs were taken with a digital camera equipped with a 1/2.3-inch sensor with the reso- lution of 4288 × 3216 (14 million) pixels and a 36x optical zoom. The shortest focal length of the camera was 24 mm, which corresponded to its maximum aperture value of 1:2.9. The carrot root imaging was performed using maximum zoom, and the imaging surface, at which the roots were placed was located at 50 cm from the lens. The imaging was performed in a chamber with black and non-reflective surface, illuminated with three sources of light and intensity of 800 lumens. The photograph files were saved in the internal memory of the camera, and then in 96 dpi resolution and dimensions 2139 × 1888 in the memory of a computer. Table 1. Criteria for classifying carrot roots Parameter Diameter Mass Difference in diameter of carrot roots per unit weight Difference in weight of carrot roots per unit weight Quality tolerance Size tolerance Class (mm) (g) (mm) (g) (%) (%) extra class 30–45 50–200 20 150 5 – first class >30 >50 30 200 10 10 second class >30 >50 – – 10 10 source: (WE) nr 730/1999 P. Rybacki et al. 43 457 photographs of carrot roots were made (436 had normal shape and 21 had damage or deformations). Table 2 lists a random numbering of the photographs and root characteristics. The carrot root length and diameter were measured with calipers with electronic display and ±0.01 mm accuracy, and the weight was measured using a laboratory scale with ±0.01 g accuracy. Image preprocessing In its most simple, single-channel form (e.g. black and white, grey scale, binary or monochromatic) image is a two-dimensional function f(x, y) reproducing a pair of coordinates via a real number, which is linked to the inten- sity (colour) of a given point. The image can have numerous channels, such as RGB colour image, where colour is Fig. 1. Pictured carrot roots: a) Normal (Nl), b) Broken (Bn), c) Crack (Ck), d) Malformation (Mn), e) Bruise (Be) Table 2. Codes, real geometric sizes and mass of carrot roots imaged Code Root shape Diameter (mm) Length (mm) Mass (g) Discoloration Class carrot-001 Nl 34.81 208.54 156.75 no extra class carrot-002 Nl 36.12 211.32 204.34 no first class carrot-003 Nl 27.31 151.83 133.66 no not Classified carrot-004 Nl 42.73 202.74 198.25 no first class carrot-005 Bn 44.92 194.26 199.04 no not Classified carrot-006 Nl 35.24 163.07 162.60 no first class carrot-007 Nl 33.42 187.55 155.05 no extra class carrot-008 Nl 36.73 197.89 189.36 no extra class carrot-009 Nl 44.01 210.04 198.42 no first class carrot-010 Be 32.37 177.42 153.99 greening not Classified … … … … … … … carrot-448 Nl 40.48 201.48 193.40 no first class carrot-449 Nl 37.77 179.33 185.18 no extra class carrot-450 Nl 34.46 175.97 181.26 no extra class carrot-451 Nl 37.16 186.66 188.23 no extra class carrot-452 Nl 30.14 175.35 153.64 no extra class carrot-453 Nl 31.66 171.84 154.65 no extra class carrot-454 Nl 25.95 134.35 141.36 no not Classified carrot-455 Ck 38.44 199.96 189.93 greening not Classified carrot-456 Nl 35.90 224.44 195.02 no extra class carrot-457 Mn 28.02 205.26 197.64 no not Classified a) b) c) d) e) Agricultural and Food Science (2024) 33: 40–54 44 represented via three channels: red, green and blue. For an RGB image, every pixel on the coordinates (x, y) can be represented by three tuples (Irx,y, Igx,y, Ibx,y). In order to be able to process it, the image f(x, y) is digital- ized in spatial and amplitude terms. Digitalization of spatial coordinates (x, y) is defined by image sampling, and amplitude digitalization is referred to as grey level quantization. The pixel value that corresponds to a channel is typically represented as a floating-point value from the range 0–1 or an absolute value from the range 0–255. Software To develop the carrot root classification algorithms, the Python 3.9 programming language was used with libraries (programming environments) for scientific calculations: Scikit-shape, Numpy, SciPy, Keras, Scipy, TensorFlow 2.0. Scikit-shape is a Python library intended for the analysis and identification of geometric shapes in computer im- age analysis. Scikit-shape is a Python toolset for image segmentation, detection and analysis of shapes, creation of adaptive curves and grid of objects. It is based on NumPy, SciPy, Numba, Matplotlib, MeshPy, Igraph packages, enabling the conduct of efficient calculations and creation of clear graphics. The Scikit-shape library offers shape representation, comparison and classification functions and constitutes the basis for the developed model. It includes such shape descriptor distinction methods as: Fourier and Zernike, which are numerical representations of shapes used for analysis and comparison. These descriptors can be used to measure similarity or difference of geometric shapes, which is important in the case of carrot root shape classification. SciPy is an open-source Python library, used for solving scientific and mathematic problems. It is built on the NumPy extension and enables user to manipulate and visualise data using a wide range of high-level commands. NumPy includes array data and basic operations on data, such as sorting, indexing etc. The TensorFlow 2.0 library is a scalable, multi-platform programming interface used to launch machine learning algorithms. On the other hand, Keras is a specialized API (Application Programming Interface) intended for the creation of neural networks, originally designed as an auxiliary class for the TensorFlow library. Loading and preliminary processing of the data set The carrot root images made are loaded to NumPy arrays using character-free, 8-bit fix point numbers, assuming values in the range (0, 255). Two TensorFlow 2.0 modules will be used for the preparation of the data set. First one is tf.io used to load and store data and the second, tf.image, to decode the unprocessed content and to change the image dimensions, which is necessary for different sizes of carrot roots. In the first place, the content of the files was checked, and a list of carrot root photograph names was generated using the pathlib library, subsequently they were visualised, and their size was determined according to the 1 code available at https://github.com/piotrrybacki/carrot-roots-CNN.git (Fig. 2). The displayed file list shows that the data set contains 457 carrot root photographs and takes up 2.51 GB. The number of photographs of the class: extra, first and second was 435, (210 photographs of extra class, 151 photo- graphs of the first class and 74 photographs of the second class) and out of class 22, of which 21 had deformations Fig. 2. Visualisation of images of carrot roots P. Rybacki et al. 45 or damage. Photographs of the imaged carrot roots were divided at random into three subsets, i.e.: a training data set of 237 photographs and validation and test sets, each containing 110 photographs. Listing 2 presents code 2 (https://github.com/piotrrybacki/carrot-roots-CNN.git) enabling automatic copying of images from the source catalogue to the training, validation and test catalogues. Architecture of the multi-layer CNN Due to the extensive geometric analysis of the imaged carrot roots, an authorial and original CNN structure, marked as CR-NET as an alternating arrangement of five classes MaxPooling2D, Dropout and Conv2D with ReLu activation function, and the Keras interface was used for the CNN implementation. The originality of the model also lies in the development of a computational algorithm that can be easily adapted to any classification criteria. The Max- Poo12D class creates maximising connecting layers. Argument pool size = 2 determines the size of the window used to calculate the maximum value, and the strides = 1 parameter is used to configure the connecting layer. Use of the Dropout class enables the construction of an abandonment layer for the purpose of regularisation, where the rate argument determines the probability of abandoning input units during network learning. When generat- ing this layer, its operation can be regulated through training argument. This argument determines whether the generation is to take place during training or inferring. By default, the Conv2D class assumes that the input data are compliant with the NWHC format, where N means the number of photographs in the input group, W and H determine the width and height of the image respectively, and C provides the number of channels. As shown in Figure 3, after each convolutional layer a connecting layer was placed, the task of which is to reduce the feature map size, the so-called subsampling. The input tensor was transformed to object maps measuring 200×200, which ultimately enabled obtaining 7 × 7 object maps right before the flattening layer. Such a transformation resulted in the object maps depth increased from 32 to 128, whereas the object map size decreases from 200 × 200 to 7 × 7. A binary classification was used in the developed model, which enabled finishing the network with Dense layers. One layer with 512 dimension and ReLu activation function, and second with 1 dimension and Sigmoid activation function. Listing 3 included in https://github.com/piotrrybacki/carrot-roots-CNN.git presents the code programming the model from Figure 3. Considering the file number (carrot root image), the example algorithm automatically sorted them in terms of diameter and length and copied them to the appropriate catalogue, from which they were subsequently collected by the CNN model algorithm. Another stage of the constructed model is the plotting of loss curves and values of analysis and prediction accu- racy according to code 4 (https://github.com/piotrrybacki/carrot-roots-CNN.git). The performance of the developed carrot roots classification model was also evaluated using the measures of speed and prediction accuracy. The speed of the model was measured by the classification rate, expressing the number of assigned images per second, and the average classification time for a single carrots root image. The model accuracy was evaluated using positive predictive value (PPV), true positive rate (TPR), as well as the result correction factor (f), and its accuracy (ACC). These measures were determined using Equations 1–4. Fig. 3. Diagram of the implemented CNN network (CR-NET) Agricultural and Food Science (2024) 33: 40–54 46 (1) (2) (3) where: TPx - true positive, FPx - false positive, FNx - false negative, = 0.5 gives equal weight to TPR and PPV, (4) where: n = no. of classes, Ii = no. of images in classe i For class X, in this analysis of carrot roots varieties, if TPX is a true positive, i.e. the number of images correctly recognised and assigned to class X. PPVX is the number of true positive results divided by the total number of images predicted as belonging 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 (4) was calculated using balanced accuracy, which normalizes the true positive result for each class by the number of images in the class and divides their sum by the number of carrot roots varieties. Balanced accuracy ensures that all classes contribute equally to the overall accuracy calcu- lation, even if the number of carrot roots images in the classes is unequal. To illustrate the classification accuracy for carrot roots, confusion matrices of the models were used according to the format in Figure 4. The final stage of the analysis is to display the result of predictions in the form of probabilities of belonging to par- ticular quality classes of carrot roots and transforming them into using the tf.argmax function, which will search for the image with the highest probability of belonging and assign the appropriate label being the name of the carrot root (photo code) and the assumed parameters geometric, i.e. the surface of the imaged root, its circumference, diameter and length. This was performed for the entire group of 457 photographs and both input data, as well as the predicted labels according to code 5 (https://github.com/piotrrybacki/carrot-roots-CNN.git). 𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑋𝑋𝑋𝑋 = 𝑇𝑇𝑇𝑇𝑃𝑃𝑃𝑃𝑋𝑋𝑋𝑋 𝑇𝑇𝑇𝑇𝑃𝑃𝑃𝑃𝑋𝑋𝑋𝑋 + 𝐹𝐹𝐹𝐹𝑃𝑃𝑃𝑃𝑋𝑋𝑋𝑋 , 𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑋𝑋𝑋𝑋 = 𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑋𝑋𝑋𝑋 𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑋𝑋𝑋𝑋 + 𝐹𝐹𝐹𝐹𝐹𝐹𝐹𝐹𝑋𝑋𝑋𝑋 , 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑋𝑋𝑋𝑋 = 1 𝛼𝛼𝛼𝛼 𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑋𝑋𝑋𝑋 + 𝛼𝛼𝛼𝛼 𝑇𝑇𝑇𝑇𝑃𝑃𝑃𝑃𝑇𝑇𝑇𝑇𝑋𝑋𝑋𝑋 , ∝ 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴 = ∑ 𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑖𝑖𝑖𝑖 𝐼𝐼𝐼𝐼𝑖𝑖𝑖𝑖 𝑛𝑛𝑛𝑛 𝑖𝑖𝑖𝑖=1 𝑛𝑛𝑛𝑛 , Fig. 4. Confusion matrix scheme for the classification of carrot roots varieties P. Rybacki et al. 47 To check the accuracy of the models in the study, a 10-fold cross-validation was applied. Carrot root images are divided into a total of 10 subgroups using a 10-fold algorithm, by code 6 (https://github.com/piotrrybacki/carrot- roots-CNN.git). Due to the odd number of photos, each subgroup is completed with one, not changing the result. The remaining subgroup is utilized as test data, and nine subgroups are employed as training data for each round of the models’ training. As most of the data is utilized to train the models for 10 iterations, this lowers the bias. Additionally, each iteration’s model weights for the convolutional layers are continuously updated, which increas- es the effectiveness of training. Fig. 5 depicts a common k-fold design. The model in this research is trained for 10 iterations after the input data is divided into k = 10 subgroups. Ratios were used to assess the accuracy of the models: MSE (Mean Square Error) or RMSE (Root Mean Square Error), according to equations 5 and 6: (5) (6) where: Rij, Gij, Bij – the colour components of the original image, R* ij, G * ij, B * ij – the colour components of the image resulting from quantisation, M, N – spatial resolution of the image. Analysis results The final effect of the conducted analyses is the proposal of the CNN architecture and the Python 3.9 code enabling automatic comparison and geometric classification of carrot roots and assigning them to the appropriate quality class based on diameter and length. Table 3 presents a list of map size changes depending on the number of layer of the developed CNN model. “None” in column 2 means that there is an arbitrary number of input samples. The number of input samples is not limited. Column 1 shows the structure of the CNN and column 3 will show the number of calculation parameters at each layer change. As can be seen from the data, each hidden layer in the CNN model results in the decrease of the maps, obtaining 3738262 parameters at the output. Fig. 5. k-fold-cross-validation prosses 𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀 = 1 3𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀 � � [�𝑅𝑅𝑅𝑅𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖 − 𝑅𝑅𝑅𝑅𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖∗ � 2 + �𝐺𝐺𝐺𝐺𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖 − 𝐺𝐺𝐺𝐺𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖∗ � 2 + �𝐵𝐵𝐵𝐵𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖 − 𝐵𝐵𝐵𝐵𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖∗ � 2] 𝑁𝑁𝑁𝑁 𝑖𝑖𝑖𝑖=1 𝑀𝑀𝑀𝑀 𝑖𝑖𝑖𝑖=1 𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅 = √𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅 Agricultural and Food Science (2024) 33: 40–54 48 The developed code for the proposed CNN architecture enabled an automatic sorting of carrot root images for training, validation and test catalogues. Subsequently, based on randomly selected order, the algorithm performed a supervised training of the model and their validation, the results of which is presented in Figure 6. As shown in Figure 6 the learning process accuracy for the proposed model was 94.53%, and the validation accuracy 87.14% (Fig 6a). The loss chart (Fig. 6b) shows that in the model training process the losses amounted to 19.11%, and in the model validation process 37.44%. Ablation of any layer resulted in a 15–42% decrease in accuracy. How- ever, an increase in the number of hidden layers resulted in an extension of the classification time and the risk of overfitting the model, the so-called excessive fitting (overfitting). The developed algorithm searched image with the highest likelihood of affiliation and assigned the appropriate label, which is an information set calculated based on the image shape and number of pixels, with geometric carrot root parameters. The label includes information on the surface of the imaged root, its circumference, diameter and length. It further includes eccentricity index, which is a ratio between the length of the radii from the centre of weight of the cross-section analysed. The ec- centricity index close to 1.00 shows that the axis of symmetry of the root is a straight line. The label also includes information about the root quality class. Figure 7 shows nine example carrot roots of the 457 analysed, with the Table 3. Summary of changes in map size depending on the layer number of the developed CNN model CR-NET Layer (type) Output Shape Param 1 2 3 conv2d (Conv2D) (None, 198, 198, 32) 595 max_pooling2d (MaxPooling2D) (None, 99, 99, 32) 0 dropout (Dropout) (None, 99, 99, 32) 0 conv2d_1 (Conv2D) (None, 97, 97, 64) 11491 max_pooling2d_1 (MaxPooling2D) (None, 48, 48, 64) 0 dropout_1 (Dropout) (None, 48, 48, 64) 0 conv2d_2 (Conv2D) (None, 46, 46, 128) 53857 max_pooling2d_2 (MaxPooling2D) (None, 23, 23, 128) 0 dropout_2 (Dropout) (None, 23, 23, 128) 0 conv2d_3 (Conv2D) (None, 21, 21, 128) 117585 max_pooling2d_3 (MaxPooling2D) (None, 10, 10, 128) 0 dropout_3 (Dropout) (None, 10, 10, 128) 0 flatten (Flatten) (None, 12800) 0 dense (Dense) (None, 512) 3554221 dense_1 (Dense) (None, 1) 513 Total params: 3738262; Trainable params: 3738262; Non-trainable params: 0 Fig. 6. Visualisation of loss function curves and learning accuracy and validation for the created CNN in carrot root classification a) training and validation accuracy, b) training and validation loss P. Rybacki et al. 49 assigned label and quality class. The expression True was added to the label with correct root quality classifica- tion, and False with erroneous label assignment. The main reason for the classification errors was root curvature. Table 4 lists data generated by the proposed model and the constructed CNN architecture. This list was compared with the empirical measurements of diameters and lengths of carrot root and it was determined, that the differ- ences in the reading of the geometric values of the roots based on the number of pixels were 4% at maximum. Fig. 7. Example output of imaged carrot roots with their predicted label Table 4. Label data generated by the CNN model CR-NET Code Area (mm2) Eccentricity Perimeter (mm) Average diameter (mm) Realistic diameter (mm) Precision of diameters (-) Length (mm) Realistic length (mm) Precision of length (-) Quality class Correction 1 2 3 4 5 6 7 8 9 10 11 12 carrot-001 6674.17 0.98 466.83 34.49 34.81 1.01 216.20 208.54 0.96 extra class True carrot-002 6652.12 0.89 467.69 35.55 36.12 1.02 216.33 211.32 0.98 first class True carrot-003 5126.34 0.87 443.21 27.16 27.31 1.01 152.23 151.83 1.00 not classified True carrot-004 5042.95 0.95 352.73 43.44 42.73 0.98 205.75 202.74 0.99 first class True carrot-005 3428,14 0.99 239,78 45.55 44.92 0.99 146.66 154.26 1.05 not classified False carrot-006 5059.71 0.99 353.91 34.82 35.24 1.01 165.47 163.07 0.99 first class True carrot-007 5905.52 1.00 413.07 33.94 33.42 0.98 188.25 187.55 1.00 extra class True carrot-008 5854.33 0.97 409.49 36.17 36.73 1.02 198.88 197.89 1.00 extra class True carrot-009 5097.58 0.89 356.55 44.33 44.01 0.99 212.24 210.04 0.99 first class False carrot-010 5884.13 0.99 411.57 31.93 32.37 1.01 176.46 177.42 1.01 not classified True … … … … … … … … … … … … carrot-228 5256.44 0.97 468.21 31.26 31.78 1.02 219.96 216.26 0.98 not classified True carrot-229 5638.21 0.99 473.62 31.70 32.27 1.02 220.57 223.53 1.01 extra class False carrot-230 6765.13 0.96 471.02 35.07 34.66 0.99 218.03 213.43 0.98 extra class True carrot-231 4099.55 0.99 320.30 36.02 36.96 1.03 135.03 139.93 1.04 extra class True carrot-232 5927.67 0.26 485.13 30.04 30.94 1.03 225.38 221.31 0.98 extra class False … … … … … … … … … … … … carrot-448 5364.12 0.99 375.20 40.98 40.48 0.99 206.46 201.48 0.98 first class False carrot-449 4878.73 1.00 341.25 38.27 37.77 0.99 175.36 179.33 1.02 extra class True carrot-450 5437.74 0.97 380.35 33.86 34.46 1.02 172.93 175.97 1.02 extra class True carrot-451 5306.16 0.98 371.14 37.86 37.16 0.98 188.68 186.66 0.99 extra class True carrot-452 5990.77 0.96 419.03 30.88 30.14 0.98 173.75 175.35 1.01 extra class True carrot-453 5870.80 1.00 410.64 32.26 31.66 0.98 177.88 171.84 0.97 extra class True carrot-454 5675.38 0.98 396.97 26.15 25.95 0.99 139.39 134.35 0.96 not classified False carrot-455 5532.49 0.89 386.97 38.94 38.44 0.99 202.34 199.96 0.99 not classified True carrot-456 7477.64 0.89 494.63 35.57 35.90 1.01 229.08 224.44 0.98 extra class True carrot-457 5163.40 0.21 473.89 27.43 28.02 1.02 200.65 205.26 1.02 extra class False Agricultural and Food Science (2024) 33: 40–54 50 On the other hand, the classification of carrot root photographs was realized at the 89.06% accuracy, i.e. 50 photographs of carrot root photographs were erroneously classified. There were 21 erroneously assigned photo- graphs of carrot root of the extra class, 15 of the first class, 8 of the second class, and 6 of out of class (Table 5). This indicates that the problem is not the reading of the geometric values from a photograph, e.g. diameter or root length, but its shape, bruising or cracks. However, assuming the number of refuse as the classification basis, the model accuracy greatly increases to 98.69%. Figure 8 presents the performance of the proposed CR-NET model on the validation data set using the confusion matrix. According to the Table 6, comparing the model proposed in this work with randomly selected models i.e. ResNet (Liang 2020), MobileNet (Howard et al. 2017) and ShuffleNet (Zhang et al. 2018), it can be concluded that it is char- acterized by higher 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 proposed model CR-NET is to enable assessement of geometric carrots parameters. This allows not only for classification but also for distinction in terms of roots size. This increases the average classification time compared to the fastest model by 2.40 ms/image. Table 5. Summary of misattributed labels in the carrot root photo grading process Type of class Number of roots in a class Correctly classified Total number of errors Percentage share extra class 210 189 21 10.00 first class 151 136 15 9.93 second class 74 66 8 10.81 not classified 22 16 6 27.27 total 457 407 50 10.94 Fig. 8. Confusion matrix of carrot roots variety classification model CR-NET Table 6. Comparison of CR-NET, ResNet, Mobilenet and ShuffleNet classification performance and time Classification type ACC (%) PPV (%) TPR (%) fscore (%) MSE RMSE Average classification time GPU* [ms/image] CR-NET 89.06 87.12 85.50 86.17 20.857 4.567 24.84 ResNet 87.22 86.26 84.23 85.05 18.870 4.344 23.77 MobileNet 86.96 83.24 85.57 86.22 26.225 5.121 22.44 ShuffleNet 86.43 86.62 83.46 85.74 17.927 4.234 22.64 *GPU: NVIDIA GeForce RTX Studio 2060, 32 GB P. Rybacki et al. 51 Results of correlation analysis presented in Figure 9 clearly show that the main parameter affecting the carrot root classification accuracy in the proposed model is the eccentricity value, that is the ratio of the length of the cross section radii in relation to the geometric centre of the root. Correlation of the correction and the eccentricity remained at the level of 0.77. Analysis did not show any correlation between the eccentricity value and the surface of the analysed carrot root. Value –0.16 confirms that the root shape, its diameter and length do not affect the image surface. Discussion Classification of carrot roots has become an important part of their processing, storage and further treatment and it plays a key role in the manufacture of high-quality products. However, qualitative quantification of carrot roots is highly labour-intensive, has low efficiency and accuracy, as it mainly depends on manual work. Thus, methods enabling automation of the process are searched, with the concomitant increase of its accuracy and efficiency. Computer vision and image analysis with the use of CNNs can prove helpful in this area. The method and CNN architecture developed as part of the study enabled analysis of carrot root images and reading of geometric di- mensions, on the basis of which and the assumed criteria, qualitative classification could be performed. The CNN architecture proposed in the study enables classification accuracy of 87.14%. Deng et al. (2021) proposed, a carrot classification system similar to the present study, which was based on computer vision and deep learning, enabling automatic assessment of carrot surface quality. These authors, based on ShuffleNet and transfer learning, constructed a deep learning model (CDDNet) to detect surface defects of carrot. Experimental results demonstrated the detection accuracy of the proposed CDDNet was 99.82% for binary classifi- cation and 93.01% multi-class classification and it exhibited good efficiency. The accuracy of matching classification and convex polygon approximation amounted to 92.8% and 95.1%, respectively. Carrot classification based on geometric shapes was also used by Xie et al. (2019a), distinguished six carrot shape parameters, including length, diameter, mean diameter, surface, circumference, shape coefficient and six colour parameters. Taking these 12 parameters as input function parameters, the authors proposed root identification and classification models based on the Back Propagation in Neural Network (BPNN), Support Vector Machines (SVM) and Extreme Learning Machines (ELM). Results show that the proposed image acquisition system can distinguish carrot feature parameters at a relatively high accuracy (96.67%). In a different study Xie et al. (2019b) proposed five quantitative indices defining the quality of carrot roots, i.e. greening, bending degree, number of fibrous roots, surface cracking de- gree and breaking degree. A total of 720 randomly selected carrot images were analysed. Experimental results show that the index accuracy amounted to 97.4%, 85.4%, 92.6%, 80.8% and 93.2%, respectively, and the overall Fig. 9. Correlation analysis of quality classes and geometric parameters of analyzed carrot root images Agricultural and Food Science (2024) 33: 40–54 52 index of geometric shape identification amounted to 90.9%, i.e. similar to the present study. Deng et al. (2017) developed a system comprising of subsystems: image processing, image acquisition, carrot root transport and control. The authors proposed a method for detecting geometric defects of carrot roots that are deformed, fibrous or with surface cracks. Experimental results demonstrated that the accuracy of roots with curvature, fi- brous and with surface cracks amounted to 95.5%, 98% and 88.3%. Xie et al. (2021) proposed a CarrotNet model based on computer vision utilizing DCNNs and elements of several traditional CNNs. In that study, optimisation was conducted for the key parameters by means of comparative analysis. Such a high model accuracy may result from the removal of partial network layers and the use of team learning. The authors believe that efficient CarrotNet can be used on-line. Xie et al. (2023) developed a root measurement method based on 3D reconstruction. The RGB-D acquisition system utilised by the authors comprised of a Time-of-Flight (ToF) sensor and a disc filled with round markers. Kinect sensor captures 16 RGB images and 16 depths from different views, to cover the entire carrot surface. Errors in recording points from different sites did not exceed the value of 2.4 mm, with the majority remaining within 1 mm range. The morphological variables (volume, length and maximum diameter) of 136 carrots were obtained from a 3D model generated using Poisson reconstruction method. The Mean Absolute Percentage Error (MAPE) between the actual morphological variables and those obtained from 3D model were below 3%. Conclusions The study proposes a model of automatic carrot roots classification based on colour contrast and their geometric shape utilizing CNN. The carrot root outline analysis model proposed in this study offers a dynamic approach to image segmentation and creates an edge or curvature of each object section. A CNN network with a fixed archi- tecture consisting of an alternating system of five classes Conv2D, MaxPooling2D and Dropout was built, for which a computational algorithm was developed in the Python 3.9 programming language. The algorithm proposed in the study explained with code, enables a smooth change of class and smooth and random change of the number of images copied to training, validation and test catalogues, which greatly facilitates data analysis. It was determined that the accuracy of the learning process for the proposed model was 94.53%, validation accuracy 87.14%, whereas the classification of carrot root photographs was realized at the accuracy of 89.06%, meaning that 50 photographs were erroneously classified. The highest number of 21 erroneously classified photographs were from the extra class, of which 15 to the first class, thus not resulting in significant loss. However, assuming the number of refuse as the classification basis, the model accuracy greatly increases to 98.69%, as only 6 photographs were erroneously assigned. The conclusion could be the statement that classification of such geometrically complex shapes as carrot root, is a complex process requiring the development of 3D models that take into account the variability of diameters along the root’s axis. A 3D model could also analyse cross sections and the shift in the centre of gravity of the cross section against the axis, which could enable identification of deformed roots with morphological defects. References Abdulridha. J., Ampatzidis, Y., Sri Charan, K. & Pamela, R. 2020. Detection of target spot and bacterial spot diseases in tomato using UAV-based and benchtop-based hyperspectral imaging techniques. Precision Agriculture 21: 955–978. https://doi.org/10.1007/ s11119-019-09703-4 Arunnehru, J., Chamundeeswari, G. & Prasanna Bharathi, S. 2018. Human Action Recognition using 3D Convolutional Neural Networks with 3D Motion Cuboids in Surveillance Videos. Procedia Computer Science 133: 471–477. https://doi.org/10.1016/j. procs.2018.07.059 Bachute, M.R. & Subhedar, J.M. 2021. Autonomous Driving Architectures: Insights of Machine Learning and Deep Learning Algo- rithms. Machine Learning with Applications 6: 100164. https://doi.org/10.1016/j.mlwa.2021.100164 Batchelor, M.M. & Searcy, S.W. 1989. Computer vision determination of the stem/root joint on processing carrots. Journal of Ag- ricultural Engineering Research 43: 259–269. https://doi.org/10.1016/S0021-8634(89)80023-X Brainard, S.H., Bustamante, J.A., Dawson, J.C., Spalding, E.P. & Goldman, I.L. 2021. A Digital Image-Based Phenotyping Platform for Analyzing Root Shape Attributes in Carrot. Frontiers Plant Sciences 12: 690031. https://doi.org/10.3389/fpls.2021.690031 Cappelli, A., Parretti, C., Cini, E. & Citti, P. 2019. Development of a new washing machine in olive oil extraction plant: A first ap- plication of usability-based approach. Journal of Agricultural Engineering 50: 134–142. https://doi.org/10.4081/jae.2019.949 Coulibaly, S., Kamsu-Foguem, B., Kamissoko, D. & Traore, D. 2022. Deep learning for precision agriculture: A bibliometric analysis. Intelligent Systems with Applications 16: 200102. https://doi.org/10.1016/j.iswa.2022.200102 P. Rybacki et al. 53 Deng, L., Du, H. & Han, Z. 2017. A Carrot Sorting System Using Machine Vision Technique. Applied Engineering in Agriculture 33: 149–156. https://doi.org/10.13031/aea.11549 Deng, L., Li, J. & Han, Z. 2021. Online defect detection and automatic grading of carrots using computer vision combined with deep learning methods. LWT 149: 111832. https://doi.org/10.1016/j.lwt.2021.111832 Esteva, A., Kuprel, B., Novoa, R., Ko, J., Swetter, S.M., Blau, H.M. & Thtun, S. 2017. Dermatologist-level classification of skin can- cer with deep neural networks. Nature 542: 115–118. https://doi.org/10.1038/nature21056 Franco, M.O.K., Suarez, W.T., dos Santos, V.B. & Resque, I.S. 2021. A novel digital image method for determination of reducing sugars in aged and non-aged cachaças employing a smartphone. Food Chemistry 338: 127800. https://doi.org/10.1016/j.food- chem.2020.127800 Gkillas, A., Kosmopoulos, D. & Berberidis, K. 2023. Cost-efficient coupled learning methods for recovering near-infrared informa- tion from RGB signals: Application in precision agriculture. Computers and Electronics in Agriculture 209: 107833. https://doi. org/10.1016/j.compag.2023.107833 Grinblat, G.L., Uzal, L.C., Larese, M.G. & Granitto, P.M. 2016. Deep learning for plant identification using vein morphological pat- terns. Computers and Electronics in Agriculture 127: 418–424. https://doi.org/10.1016/j.compag.2016.07.003 Hadipour-Rokni, R., Asli-Ardeh, E.A., Jahanbakhshi, A., Paeen-Afrakoti, I.E. & Sabzi, S. 2023. Intelligent detection of citrus fruit pests using machine vision system and convolutional neural network through transfer learning technique. Computers in Biology and Medicine 155: 106611. https://doi.org/10.1016/j.compbiomed.2023.106611 Hahn, F. & Sanchez, S. 2000. Carrot volume evaluation using imaging algorithms. Journal of Agricultural Engineering Research 75: 243e249. https://doi.org/10.1006/jaer.1999.0466 Howard, A.G., Zhu, M., Chen, B., Kalenichenko, D., Wang, W., Weyand, T., Andreetto M. & Adam, H. 2017. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861. Howarth, M.S. 1990. Reflectance characteristics of fresh-market carrots. Transactions of the ASAE 33: 961e964. https://doi. org/10.13031/2013.31424 Howarth, M.S. & Searcy, S.W. 1991. Fresh market carrot inspection by machine vision. Optics in Agriculture 141e150. Howarth, M.S., Brandon, J.R., Searcy, S.W. & Kehtarnavaz, N. 1992. Estimation of tip shape for carrot classification by machine vi- sion. Journal of Agricultural Engineering Research 53: 123e139. https://doi.org/10.1016/0021-8634(92)80078-7 Jahanbakhshi, A. & Kheiralipour, K. 2020. Evaluation of image processing technique and discriminant analysis methods in post- harvest processing of carrot fruit. Food Sciences and Nutrition 8: 3346-3352. https://doi.org/10.1002/fsn3.1614 Jermyn, M., Mok, K., Mercier, J., Desroches, J., Pichette, J., Saint-Arnaud, K., Bernstein, L., Guiot, M.C., Petrecca, K. & Leblond, F. 2015. Intraoperative brain cancer detection with Raman spectroscopy in humans. Science Translational Medicine 7: 274ra19. https://doi.org/10.1126/scitranslmed.aaa2384 Kaya, Y. & Gürsoy, E. 2023. A novel multi-head CNN design to identify plant diseases using the fusion of RGB images. Ecological Informatics 75: 101998. https://doi.org/10.1016/j.ecoinf.2023.101998 Lazar, D.A., Bıyık, E., Sadigh, D. & Pedarsani, R. 2021. Learning how to dynamically route autonomous vehicles on shared roads. Transportation Research Part C: Emerging Technologies 130: 103258. https://doi.org/10.1016/j.trc.2021.103258 Lemley, J., Bazrafkan, S. & Corcoran, P. 2017. Deep Learning for Consumer Devices and Services: Pushing the limits for machine learning, artificial intelligence and computer vision. IEEE Consumer Electronics. Magazine 6: 48–56. https://doi.org/10.1109/ MCE.2016.2640698 Levine, S., Pastor, P., Krizhevsky, A., Ibarz, J. & Quillen, D. 2016. Learning Hand-Eye Coordination for Robotic Grasping with Deep Learning and Large-Scale Data Collection. The International Journal of Robotics Research 37: 421–436. https://doi. org/10.1177/0278364917710318 Liang, J. 2020. Image classification based on RESNET. Journal of Physics: Conference Series 1634: 012110. https://doi. org/10.1088/1742-6596/1634/1/012110 Madridano, Á., Al-Kaff, A., Martín, D. & de la Escalera, A. 2021. Trajectory planning for multi-robot systems: Methods and appli- cations. Expert Systems with Applications 173: 114660. https://doi.org/10.1016/j.eswa.2021.114660 Momeny, M., Neshat, A.A., Jahanbakhshi, A., Mahmoudi, M., Ampatzidis, Y. & Radeva, P. 2023. Grading and fraud detection of saffron via learning-to-augment incorporated Inception-v4 CNN. Food Control 147: 109554. https://doi.org/10.1016/j.food- cont.2022.109554 Ni, J., Li, J., Deng, L. & Han, Z. 2020. Intelligent detection of appearance quality of carrot grade using knowledge distillation. Trans- actions of the CSAE 36: 181e187. Osuch, A., Przygodziński, P., Rybacki, P., Osuch, E., Kowalik, I., Piechnik, L., Przygodziński, A. & Herkowiak, M. 2020. Analysis of the Effectiveness of Shielded Band Spraying in Weed Control in Field Crops. Special Issue: Integrated Weed Management Approaches and Decision Support Systems, Agronomy 10: 475. https://doi.org/10.3390/agronomy10040475 Raghu, S. & Sriraam, N. 2018. Classification of focal and non-focal EEG signals using neighborhood component analysis and ma- chine learning algorithms. Expert Systems with Applications 113: 18–32. https://doi.org/10.1016/j.eswa.2018.06.031 Raptis, E.K., Englezos, K., Kypris, O., Krestenitis, M., Kapoutsis, A.C., Ioannidis, K., Vrochidis, S. & Kosmatopoulos, E.B. 2023. CoF- ly: An automated, AI-based open-source platform for UAV precision agriculture applications. SoftwareX 23: 101414. https://doi. org/10.1016/j.softx.2023.101414 Rinne, M., Franco, M., Jalava, T., Järvenpää, E., Kahala, M., Blasco, L., Siljander-Rasi, H. & Kuoppala, K. 2019. Carrot by-product fermentation quality and aerobic spoilage could be modified with silage additives. Agricultural and Food Science 28: 59-69. https://doi.org/10.23986/afsci.79829 Agricultural and Food Science (2024) 33: 40–54 54 Rybacki, P., Niemann, J., Bahcevandziev, K. & Durczak, K. 2023. Convolutional neural network model for variety classification and seed quality assessment of winter rapeseed. Sensors 23: 2486. https://doi.org/10.3390/s23052486 Rybacki, P., Przygodziński, P., Blecharczyk, A., Kowalik, I., Osuch, A. & Osuch, E. 2022. Strip spraying technology for precise herbi- cide application in carrot fields. Open Chemistry 20: 287–296. https://doi.org/10.1515/chem-2022-0135 Rybacki, P., Przygodziński, P., Osuch, A., Blecharczyk, A., Walkowiak, R., Osuch, E. & Kowalik, I. 2021. The Technology of Precise Application of Herbicides in Onion Field Cultivation. Agriculture 11: 577. https://doi.org/10.3390/agriculture11070577 Standards for fresh fruit and vegetables. Commission Regulation (EC) No 46/2003 of 10 January 2003 amending the marketing standards for fresh fruit and vegetables as regards mixes of different types of fresh fruit and vegetables in the same sales pack- age, https://lexparency.org/eu/32003R0046 (accessed 10 July 2023) Sanaeifar, A., Guindo, M.L., Bakhshipour, A., Fazayeli, H., Li, X. & Yang, C. 2023. Advancing precision agriculture: The potential of deep learning for cereal plant head detection. Computers and Electronics in Agriculture 209: 107875. https://doi.org/10.1016/j. compag.2023.107875 Singh, V., Chug, A. & Singh, A.P. 2023. Classification of Beans Leaf Diseases using Fine Tuned CNN Model. Procedia Computer Sci- ence 218: 348–356. https://doi.org/10.1016/j.procs.2023.01.017 Sun, D., Robbins, K., Morales, N., Shu, Q. & Cen, H. 2022. Advances in optical phenotyping of cereal crops. Trends in Plant Science 27: 191-208. https://doi.org/10.1016/j.tplants.2021.07.015 Szczepańska, J., Barba, F.J., Skąpska, S. & Marszałek, K. 2020. High pressure processing of carrot juice: Effect of static and mul- ti-pulsed pressure on the polyphenolic profile, oxidoreductases activity and color. Food Chemistry 307: 125549. https://doi. org/10.1016/j.foodchem.2019.125549 Torres, J.M.M., Medina-DeVilliers, S., Clarkson, T., Lerner, M.D. & Riccardi, G. 2023. Evaluation of interpretability for deep learn- ing algorithms in EEG emotion recognition: A case study in autism. Artificial Intelligence in Medicine 143: 102545. https://doi. org/10.1016/j.artmed.2023.102545 Xie, W., Wang, F. & Yang, D. 2019a. Research on Carrot Grading Based on Machine Vision Feature Parameters. IFAC PapersOnLine 52: 30–35. https://doi.org/10.1016/j.ifacol.2019.12.485 Xie, W., Wang, F. & Yang, D. 2019b. Research on Carrot Surface Defect Detection Methods Based on Machine Vision. IFAC Paper- sOnLine 52: 24–29. https://doi.org/10.1016/j.ifacol.2019.12.484 Xie, W., Wei, S., Zheng, Z. & Yang, D. 2021. A CNN-based lightweight ensemble model for detecting defective carrots. Biosystems Engineering 208: 287–299. https://doi.org/10.1016/j.biosystemseng.2021.06.008 Xie, W., Wei, S. & Yang, D. 2023. Morphological measurement for carrot based on three-dimensional reconstruction with a ToF sensor. Postharvest Biology and Technology 197: 112216. https://doi.org/10.1016/j.postharvbio.2022.112216 Yu, M., Ma, X. & Guan, H. 2023. Recognition method of soybean leaf diseases using residual neural network based on transfer learning. Ecological Informatics 76: 102096. https://doi.org/10.1016/j.ecoinf.2023.102096 Zhang, X., Zhou, X., Lin, M. & Sun, J. 2018. Shufflenet: An extremely efficient convolutional neural network for mobile devices. In: Proceedings of the IEEE conference on computer vision and pattern recognition, Salt Lake City, UT, USA, 2018. p. 6848-6856: 01083. https://doi.org/10.1109/CVPR.2018.00716 Zheng, N., Yao, Z., Tao, S., Almadhor, A., Alqahtani, M.S., Ghoniem, R.M., Zhao, H. & Li, S. 2023. Application of nanotechnology in breast cancer screening under obstetrics and gynecology through the use of CNN and ANFIS. Environmental Research 234: 116414. https://doi.org/10.1016/j.envres.2023.116414 Zhu, H., Deng, L., Wang, D., Gao, J., Ni, J. & Han, Z. 2019. Identifying carrot appearance quality by transfer learning. Journal of Food Process Engineering 42: e13187. https://doi.org/10.1111/jfpe.13187 Zhu, H., Yang, L., Sun, Y. & Han, Z. 2021a. Identifying carrot appearance quality by an improved dense CapNet. Journal of Food Process Engineering 44: e13586. https://doi.org/10.1111/jfpe.13586 Zhu, H., Yang, L., Fei, J., Zhao, L. & Han, Z. 2021b. Recognition of carrot appearance quality based on deep feature and support vector machine. Computers and Electronics in Agriculture 186: 106185. https://doi.org/10.1016/j.compag.2021.106185 Convolutional neural network model for the qualitativeevaluation of geometric shape of carrot root Introduction Purpose, material and study methodology Definition of carrot root classification criteria Preparation of the data set Image preprocessing Software Loading and preliminary processing of the data set Architecture of the multi-layer CNN Analysis results Discussion Conclusions References