Microsoft Word - 2-V8N2(2023)-AITI#10926(100-110).docx Advances in Technology Innovation, vol. 8, no. 2, 2023, pp. 100-110 An Image-Based Rice Weighing Estimation Approach on Clock Type Weighing Scale Using Deep Learning and Geometric Transformations An Cong Tran*, Thanh Trinh Thi Kim, Hai Thanh Nguyen College of Information and Communication Technology, Can Tho University, Can Tho, Vietnam Received 30 September 2022; received in revised form 27 November 2022; accepted 28 November 2022 DOI: https://doi.org/10.46604/aiti.2023.10926 Abstract AI impacts surrounding human life, such as the economy, health, education, and agricultural production; however, the crop prices in the harvest season are still on manual calculation, which causes doubts about accuracy. In this study, an image-based approach is proposed to help farmers calculate rice prices more accurately. YOLOv5 is used to detect and extract the scales in the images taken from the harvesting of rice crops. Then, various image processing techniques, such as brightness balance, background removal, etc., are compiled to determine the needle position and number on the extracted scale. Lastly, geometric transformations are proposed to calculate the weight. A real dataset of 709 images is used for the experiment. The proposed method achieves good results in terms of mAP@0.5 at 0.995, mAP@[0.5:0.95] at 0.830 for scale detection, and MAE at 3.7 for weight calculation. Keywords: scale detection, scale value recognition, rice weighing, geometric transformations, deep learning 1. Introduction Many new technologies have been applied in agriculture to help increase productivity and quality. For example, machine learning algorithms have been proposed to identify diseases in animals [1-2] and plants [3]; develop post-harvest support technologies [4-5] to assist farmers; and protect data for internet business secrets [6]. Harvest season is an important time to collect the crops that are grown by farmers. In addition, farmers may want to estimate the weight and quantity of their products for sale activities. Vietnam has a highly developed agriculture, especially millions of tons of wet rice production every year†, and it continues to increase over the years [7]. Every year, farmers usually have to harvest 2-3 rice crops [8], and calculating the payment is an indispensable task in the production process. The calculation of rice prices is not too complicated, yet it still requires accuracy and speed. Therefore, farmers usually use applications to calculate the payment by entering the numbers manually. This helps farmers calculate the payment quicker and more accurately than the traditional method. However, since the calculation is observed by human eyes, errors may occur in manual calculation and the results may be incorrect. With the current trend of AI, some computer-based methods can be developed to read the weight from the scale. The application of image processing techniques and machine learning can help farmers calculate rice prices, meanwhile, correcting data entry and manual calculation errors. Although these methods are not complex, precise numbers and good efficiency are necessary for farmers’ benefit. The manual calculation is still problematic frequently because it is very time-consuming or leads to miscalculations; moreover, there are no images for further comparisons. This study aims to provide solutions for * Corresponding author. E-mail address: tcan@cit.ctu.edu.vn † Production volume of rice paddy in Vietnam from 2011 to 2021, https://www.statista.com/statistics/671339/production-of-paddy-in-vietnam/. Advances in Technology Innovation, vol. 8, no. 2, 2023, pp. 100-110 101 farmers to improve rice payment calculations and overcome some possible issues, including the reduction of calculation time and wrong calculations. When farmers or rice buyers enter a wrong result, they can use the captured images to check and correct the results. Although an electronic scale provides great accuracy, the price of electronic scales is often higher than clock-type weighing scales. An electronic scale has a tempered glass scale surface. There is a risk of scratches or breakage if the user is not careful or moves around a lot while weighing. In addition, farmers harvest and pack rice directly in the rice fields so that electronic scales with batteries may be damaged by contact with water or swampy. Mechanical scales such as clock scales usually have a longer life than electronic scales. Therefore, it would be appropriate to use a traditional clock scale directly in the rice fields. In this study, the information displayed on the scale is extracted from the images captured during harvest crops using object recognition and image processing techniques. The combination of several geometric transformations calculates the weight and amount of payment to support farmers and poses an AI solution to smart agriculture. The remainder of this paper is organized as follows. Section 2 provides a literature review related to solutions in smart agriculture. The system architecture and problem-solving methods are described in Section 3. Section 4 presents and describes experimental results and discussion. Finally, Section 5 shows a brief conclusion and future work. 2. Literature Review Machine learning techniques are widely used in applications that support agricultural activities. By providing useful applications and crop insights, machine learning techniques benefited farmers by minimizing agricultural losses [9-10]. Numerous applications were presented for crop management, crop yield prediction, plant disease detection, agricultural land use monitoring, water, and soil conditions [11]. Plenty of techniques based on information technology are applied to improve efficiency in agriculture, including sensor data processing from internet-of-thing systems, image processing using machine learning algorithms, etc. Among these areas, computer vision is perhaps the most interesting for scientists. Important image processing techniques include camera types, color spaces, color indices, and image segmentation related to agriculture applications and precision agriculture [12-13]. Chakraborty and Ghosh [14] proposed an automated plant disease diagnosis method in agriculture as well. Transformer-based architectures and data augmentation methods were employed to achieve a mean intersection over union (mIoU) of 0.582 in the Agriculture-Vision Challenge 2022 [15]. Animal farming also attracted numerous researchers with extensive studies [16], such as an investigation on Data, Applications for Smart Farming [17]; and research related to the behaviors of animals [18]. Tools for supporting agricultural activities have received attention from scientists. Weighing scales are a crucial tool for harvesting crops. The weight of the objects in free-living settings can be measured objectively and the weighing scales have experimented with 50 fruits and other everyday objects of various sizes and weights [19]. Some eating tools including spoons, forks, or chopsticks were considered to measure the weight of food in an image using several image processing techniques and the exchangeable image file (EXIF) metadata [20]. Telematics data was combined with machine learning to determine the weight of vehicles on a road segment [21]. Other interesting studies were presented and evaluated, i.e. methods for estimating the weight and volume of poultry and related products based on computer vision techniques [22]; seven models using single tomato image features data to calculate the weight and volume of single and hidden tomatoes [23]; and methods for predicting the body weight of animals [24]. Although several weight estimation techniques using images have been presented, studies on detecting clock scales to estimate the weight of an object are less. The application of deep learning algorithms in this field is still very rare as well. Therefore, a YOLO-based approach for object recognition combined with some geometric transformation methods is investigated to estimate the weight on a clock scale in this study. Advances in Technology Innovation, vol. 8, no. 2, 2023, pp. 100-110 102 3. Research Methods The position of the needle and its angle to the numbers on the scale to determine the weight can be observed by human eyes. However, human eyes cannot always be accurate. Therefore, in this study, image processing techniques and geometric transformations were used in three phases to perform the tasks sequentially as follows. Firstly, the area of the scale in the originally captured image was detected and extracted. This is crucial to eliminate unrelated objects and focus on determining important things inside the scale such as the needle’s positions and numbers in the scale. Some well-known deep learning architectures for object detection such as YOLOv5 can be trained to detect scale well [25]. Then, various image processing techniques were combined to indicate the position of the needle. The following tasks include cropping the scale from the original image; adjusting the image size and brightness balance; removing the background; determining the center, numbers, and hand of the scale; and computing the weight value. Finally, the image processing algorithms in the OpenCV library were used for these tasks, and the parameters for these algorithms were determined through careful experiments [26]. Moreover, based on the proposed method, an application for managing rice sales was also developed using the Django framework. 3.1. The weighing scale detection The training was performed with a set of 709 images taken during the rice harvest in Vietnam to identify the scale in the image. This set of images was used to train YOLOv5 for clock scale recognition, and it is labeled by the “Make Sense” library supported on the web platform. The returned result was that each labeled image had a corresponding label (.txt file) containing information about the contour of the object, where each line contained information about an object. Each line contains 5 values with information about the object and the contour coordinates including object name, center coordinate (x, y), width, and height. The contour coordinates must be normalized to the interval [0, 1] to converge faster in the training phase. The information and coordinates of the scale presented in Fig. 1(a) are shown respectively in Fig. 1(b) and Fig. 1(c). (a) An image in the dataset (b) The image’s label (c) The coordinates, width, and length of the scale Fig. 1 An original image in the dataset and its labels Advances in Technology Innovation, vol. 8, no. 2, 2023, pp. 100-110 103 After the training phase, a scale recognition model that was created can recognize the scale in an input image. Then, the image was cropped according to the coordinates provided by the recognition model, and an image consisting of only the scale was returned. Next, the image was processed to determine the value of the detected scale. This step includes several tasks as described in Fig. 2. The first task aims to extract and crop the area containing only the scale and then resize the image to 1000 × 1000 pixels. The next task was to adjust the brightness balance to reduce lighting effects or underexposure. Then, the background was removed, and only the rounded scale was kept. Subsequently, the center, needle, and numbers on the scale were identified. Several relevant mathematical operations were applied to confirm the angle measured by the three above-mentioned factors (center, needle, and numbers) for determining the weight. Fig. 2 Steps to calculate the weight from the cropped image 3.2. Cropping the image and adjusting the size The scale recognition model was used to recognize and return the position of the scale in the image. Then the image was cropped based on the x min, y min, x max, and y max values to obtain the image of the scale as shown in Fig. 3. After that, the image was resized to 1000 × 1000 pixels for further processing using OpenCV’s resizing algorithm. Fig. 3 The image cropping step 3.3. Brightness balancing The cropped images from the previous step were converted to grayscale images, and the grayscale histograms were computed. As shown in Fig. 4, the average values were calculated to balance the image brightness. The cvt-color() and calcHist() functions of the OpenCV library were combined to accomplish these tasks. Advances in Technology Innovation, vol. 8, no. 2, 2023, pp. 100-110 104 (a) Before (b) After Fig. 4 The scale before and after brightness balancing 3.4. Background removal When cropping the image according to the predicted contour of the scale recognition model, the received image mostly contains the background behind the scale. Unfortunately, the background is sometimes the factor that interferes with further determination, so it must be removed. The removal of the background can be retouched by smoothing the image with the Gaussian blur operation and then converting the color image to grayscale. Subsequently, the contours of the image were identified, and the largest contour was picked out and redrawn with green color. Then the color filtering algorithm was applied to keep only the green color. Next, the green objects were filtered by converting the image to the hue, saturation, and value (HSV) color space and selecting an appropriate color threshold to draw the contour. After that, the circle detection algorithm was used to detect the front surface of the scale. This algorithm returned the center point (xi, yi) and radius R of the detected circle. All circles with a center of (xi, yi) and a radius greater than R were drawn to remove all backgrounds outside the scale surface. Fig. 5(a) illustrates the scale with background, while such background is removed from the image as shown in Fig. 5(b). This process was implemented with several functions of the OpenCV library, including the findContour() function to find the contour of the scale, the inRange() function to perform threshold operations, and the houghCircles() function to detect the circle. (a) Before background removal (b) After background removal Fig. 5 The scale before and after the background removal step 3.5. Determining the center and the numbers on the scale The center point was determined from the background removal step, i.e., the center point returned from the step that determines the center point of the detected circle. If many circles are found, the largest circle, which has the maximum radius, will be taken into account; If no circle is found, the center of the largest contour will be used. Advances in Technology Innovation, vol. 8, no. 2, 2023, pp. 100-110 105 To identify the numerical values on the scale surface, firstly, only the black areas in the image will be preserved as the numbers are in black. The morphological operators closing and opening [27] were combined to remove the small black dots in the image, which are considered noise for this task. Secondly, the image was smoothed using the Gaussian blur algorithm to increase the accuracy of the latter tasks. After that, the contours that are potentially the scale values, and the center of the contours were determined as demonstrated in Fig. 6(a). Finally, the contour of the number at the middle-bottom of the scale was reserved as shown in Fig. 6(b). With the help of morphological operators, the small black areas that may represent the noise of this task were removed. Only the big numbers that represent the values of the scale and their centers were preserved. The above tasks were implemented based on the OpenCV library. The GaussianBlur() function was used to smooth the image; the getStructuringElement() function was used to create structured elements; the findContour() function was used to find the contours. (a) The potential scale values (b) The middle-bottom number and its center Fig. 6 The contours of the numbers and their centers detected in the scale 3.5. Determining the needle The needle determination step started by selecting a red threshold to filter out red objects and detecting edges in the filtered image in Fig. 7. The red objects were filtered by converting the image to the HSV color space and selecting the corresponding color threshold with the needle color. From the resulting red-filtered image, an edge detection algorithm was used to find the edge of the scale needle. The thresholding operations were performed using the inRange() function in the OpenCV library, and the Canny method [28] is used for edge detection. In determining the tip of the needle, there are two possible cases. In one case, a straight line representing the tip of the needle can be found in the image with the recognized edge of the needle. In the other case, the straight line is not found. Accordingly, the largest contour is calculated, and the center of the calculated contour is considered as the tip of the needle. After the numbers, the center point, and the position of the needle were determined, the geometric transformation operations were used to calculate the angles, and then determine the weight. To calculate the weight based on the position of the needle and the numbers on the scale, the following information must be determined: • The center of the scale surface: I • The point representing the tip of the scale needle: K • The point representing the largest number found: S • The line containing the points I and S: d1 • The line containing the point K and perpendicular to d1: d2 Then, the proposed method for calculating the weight is described as follows. Point V was determined firstly so that IV and KV are perpendicular to each other, and VIK is a valid triangle. The coordinates of the projection V from K to d1 were Advances in Technology Innovation, vol. 8, no. 2, 2023, pp. 100-110 106 calculated by giving the general equation of the line d1: a1x + b1y + c1 =0. From the general equation of d1, the general equation of d2 must be determined so that d2 is perpendicular to d1 in V (the direction of d2 is the normal vector of d1): a2x + b2y + c2 = 0. This can be achieved by: 1 1 1 2 2 2 0 0 a x b y c a x b y c + + = + + =    (1) The solution to the above system of equations is the coordinate of point V. Then, the angular measure of ���� (�) was calculated. To find �, the length of �� ⃗ and �� ⃗ must be calculated. After that, the relationship formula is applied in the right triangle to get the angular measureα . 2 2 ( , ) :AB x y AB x y= + ��� ��� (2) The length formula Eq. (2) was applied to calculate the length of the vectors �� ⃗ and �� ⃗ . sin d hα = (3) where h is the length of the hypotenuse of the right triangle, and d is the length of the opposite side of the angleα in a right triangle. It is trivial that each kilogram (kg) has an angular measure � = /360, where M is the maximum measure of the scale (i.e., for the scale with the maximum measure of 100 kg, the angular measure � = 100/360). Thus, the weight calculated from the angular measure is ∆= � × (kg). Finally, the final weight value of the scale was calculated by adding or subtracting ∆ from the value of the number found on the scale surface. As shown in Fig. 7, the number found near the needle is 50, and the position of the needle is on the right of the number 50 (because xK < xS) with the center of the scale as the coordinating elevation. Therefore, the weight value of the scale in the image is � = 50 × ∆ (kg). Fig. 7 Calculation of the angular measure ∆ 4. Experiments Two experiments were performed to evaluate the proposed system. The first experiment was used to evaluate the clock scale detection model, and the second one was used to evaluate the proposed reading scale value method. In the first experiment, the scale detection model was built based on the YOLOv5. In the training step, YOLOv5 configured for Google Colab was used to train the scale detection model. YOLOv5 provides 4 versions with different network architectures including YOLOv5- s, a small version; YOLOv5-m, a medium version; YOLOv5-l, a large version; and YOLOv5-x, an extra-large version. In this study, the YOLOv5-s was used because the model would be later deployed on mobile devices. Advances in Technology Innovation, vol. 8, no. 2, 2023, pp. 100-110 107 4.1. Environment settings and dataset description The experiments were performed on a Dell Vostro 15-3568 personal computer equipped with a Core i5 processor with 8 GB RAM. After several experiments, an appropriate configuration for YOLO was obtained with the following configurations: a learning rate of 0.01, a batch size of 8, a momentum of 0.937, a weight decay of 0.0005, and a stochastic gradient descent optimization with 10 epochs. To obtain a good performance, it is necessary to balance the epoch and learning rate [29]. As observed in the present experiments, the performance increased during learning, and there was no overfitting of the trained model since the training accuracy and the test accuracy were approximately the same. The dataset consisted of 709 images divided into two sets including a training set and a test set, with a 3-fold cross- validation approach. The images in the experimental dataset were taken from the farmer’s rice harvest, where the scale can measure a maximum weight of 100 kg. Additionally, the images in the dataset were taken from different angles, i.e., left, right, and front as shown in Fig. 8. (a) Taken from the left (b) Taken from the right (c) Taken in the front Fig. 8 Images of weighing scales taken in rice fields Scale detection performance is evaluated using average accuracy, precision, recall, mean average precision (mAP) 0.5 (mAP@0.5), and mAP@[0.5:0.95] with 3-fold cross-validation. The mAP@0.5 demonstrates average accuracy at the intersection over union (IoU) threshold of 0.5, while mAP@[0.5:0.95] ranges between 0.5 and 0.95. In addition, the mean absolute error (MAE) is also used to evaluate the accuracy of the weight measurement. The model is evaluated by averaging the absolute difference between the actual weight value (yi) and the weight value predicted by the model (xi). It can be obtained by: 1 D i ii x y MAE n = − =  (4) 4.2. Weighing scale detection with YOLO (a) Training set Fig. 9 Performance in fold 1 with various metrics train/box_loss train/cls_loss train/obj_loss metrics/precision metrics/recall Advances in Technology Innovation, vol. 8, no. 2, 2023, pp. 100-110 108 (b) Validation set Fig. 9 Performance in fold 1 with various metrics (continued) Fig. 9 and Table 1 show the results of weight detection in the collected images with precision, recall, mAP@0.5, and mAP@[0.5:0.95] measurements. Precision and recall quickly reach high accuracy after 8 epochs. mAP@0.5 reaches a peak value of 0.995, and mAP@[0.5:0.95] reaches a peak value of 0.830. For the situation of box loss, the value on the validation set reveals some fluctuations while it exhibits a gradual decrease on the other. The performance details during 10 epochs are illustrated in Table 1 with coverage at the 8th epoch and a low standard deviation. Table 1 The performance of weighing scale detection tasks during 10 epochs Epoch Precision Recall mAP@0.5 mAP@[0.5:0.95] 1 0.661 (±0.135) 0.812 (±0.100) 0.704 (±0.154) 0.187 (±0.096) 2 0.792 (±0.128) 0.714 (±0.121) 0.802 (±0.162) 0.327 (±0.154) 3 0.747 (±0.197) 0.827 (±0.098) 0.804 (±0.216) 0.324 (±0.138) 4 0.657 (±0.22) 0.901 (±0.054) 0.726 (±0.249) 0.248 (±0.14) 5 0.851 (±0.115) 0.944 (±0.04) 0.929 (±0.059) 0.429 (±0.058) 6 0.839 (±0.108) 0.986 (±0.006) 0.916 (±0.064) 0.521 (±0.071) 7 0.997 (±0.005) 0.997 (±0.005) 0.995 (±0) 0.577 (±0.158) 8 1.000 (±0.000) 1.000 (±0.000) 0.995 (±0.000) 0.731 (±0.042) 9 1.000 (±0.000) 1.000 (±0.000) 0.995 (±0.000) 0.795 (±0.046) 10 1.000 (±0.000) 1.000 (±0.000) 0.995 (±0.000) 0.830 (±0.026) 4.3. Weighing calculation Fig. 10 An application to support the sale of rice The image-based weight calculation method was evaluated on 236 images in the test set with 3-fold cross-validation in MAE. As shown in Fig. 10, high errors are obtained in some cases when the scale is detected, but the needle is not. In such cases, the predicted result is considered 0 which can result in a large error value when comparing the actual and predicted metrics/mAP@0.5 metrics/mAP@[0.5:0.95] val/cls_loss val/obj_loss val/box_loss Advances in Technology Innovation, vol. 8, no. 2, 2023, pp. 100-110 109 values. The average MAE on the test set for all cases is 6.445. The needle is detected correctly in 225 out of 236 cases, which corresponds to an accuracy of 0.953. Therefore, if only the case in which the needle is detected to calculate the weight, the result is an MAE of 3.7. In addition, an application based on the proposed method was also implemented as shown in Fig. 10. To calculate the weight of harvested rice in the captured images, the user enters the name of the rice plant and the unit price in VND/kg, then selects a set of images and clicks the “Calculate” button. The returned result is a series of calculations that are practically similar to the farmer’s manual calculation results. The application also saves the images for further investigation and comparison. 5. Conclusions The study proposed a method to determine the weight value of clock scales in images by identifying and extracting the scale from the captured image, and then the position of the needle in the scale is determined to calculate the weight value. This method is the first step to building a complete application that helps farmers calculate rice payments using modern technologies, particularly artificial intelligence. The detection and extraction of the scale achieved very high accuracy with mAP@0.5 at 0.995 and mAP@[0.5:0.95] at 0.830. However, the detection of the needle in the scale is still a challenge due to the limitation of the collected dataset. In addition, determining the important elements (center of the scale, needle edge, and numbers) for calculating the weight is highly dependent on a variety of factors, i.e., the light and the tilt of the scale in the photograph. The result from MAE is 3.7 for weight calculation. In future studies, the methods to reduce light noise could be evaluated since the images were taken mainly in sunny and dry areas; moreover, identifying objects as small as needles may be affected by the light factor. In addition, more thorough experiments could be conducted to determine better thresholds for identifying the important parameters for the weight calculation task. Lastly, further experiments with different clock scale capacities should be performed, for which further datasets have to be collected. Conflicts of Interest The authors declare no conflict of interest. References [1] M. F. Tsai and J. Y. Huang, “Sentiment Analysis of Pets Using Deep Learning Technologies in Artificial Intelligence of Things System,” Soft Computing, vol. 25, no. 21, pp. 13741-13752, November 2021. [2] T. V. Klompenburg and A. Kassahun, “Data-Driven Decision Making in Pig Farming: A Review of the Literature,” Livestock Science, vol. 261, article no. 104961, July 2022. [3] R. Sujatha, J. M. Chatterjee, N. Z. Jhanjhi, and S. N. Brohi, “Performance of Deep Learning vs Machine Learning in Plant Leaf Disease Detection,” Microprocessors and Microsystems, vol. 80, article no. 103615, February 2021. [4] M. D. Yang, Y. C. Hsu, W. C. Tseng, C. Y. Lu, C. Y. Yang, M. H. Lai, et al., “Assessment of Grain Harvest Moisture Content Using Machine Learning on Smartphone Images for Optimal Harvest Timing,” Sensors, vol. 21, no. 17, article no. 5875, September 2021. [5] D. Paudel, H. Boogaard, A. D. Wit, M. V. D. Velde, M. Claverie, L. Nisini, et al., “Machine Learning for Regional Crop Yield Forecasting in Europe,” Field Crops Research, vol. 276, article no. 108377, February 2022. [6] M. Q. Tran, M. Elsisi, M. K. Liu, V. Q. Vu, K. Mahmoud, M. M. F. Darwish, et al., “Reliable Deep Learning and IoT- Based Monitoring System for Secure Computer Numerical Control Machines against Cyber-Attacks with Experimental Verification,” IEEE Access, vol. 10, pp. 23186-23197, 2022. [7] H. Arai, “Increased Rice Yield and Reduced Greenhouse Gas Emissions through Alternate Wetting and Drying in a Triple-Cropped Rice Field in the Mekong Delta,” Science of the Total Environment, vol. 842, article no. 156958, October 2022. Advances in Technology Innovation, vol. 8, no. 2, 2023, pp. 100-110 110 [8] N. Stadlinger, H. Berg, P. J. V. D. Brink, N. T. Tam, and J. S. Gunnarsson, “Comparison of Predicted Aquatic Risks of Pesticides Used under Different Rice-Farming Strategies in the Mekong Delta, Vietnam,” Environmental Science and Pollution Research, vol. 25, no. 14, pp. 13322-13334, May 2018. [9] V. Meshram, K. Patil, V. Meshram, D. Hanchate, and S. D. Ramkteke, “Machine Learning in Agriculture Domain: A State-of-Art Survey,” Artificial Intelligence in the Life Sciences, vol. 1, article no. 100010, December 2021. [10] H. Pallathadka, M. Mustafa, D. T. Sanchez, G. S. Sajja, S. Gour, and M. Naved, “Impact of Machine Learning on Management, Healthcare and Agriculture,” Materials Today: Proceedings, in press. https://doi.org/10.1016/j.matpr.2021.07.042 [11] K. L. M. Ang and J. K. P. Seng, “Big Data and Machine Learning with Hyperspectral Information in Agriculture,” IEEE Access, vol. 9, pp. 36699-36718, 2021. [12] S. Rasti, C. J. Bleakley, N. M. Holden, R. Whetton, D. Langton, and G. O. Hare, “A Survey of High Resolution Image Processing Techniques for Cereal Crop Growth Monitoring,” Information Processing in Agriculture, vol. 9, no. 2, pp. 300-315, June 2022. [13] G. Sharmila and K. Rajamohan, “A Systematic Literature Review on Image Preprocessing and Feature Extraction Techniques in Precision Agriculture,” Congress on Intelligent Systems, vol. 114, pp. 333-354, July 2022. [14] D. Chakraborty and I. Ghosh, “Image Processing Techniques in Plant Disease Diagnosis: Application Trend in Agriculture,” Information and Communication Technology for Competitive Strategies (ICTCS 2021), vol. 400, pp. 691- 705, June 2022. [15] Z. Yang, J. H. Lai, J. Zhou, H. Zhou, C. Du, and Z. Lai, “Agriculture-Vision Challenge 2022 – The Runner-up Solution for Agricultural Pattern Recognition via Transformer-Based Models,” arXiv preprint arXiv:2206.11920, 2022. https://doi.org/10.48550/arXiv.2206.11920 [16] J. Bao and Q. Xie, “Artificial Intelligence in Animal Farming: A Systematic Literature Review,” Journal of Cleaner Production, vol. 331, article no. 129956, January 2022. [17] S. D. Alwis, Z. Hou, Y. Zhang, M. H. Na, B. Ofoghi, and A. Sajjanhar, “A Survey on Smart Farming Data, Applications and Techniques,” Computers in Industry, vol. 138, article no. 103624, June 2022. [18] N. Kleanthous, A. J. Hussain, W. Khan, J. Sneddon, A. A. Shamma’a, and P. Liatsis, “A Survey of Machine Learning Approaches in Animal Behaviour,” Neurocomputing, vol. 491, pp. 442-463, June 2022. [19] S. Zhang, Q. Xu, S. Sen, and N. Alshurafa, “VibroScale: Turning Your Smartphone into a Weighing Scale,” Adjunct Proceedings of the 2020 ACM International Joint Conference on Pervasive and Ubiquitous Computing and Proceedings of the 2020 ACM International Symposium on Wearable Computers, pp. 176-179, September 2020. [20] E. A. A. Hippocrate, H. Suwa, Y. Arakawa, and K. Yasumoto, “Food Weight Estimation Using Smartphone and Cutlery,” Proceedings of the First Workshop on IoT-enabled Healthcare and Wellness Technologies and Systems, pp. 9- 14, June 2016. [21] S. Kirushnath and B. Kabaso, “Weigh-in-Motion Using Machine Learning and Telematics,” 2018 2nd International Conference on Telematics and Future Generation Networks (TAFGEN), pp. 115-120, July 2018. [22] I. Nyalala, C. Okinda, C. Kunjie, T. Korohou, L. Nyalala, and Q. Chao, “Weight and Volume Estimation of Poultry and Products Based on Computer Vision Systems: A Review,” Poultry Science, vol. 100, no. 5, article no. 101072, May 2021. [23] I. Nyalala, C. Okinda, Q. Chao, P. Mecha, T. Korohou, Z. Yi, et al., “Weight and Volume Estimation of Single and Occluded Tomatoes Using Machine Vision,” International Journal of Food Properties, vol. 24, no. 1, pp. 818-832, June 2021. [24] R. Dohmen, C. Catal, and Q. Liu, “Computer Vision-Based Weight Estimation of Livestock: A Systematic Literature Review,” New Zealand Journal of Agricultural Research, vol. 65, no. 2-3, pp. 227-247, January 2021. [25] G. Jocher, K. Nishimura, T. Mineeva, and R. Vilariño, “Ultralytics/yolov5: v3.1 - Bug Fixes and Performance Improvements,” https://doi.org/10.5281/zenodo.4154370, September 01, 2022. [26] G. Bradski, “The OpenCV Library,” Dr. Dobb's Journal: Software Tools for the Professional Programmer, vol. 25, no. 11, pp. 120-123, 2020. [27] E. R. Dougherty, An Introduction to Morphological Image Processing, Washington: SPIE. Optical Engineering Press, 1992. [28] A. Rosebrock, “OpenCV Edge Detection (cv2.Canny),” https://www.pyimagesearch.com/2021/05/12/opencv-edge- detection-cv2-canny/, September 01, 2022. [29] Z. E. Khatib, A. B. Mnaouer, S. Moussa, M. A. B. Abas, N. A. Ismail, F. Abdulgaleel, et al., “LoRa-Enabled GPU- Based CubeSat Yolo Object Detection with Hyperparameter Optimization,” 2022 International Symposium on Networks, Computers and Communications (ISNCC), pp. 1-4, July 2022. Copyright© by the authors. Licensee TAETI, Taiwan. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY-NC) license (https://creativecommons.org/licenses/by-nc/4.0/).