Page 88 - IJAMD-2-2
P. 88

International Journal of AI for
            Materials and Design                                                        Fruit image detection using AI


            positive instances. It indicated how many actual positive   the inclined plane, images were captured by a camera for
            observations were correctly identified among all the true   classification according to their classes, as implemented
            positives, thereby showing the model’s effectiveness in   by the SVM model. The camera used was an ESP32-cam
            capturing relevant cases, as shown in Equation VI. 43  (Espressif Systems, China), controlled by the Arduino
                                                               Uno R3 (Microchip, United States), with the entire setup
                        TP
               Recall =                                (VI)    powered by a 9 V battery. The captured images were
                      TP  +  FN                                transmitted to the processing unit for classification using
            (iv)  Model F1 score                               the trained SVM model.
              The F1 score is the harmonic mean of precision and   Based on the classification results, the Arduino board
            recall, providing a balanced metric that considers both   (Arduino, Italy) sent commands to  three servo motors
            aspects. It was particularly useful for evaluating model   (MG996r, TowerPro, China). These motors controlled
            performance on imbalanced datasets, as it offered a   a mechanical arm responsible for guiding the fruits into
            better overview than individual metrics. The F1 score was   different containers. Once the fruits reached the end of the
            calculated using Equation VII. 44                  inclined plane, the servo motors activated the mechanical
                                                               arms to direct the fruits into their respective containers.
                                   ×
                       2          2  (Precision  Recall)
                                             ×
            F1 =                =                     (VII)    Collection containers were placed at the base of the
                   1        1      (Precision   Recall)        inclined plane to collect the sorted fruits.
                Precision  Recall                                In this project, an efficient and accurate automated
              In such a structured approach, the performance metrics   sorting mechanism was developed. Figure 2A shows the
            of different kernels were compared directly to identify the   conceptual drawing of the mechanism, Figure 2B shows
            most effective kernel for fruit classification.    the side view, and Figure 2C shows the front view of the
                                                               mechanism, clearly depicting the system components
            2.4. Model Optimization                            and their arrangement.  Figure  3 displays the complete
            It was essential to optimize a model for its performance   experimental setup for the system, while Figure 4 illustrates
            and accuracy toward fruit classification. The techniques   the overall framework for the automated fruit sorting
            applied in model development were also used to tune the   process.
            model, with a focus on the regularization parameter (C).  This  setup  incorporated  an  automated  sorting
              The  C value controlled the  trade-off between   mechanism integrated into the Arduino board, which
            minimizing training error and testing error.       controlled the classification results from the SVM model
                                                               and ensured efficient and accurate sorting of fruits into
            (i)  Impact of the value of C: A  lower C value applied   their respective containers. The system was specifically
               stronger regularization by shrinking the coefficients   designed to handle the fruits with the least damage, thereby
               less aggressively, allowing a larger margin of error,   maintaining  the  quality of  the  fruits  during  the  sorting
               which may result in higher misclassification rates. On   process. All program codes that automated this system
               the  other  hand,  a  higher  C  value  reduced  the  error   were displayed in Programs S1–S6 (in Supplementary File).
               margin, thereby lowering misclassification rates.
            (ii)  Optimal C by cross-validation:  Cross-validation   3. Results and discussion
               was utilized to identify the optimal value of C. This
               involved testing various C values using the model to   3.1. Experimental results for model detection of
               determine which value achieved the best classification   fruit image features
               performance while avoiding overfitting.         Table 1 shows the results of the fruit classification system.
                                                               The  results  highlight key  differences  in  the  efficacy  of
            2.5. Automated image sorting mechanism             various features used in the image processing approach.
            The automated sorting mechanism played a crucial role   This  was  evident  in  the  performance  metrics,  including
            in the fruit classification system. It physically sorted the   accuracy, precision, recall, and F1 score, all of which
            classified fruits into their respective containers based on   demonstrated that feature selection significantly impacts
            the output classifications identified by the SVM model.   the overall results of classification.
            The system was designed to ensure efficient and accurate   One  of  the  important  metrics  is  accuracy,  which
            sorting of the fruits.                             represents the  proportion  of correct predictions  made
              The process began by placing fruits on a slanting   by the classifier. The accuracy obtained in this study was
            plane that acted as a conveyor. As the fruits rolled down   90% with combined features. The result demonstrates


            Volume 2 Issue 2 (2025)                         82                        doi: 10.36922/IJAMD025150011
   83   84   85   86   87   88   89   90   91   92   93