Teachable Machine: Optimization of Herbal Plant Image Classification Based on Epoch Value, Batch Size and Learning Rate

Herbal plants are a source of natural materials used in alternative medicine and traditional therapies to maintain health. The purpose of this research is to develop an intelligent system application that is able to assist people in independently detecting herbal plants around them, provide education, and most importantly, find the optimal value based on certain parameters. This research uses several values for the parameters studied, namely the epoch value which varies between 10, 50, 100, 250, 750, and 1000; the batch size value which varies between 16, 32, 64, 128, 256, and 512; and the learning rate value which varies between 0.00001, 0.0001, 0.001, 0.01, 0.1, and 1. A total of 10,000 training data samples (1,000 samples in 10 classes) were used in Teachable Machine. The method used is to utilize the TensorFlow framework in the Teachable Machine service to train image data. This framework provides convolutional neural networks (CNN) algorithms that can perform image classification with a high degree of accuracy. The test results for more than three months showed that the highest optimal value was achieved at the 50th epoch value, with a learning rate of 0.00001, and a batch size of 32, which resulted in an accuracy rate between 98% and 100%. Based on these results, a mobile web-based intelligent system application service was developed using the TensorFlow framework in Teachable Machine. This application is expected to be widely implemented for the benefit of the community. However, the challenges and limitations in training this test data are the large number of data classes that will be very good so that machine learning can learn to recognize objects but will take hours to train, then the training image object data has a clean background from other objects so that when tested it is not detected and influenced as another object or can result in a decrease in the percentage value.


Introduction
Digital image detection classification technology with CNN has become the gold standard in the field of pattern recognition and image processing [1] , [2].CNN is a type of artificial neural network specifically designed to recognize visual patterns in image data.[3], [4].The CNN structure allows the network to automatically and adaptively learn hierarchical spatial features from image data [5].This is done through the use of convolutional layers, where each neuron receives input from a subset of neurons in the previous layer, rather than all neurons as in a regular artificial neural network [6], [7].With the ability to learn from large amounts of data and extract important features from images [8], [9], CNNs have opened up new opportunities in the field of digital image detection and classification, where these algorithms are able to learn important features from images and use these features to classify objects [10].
In other research, herbal plants have been studied by previous researchers with various case studies, such as the classification of herbal plants according to the type of disease identified through the texture, shape and color of herbal plant diseases [11].Identification of herbal medicinal plant names, scientific names and remedies on leaf objects [12], [13], so that the identification of herbal plants is able to increase the accuracy of herbal plant recognition with CNN well which is able to achieve a recognition rate above 95% near perfect depending on the quality of the object and other approaches [14], [15], because some herbal plants have a surpa level of similarity such as turmeric and ginger, so a good classification technique approach is needed such as CNN and other algorithms [16].
ISSN 2723-6471 533 In the following study, researchers took the topic of classification detection of several herbal plant image objects in Indonesia.Indonesia is known for its rich biodiversity, including various types of herbal plants [17], [18], [19].These plants have been used for centuries in traditional medicine and many of them are now being researched for potential human health benefits [20], [21], [22], [23].Some examples of herbs popular in Indonesia include Turmeric, Ginger, and Temulawak, all of which are known to have anti-inflammatory and antioxidant properties [24], [25].In addition, plants such as Sambiloto and Gotu Kola are also used in traditional medicine for various health conditions [26], [27], [28], [29].
Teachable Machine is a platform that allows researchers to train their own machine learning models without the need to write code [30], [31], [32], that can produce accuracy up to 90% to 100% [33], [34], [35].In the context of herbal plant image detection, this can be very useful.For example, users can collect images of different types of herbal plants and use Teachable Machine to train a model that can recognize and classify these plants based on images of these objects.This process can be optimized by adjusting parameters such as the number of epochs (iterations through the entire dataset), batch size (the number of samples processed before the model is updated), and learning rate (how fast the model learns) [36], [37], [38], [39], [40].Furthermore, this model can be integrated into a mobile web application, allowing users to identify herbs by simply taking an image of the object.
The results of this process can vary greatly depending on the quality of the data and the number of datasets used to train the model and the parameters chosen for optimization [41], [42].However, with a large enough dataset and proper parameter adjustments, it is possible to achieve a high level of accuracy [43], [44], [45] in the classification of herbal plants.This can open up new opportunities in the field of herbal medicine, allowing practitioners and researchers to easily and quickly identify plants and utilize their health benefits.In addition, the integration of this model into mobile web applications can make this technology more accessible to the general public, facilitating the spread of knowledge about herbal plants and their potential health benefits.

Methods and Algorithms
The following discussion will outline the meaning of the methods and algorithms used in this research, starting from the explanation of transfer learning, Teachable Machine, CNN, Tensorflow.js and the three main measures in machine learning optimization, namely epoch, learning rate and batch size as follows.

Transfer Learning and Tensorflow.js
Transfer learning is a technique in machine learning where knowledge learned from a task is reused to improve performance on a related task.For example, in image classification, knowledge gained when learning to recognize cars can be applied when trying to recognize trucks [46].Transfer learning is used in the Teachable Machine service where this technique utilizes knowledge from previously trained models, eliminating the need to start from scratch.With this technique, the user needs fewer examples of new items to classify, saving time and resources.The training process is usually faster as it only needs to train the last few layers of the model architecture instead of the entire network.This technique is particularly suitable for web browser environments, where resources may vary by device, but also have direct access to sensors for easy data acquisition [47].The transfer learning formula is as follows: Where, Y is the output of a pre-trained model, X the input of a pre-trained model, W the parameters of a pre-trained model, and f a function that connects the input and output of a pre-trained model.
In the transfer learning used by Teachable Machine, there is the Tensorflow.jslibrary, where TensorFlow.js is an opensource machine learning library that can be used anywhere JavaScript can be used.It is based on the original TensorFlow library written in Python, and aims to provide developers with the same experience and a set of APIs that are compatible with the JavaScript ecosystem [48].
TensorFlow.js supports various execution environments, including CPU, GPU, and WebGL.This ensures compatibility and optimal performance.Currently, TensorFlow.js supports: 1) CPU: for efficient performance on mobile and desktop devices Vol.

.2. Teachable Machine
Teachable Machine is a web-based tool that makes it easy to build machine learning models, making it fast and accessible to everyone, including educators, artists, students, innovators, and developers of all kinds.Teachable Machine is designed in such a way that it requires no prior knowledge of machine learning.With Teachable Machine, users can train computers to recognize images, sounds, and poses without the need to write complex machine learning code.Once the model is trained, users can use it in various projects, websites, apps, and more [49].The following is the TM display, which can be seen in figure 1, and the image recognition process stage can be seen in figure 2.

Convolutional Neural Networks
Google Teachable Machine, powered by convolutional neural networks, provides an easy-to-use yet extremely powerful tool for object classification tasks [50].CNN consists of several specialized display layers namely convulution layers, pooling layers and fully connected, the architecture can be seen as follows in figure 3. Convolution layers are a Generalized Linear Model (GLM) for an image [51], The purpose of the convolution layer is to transform the raw input image into a more meaningful representation that is easily understood by the network, and there are also two important components in convolution layers: strides, which is a parameter that determines how far the filter moves on the image, and padding, an operation that increases the size of the input data.The convolution layer uses filters that perform convolution operations while scanning the input I with respect to its dimensions.Hyperparameters include filter size F and stride S. The resulting output O is called a feature map or activation map.[52].The convolution layers can be seen in figure 4. Pooling layers aims to reduce the resolution of image features while retaining important spatial information [53], as well as preventing overfitting which occurs when the model learns too much detail on the training data and its performance degrades on the test data [54].As for the pooling layer, there are two main components: max pooling which aims to take the neuron that has the highest activation value in the local receptive field (grid cell), and average pooling which will produce output by taking the average value of all activations in each receptive field.The Max pooling and average pooling can be seen in figure 5. Fully connected is at the end of the CNN architecture which functions as the final classification of each network of previously interconnected neurons [56], so the purpose of the Fully connected layer is to transform the raw image input into a more meaningful representation that is easily understood by the network.The Fully connected layers can be seen in figure 6.The classic CNN is still used today by many researchers because the accuracy of image recognition can be very accurate depending on several influencing factors.However, the development of object classification models has emerged with various advantages and efficiencies that need to be tested to be able to distinguish various new algorithms such as VGGNet, ResNet, GoogleNet, and AlexNet.2) GoogleNet or Inception, is an Inception module that allows the use of deeper and wider networks without overfitting.3) VGGNet, with its simple architecture, uses only a very small 3x3 convolution kernel but has many layers.4) ResNet, is a very deep network with more than 100 layers and uses "Skip connections" and "batch normalization" which helps train deep layers without hampering performance.These four algorithms have made significant contributions in the field of Deep Learning.

Epoch, Learning Rate and Batch Size
In deep learning, there are three parameters that are important in measuring the training dataset: epoch, learning rate and batch size [57].The epoch value in the context of Teachable Machine, one epoch means that the model has processed all the samples in the training dataset and updated the parameters based on the calculated loss.In the context of Teachable Machine, Learning Rate governs how often the neural network updates the learned knowledge.In the context of Teachable Machine, Batch Size controls the number of training samples that must be processed before the internal parameters of the model are updated [58].It is important to find the detection optimization level in Teachable Machine to get an effective training dataset from the three parameters [59].
The epoch value in Teachabel Machine ranges from 1 to infinity, but it should be noted that the larger the number of epoch values, the more overfitting the model will be, i.e., the training model becomes too specific to the training data and its performance will degrade on new data.In general, a larger number of epochs will cause the machine learning model to learn more accurately, but take longer.A smaller number of epochs will cause the machine learning model to learn faster, but less accurately.Therefore, it is important to experiment with various number of epochs to find the right value for the machine learning model.
While the batch size value in Teachabel Machine ranges from 16; 32; 64; 128; 256 and 512, the selection of batch size will affect the training time, time per epoch, and model quality, so it is necessary to experiment with various batch sizes to find the best size.Batch size is also the number of data samples used for one iteration of machine learning model training.A smaller batch size will cause the machine learning model to learn more accurately, but it may also cause the machine learning model to take longer to train.
Then for the learning rate is not determined exactly but can start at size 1 (largest) to 0.00001 (smallest), the smaller the learning rate value, the slower it learns to process training data, but prevents overfitting.Therefore, a good learning rate value for CNN Teachable Machine is around 0.0001 to 0.00001, which is recommended.
To prove the use of the three parameter values above (epoch, batch size and learning rate) researchers have summarized from various sources for the minimum and maximum values used in object detection testing, but cannot be separated from the influence of image quality, the number of datasets and algorithms used.For epoch values ranging from 10; 50; 100; 250; 750 and 1000 epochs that have been done by previous researchers [60], [61], [62], then for batch sizes of 16; 32; 64; 128; 256 and 512 available on Teachable Machine, these values are the minimum and maximum values that are already available without the need for modification.Then, for the learning rate value based on the average of previous research ranges from 0.00001; 0.0001; 0.001; 0.01; 0.1 and 1 [63], [64], [65].
The three parameters above (epoch, batch size and learning rate) that have been explained, of course, the percentage and level of accuracy will affect the number of training datasets provided and trained, of course, then the image quality and the algorithm used to test the training data will also affect.So that through this research, exploratory testing will be carried out directly to find out the percentage results obtained through measurements and sample data provided and tested on the Teachable Machine site.
Epoch, learning rate, and batch size are important parameters in training machine learning models.Epoch is the number of times the entire dataset is skipped by the machine learning algorithm.Learning rate is a measure of how much change is made to the variables in each iteration.Batch size is the number of training samples used in one iteration.Determining the values for these three parameters is usually done through a trial-and-error process, with initial values either determined based on previous research or using Teachable  may want to increase the learning rate or change the batch size.However, keep in mind that any changes to these parameters can affect the performance of the model, so changes should be made with caution.

Methodology
This research uses an experimental method to test the effect of epoch value, learning rate, and batch size on the accuracy of herbal plant image classification.Image data of herbal plants is obtained from various sources, both from the internet and from the researcher's personal collection.The image data is then cleaned and grouped based on the type of herbal plant.Herbal plant data owned by the author is taken on internet sites, after the image is taken the researcher modifies the position change and rotates the image so that it has a different shape, this method is done because of limited data and variations in image models to be trained.
The herbal plant image classification process is carried out using

Result and Discussion
Here is the table of testing results to find the most optimal and ideal values from the herbal plant datasets manually tested, identifying the best percentage from the sample data and the amount of training data in the Teachable Machine service.In the optimization value testing for the classification of herbal plant images using TM, a total of 216 data Vol.In selecting the best accuracy values, the researchers considered the values in the "Outside Test Class (%)" column and only used percentages below 100%.This approach was taken to maintain classification accuracy and avoid errors when the herbal plant detection program is tested with data not included in the training data.Thus, the program can detect that the data is not part of the original training data, and its accuracy is not perfect despite similarities.The best accuracy level selection testing results on teachable machine can be seen in table 2. With reference to the tabulated results, the search for the most optimal or ideal values of the three test parameters (epoch, batch size, and learning rate) has resulted in some analysis of the conclusions of the tests using Teachable Machine with 1,000 image samples per class (10 classes).The test results show an optimal and good object recognition rate ranking, which can be presented in the following table based on the percentage of the smallest "Outside Test Class" value, which is caused by a decrease in the recognition value of foreign image objects that are not included in the test category (such as: turmeric, ginger, moringa leaves, aloe vera, basil leaves, mint leaves, chamomile, rosemary, coriander leaves, and sambiloto leaves).However, this analysis is also affected by the accuracy of the original test data level of the herbal plant objects tested, known as the "Original Test Class".The higher the percentage value in the "Original Test Class" category, the better the results.The following 20 best test results are taken and have been analyzed based on their accuracy in the following table 3. So, after analyzing the ability and reliability of the Teachable Machine service in this study, a conclusion can be drawn from the results of research conducted in three months to find the most optimal value to be used and developed into an intelligent system application for detecting herbal plants based on mobile web as follows: 1) Based on the results of research tabulation in Teachable Machine manually, the optimal and ideal epoch value for herbal plant image classification is at the 50th epoch value with a learning rate of 0.00001 and batch size value is 32, (See table 3).2) The higher the epoch value, the better the accuracy value, but too many epoch values can cause overfitting, where the model learns the training data very well but fails to generalize well to new data in the Teachable Machine.
Evidently at the 1,000th epoch, new test data that is outside the object in training can be detected up to 100% (for example: orange leaves are detected as marungga leaves).
3) The worst values tested for the learning rate were 0.01, 0.1, and 1.This is due to the learning process being too fast, which results in the model's lack of ability to recognize the trained images, and often results in 100% accuracy (overfitting), due to the image recognition being too specific and unstable, so the model is unable to recognize images that are not included in the herbal plant image object dataset in Teachable Machine.On the other hand, the best learning rate values are in the range of 0.0001 and 0.00001.These values provide enough time for the model to learn and recognize the patterns in the training data, so the results are more stable and able to recognize images better.4) Improvement in classification accuracy also occurs as the learning rate value decreases.This is because a smaller learning rate value will cause the classification model to adjust more subtly and optimally.Conversely, the larger the learning rate, the worse the accuracy results and the unstable the training process.5) The increase in classification accuracy also occurs as the batch size value increases.This is because a larger batch size value will cause the classification model to learn patterns from image data more efficiently but it takes a long time to achieve optimal accuracy.The most optimal batch size in this study is on average at batch size 32, (See table 3).Vol.
6) Detection results also affect the amount and quality of training data, the more and better-quality datasets the better the model learns patterns and features, and increases the model's ability to make accurate predictions on new data.In this study, the number of samples per class used is 1,000 samples per class where there are 10 image classes.7) The similarity of the new test image object also affects the resulting percentage value, so that similar images are sometimes detected as the name of one of the images contained in the Teachable Machine database.8) A very large amount of data and with a large increase in the number of epochs, will affect the training time to take hours.In this study, a total of 10 image categories (turmeric, ginger, moringa leaves, aloe vera, basil leaves, mint leaves, chamomile, rosemary, coriander leaves and sambiloto leaves) are training samples with a total of 1,000 samples per class, and if the total reaches 10,000 image data, which takes around 8 hours to 9 hours for each change in learning rate per-epoch and batch size.
From the summary and testing on the Teachable Machine site, related studies can adjust to the case study along with the amount and quality of image data owned, so that the test results to find the optimal value in this study become a reference, but back again to other studies that will certainly have different values depending on the amount and quality of image data owned.
After the test results are obtained, the researcher automatically determines the epoch value of 50, batch size 32 and learning rate 0.00001 then the researcher exports directly on the "Export Model" menu available on the Teachable Machine site into a file or javascript programming language (Tensorflow.js)to be developed into a mobile webbased application and designs the visual form of the application for easy use.And the test results are as expected ranging from 98% to 100% of the direct detection test results.Figure 8 below illustrates implementation in mobile web.

Figure 8. Implementation in mobile web
In figure 8, users can directly use the application then users can direct the application to the plants found or plants that want to be identified either in real-time or upload images manually from storage media.Then the system will automatically display the name of the plant type, accuracy and also the benefits of information from these herbal plants when detected and identified.Thus, the developed service is able to provide recommendations, good and accurate education and also become a reference service in the health sector, because all sources of information are obtained on credible health sites such as Halodoc and the website of the Ministry of Health (KEMENKES) of the Republic of Indonesia.

Conclusion
In this research that has been carried out for three months to find the most optimal value in image classification using the Teachable Machine service by testing epoch values ranging from 10; 50; 100; 250; 750 and 1000, then batch size

Figure 6 .
Figure 6.Fully connected[52] Testing is also done by dividing the image data into two parts, namely training data and testing data.Training data is used to train the model, while testing data is used to evaluate the model.The test data used is in the form of herbal plant image data taken from the internet as many as 10 types of herbal plants (turmeric, ginger, moringa leaves, aloe vera, basil leaves, mint leaves, chamomile, rosemary, coriander leaves and sambiloto leaves) as experimental samples in this study (although there are still many other herbal plants that can be explored again), where each type of herbal plant image there are 1,000 images per class as training data samples so that the total has 10,000 training data, and 15 images as validation/training data in Teachable Machine one by one.The data model set is shown in figure 7.

Figure 7 .
Figure 7.A collection of several types of herbal plants

Table 1 .
Teachable Machine software.The classification model used is a CNNs model.The epoch value, learning rate, and batch size tested are as follows: Testing parameters with epoch value, learning rate and batch size From table 1 above, 216 tests were obtained to test the accuracy of the percentage value of the image recognition rate.

Table 2 .
The results of the best accuracy level selection testing on Teachable Machine

Table 3 .
Best test level based on Outside Test Class and Original Test Class on Teachable Machine