Next Article in Journal
Recent Trends and Progress in Corrosion Inhibitors and Electrochemical Evaluation
Previous Article in Journal
Correlation between Neck Muscle Endurance Tests, Ultrasonography, and Self-Reported Outcomes in Women with Low Cervical Disability and Neck Pain
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Special Robot for Precise Grading and Metering of Mushrooms Based on Yolov5

1
School of Information Science and Engineering, Shandong Agricultural University, Tai’an 271018, China
2
Key Laboratory of Huang-Huai-Hai Smart Agricultural Technology, Ministry of Agriculture and Rural Affairs, Tai’an 271018, China
*
Authors to whom correspondence should be addressed.
These authors contributed equally to this work.
Appl. Sci. 2023, 13(18), 10104; https://doi.org/10.3390/app131810104
Submission received: 5 August 2023 / Revised: 30 August 2023 / Accepted: 30 August 2023 / Published: 7 September 2023

Abstract

:
In order to accomplish accurate mushroom classification and measurement, it is necessary to optimize the existing classification algorithm and measurement devices, as well as to design a specific robot to improve classification accuracy and measurement efficiency. In order to achieve the above objectives, a research-level verification of mushroom grading using Yolov5 + OpenCV and a mushroom measuring system using a resistance strain gauge sensor was carried out. In the aspect of mushroom grading, a method based on the OpenCV visual library was used to identify the minimum quadrilateral outside the mushroom contour, allowing the size of the mushroom to be measured. The experiment’s results show that the method can assess target objects that are occluded with each other under different illumination conditions with 96% accuracy. In the measurement of mushrooms, the strain of the resistance is converted into an analog signal, and the weight of different grades of mushrooms is converted according to the linear relationship after processing by the detection circuit module. Through this method, the error range is successfully controlled within ±0.02 kg, which meets the requirements of accurate measurement of mushrooms. The results of field experiments show that the proposed accurate grading and measurement method of Lentinula edodes is effective and feasible, and provides technical support for the intelligent grading and measurement of Lentinula edodes in production units.

1. Introduction

The integration of contemporary information technology, engineering technology, and other high-tech applications to agricultural output is known as intelligent agriculture and precision agriculture. Modern agricultural technology: As a representative agricultural product, the total annual output of edible fungi in China accounts for more than 85% of the total annual output of edible fungi in the world. The edible fungi industry has become an indispensable role in ensuring farmers’ “vegetable basket”, promoting regional industrial economic development and export exchange [1]. In recent years, whether from the perspective of nutrition or health care, domestic people have a higher and higher awareness of the edible fungi represented by mushrooms, which makes the consumption of this kind of edible fungi increase rapidly. With the continuous penetration and deepening of industrialization, factories and intelligent cultivation modes, mushroom production enterprises are also developing and growing. Under the new production mode, most of the production processes in the mushroom greenhouse have been mechanized and automated. However, in the process of mushroom picking statistics, weighing operation and inventory management, the existing production mode still adopts traditional manual basket handling to weigh the weight of mushrooms, and manually records the mushroom grade, inventory and other information, which leads to the problems of high labor intensity, low efficiency and ineffective docking of weight information with the information management system, making the production information easy to tamper with, and thus, it is difficult to achieve efficient, accurate and transparent inventory management.
This study has great research value in shiitake grading measurement. It is mainly used in the grading process and weighing measurement process, which can reduce labor costs, reduce errors and improve production efficiency. Under the background of the existing production mode of the shiitake industry, exploring intelligent agricultural machinery and equipment to promote the intelligent development of the shiitake industry is an urgent problem to be solved in the shiitake industry. Therefore, according to the actual operation needs of enterprises, combined with the shiitake greenhouse scene, this study developed a special robot for shiitake grading measurement that integrates an intelligent navigation decision-making service and information collection function, so as to realize the real-time, intelligent, accurate and efficient acquisition of shiitake grading measurement information, promoting the intelligent development of agricultural machinery and equipment, accelerating the internationalization of shiitake standards and promoting the intelligent development of the shiitake industry [2].
With the continuous penetration and deepening of industrialization and intelligent cultivation modes, mushroom production enterprises are also developing and growing. At present, the degree of automation in Lentinula edodes grading in China is not high. Ge Liang [3] designed a real-time grading production line for dried Lentinula edodes, integrating feeding, identification, transportation and grading functions. However, the turnover mechanism cannot meet the requirements of fresh Lentinula edodes turnover, and it is difficult to realize the grading of air-blown fresh Lentinula edodes. The grading and weighing process of shiitake mushrooms in shiitake mushroom factories still adopts the method of manually recording the grade and weight of shiitake mushrooms. The shape and size of shiitake mushrooms mainly depend on the judgment of human eyes, through which it is difficult to meet the accuracy requirements of grading and weighing. Heinemann et al. [4] built a mushroom detection and grading system. The external quality characteristics (color, shape, stem incision and umbrella opening degree) of white double-holding mushrooms were quantitatively analyzed by the image analysis method, and the automatic detection and grading of mushrooms were realized. The average error rate of the grading system for mushroom grading was 20%, while the inconsistency rate of manual detection was 14∼36%. As a result, the mushroom factory encountered difficulties in efficient, accurate and transparent inventory management.
With the development of image detection technology extended to the field of edible fungi, detection technology based on image processing has obvious advantages. The integration of artificial intelligence technology and image recognition technology makes computer image recognition more intelligent, gives full play to the advantages of intelligent image recognition technology and plays an irreplaceable role in some fields [5]. Hwang [6] combined machine vision and artificial neural networks to develop a grading image processing algorithm for dried mushrooms, and developed two automatic grading systems and grading software for dried mushrooms. The system is composed of a feeding device, a turnover device and a computer vision system with a lighting chamber, a microcontroller and a pneumatic actuator. Experiments show that the performance of the two-step grading and sorting system is about 0.3 s, and the classification accuracy of each mushroom is more than 95%. Using computer vision and image processing technology, the image of Lentinula edodes was collected and preprocessed, and the characteristics of cap diameter, thickness and color were extracted from the image of Lentinula edodes [7]. Xia Qing [8] used image processing technology to classify dried mushrooms, but the image processing recognition process was complicated and the model was thick. In this study, the defect detection and appearance quality classification of Lentinula edodes were completed according to the classification standard of fresh Lentinula edodes. Aiming at the problem of irregular arrangement of mushrooms, it is necessary to determine the position of the mushrooms and extract the boundary of the mushrooms. After a large number of test sample images, it was found that only using the OpenCV function library cannot maintain stability, and the accuracy rate was also greatly reduced for the more complex images. Chen et al. [9] removed heterochromatic mushrooms by image analysis, calculated the ratio of mushroom cap area to perimeter to detect whether mushrooms were damaged, and counted the number of image pixels to determine the size of mushrooms. The developed grading system used PLC as a grading controller to receive the grading instructions of the host computer and perform grading actions. The grading accuracy rate reached 97.6%, but the grading time was long and the efficiency was low. In order to effectively solve the problem, the mushroom grading method based on Yolov5 + OpenCV is optimized to make it more suitable for irregularly arranged mushroom recognition and to improve the detection performance of small targets. The mushroom metering system based on a resistance strain gauge sensor provides technical support for actual production and promotes the intelligent development of the mushroom industry.
The edible fungus production statistics robot, which integrates an intelligent navigation decision-making service and information collection function, realizes the whole industrial chain coverage and seamless connection of the industrial chain information of the edible fungus factory. The yield, quality and other information of edible fungi products can be traced, promoting the deep integration of information engineering technology and the edible fungi industry, and building a national modern agricultural industrial park with distinctive edible fungi characteristics, reasonable industrial layout, efficient resource utilization and significant radiation demonstration effects.
The organization of the thesis is as follows: The second partis the related work of the research; Section 3 introduces the experimental methods of this study; Section 4 verifies the effectiveness of this study through experiments; Section 5 discusses the feasibility of the study according to the experimental results of each group; Section 6 contains the summary.

2. Related Work

This section describes the professional robot measurement of mushroom grading. In order to realize the effective grading measurement of mushrooms, it is compared with other grading measurement methods. In order to effectively combine robot technology with intelligent agriculture, a special robot for the grading and metering of mushrooms is proposed. In order to improve the flexibility and intelligence of the robot, a self-propelled mobile chassis and automatic path planning algorithm are developed.

2.1. Classified Metering

With the continuous development of computer vision recognition technology, edge recognition algorithm is gradually applied to the field of agricultural product recognition. Using the recognition algorithm to classify agricultural products is more efficient in the classification of agricultural products. For example, Bhargava [10] proposed an automated algorithm based on machine learning to detect the types and quality grading of different vegetables and different varieties of fruits. Bandyopadhyaya [11]’s microcontroller-based robot system is used for tactile sensing to classify vegetables. Usha [12] introduced a vegetable quality assessment based on computer vision for eggplant and strawberry. Unay [13] proposed a multi-spectral machine vision system based on apple fruit grading, which has multiple gradings. The results show that the cascade structure is more useful than the single structure. Biswas and Hossain [14] proposed a real-time broccoli vegetable recognition system, which uses hue, saturation and value color histograms to classify vegetables. Rong’s [15] window-based segmentation is used to detect defects on the surface of oranges, and citrus recognition based on color index is performed by acquiring RGB images. However, the recognition accuracy of the above recognition algorithm for objects with uneven shape and small volume needs to be improved. In this paper, a recognition algorithm of yolov5 + opencv is proposed to identify objects with uneven shape and small volume.

2.2. Agricultural Robot

After the development of industrial robots, robots have been gradually applied in the field of agriculture. With the continuous development of robotics, robots with different functions have emerged [16,17,18]. In terms of agricultural information acquisition robots, Bao et al. developed a mobile crop phenotype analysis robot in the field, which realized the high-throughput measurement of crop stem scale strength and geometry [19]. Kayacan et al. from the University of Illinois developed a light and small robot, ‘TerraSentia’, applied to the canopy of a corn field. The robot uses a machine vision algorithm to automatically drive through the field to collect crop data. Using a deep learning algorithm, it can also monitor early plant growth vigor, identify diseases and estimate crop yield [20]. Mohd Saiful et al. developed a spraying robot, which uses intelligent equipment such as nozzles and medicine tanks to use the robot ’s autonomous navigation in the real environment, and then realizes the function of spraying pesticides according to the set action [21]. Majeed et al. designed a vineyard pruning robot, used RGB-D machine vision to detect the structure of fruit trees, optimized the decision-making operation points, and realized the autonomous pruning operation on the move [22].
At present, agricultural information acquisition and agricultural operation robots have carried out research and applications such as transplanting and environmental control. However, the development of agricultural robots still needs to focus on breaking through the problems of applicable cost, operation efficiency, use reliability and category diversification, as well as further improving the breadth and scale of technical demonstration. In the research process, it is necessary to analyze the characteristics of the operation object, combine the agricultural operation robot with the production management process and further improve the practicability of the robot research scheme. Because there are few studies on the robot in the mobile grading measurement of mushrooms, this paper develops a special robot for mushroom grading measurement in mushroom picking and the weighing of mushrooms in mushroom factories.

2.3. Robot Path Planning

Li Ning uses the global path planning algorithm to search for the best path in the known path. However, if the surrounding environment of the robot changes, the best path obtained by the global path planning originally used in the static map is no longer used [23]. Aiming at the problems of slow path planning speed and too many turns in the conventional genetic algorithm, the turning angle is added to the adaptive function as a control factor, and finally, the size of the adaptive function is constrained by the turning angle and the path length. Zhang Hongyang used MATLAB to verify that the path planned by the improved algorithm has fewer turns and is smoother [24]. In addition, Korkmaz used the path planning obtained by the improved artificial potential field algorithm to inspire the ant colony algorithm, and finally improved the shortcomings of the ant colony algorithm that is easy to fall into the local optimal solution [25]. In the aspect the of dynamic window algorithm, Mohamed proposed an improved dynamic window algorithm based on adaptive parameters to ensure that the robot can move quickly while maintaining a safe distance from the obstacle [26].
The path planning technology of mobile robots has become more and more mature. However, due to the complexity and variability of its application scenarios, there are still many practical problems to be solved in the path planning technology, and there is still a lot of room for development. Although the existing algorithms have certain limitations and are mostly applied to simple planning scenarios, the basic algorithms still have their applicable scenarios, and these algorithms are an important basis for practical applications. Therefore, it is still of great significance to optimize the limitations of different path planning algorithms. More mathematical theories can be applied to optimize path planning algorithms, such as improving the cost function of the A * algorithm and optimizing the fitness function of the genetic algorithm.

3. Methods

This part takes lentinus edodes as the research object, and introduces the hardware system implementation, mushroom grading algorithm, weighing system and automatic planning path implementation method of mushroom grading, as well as a professional metering robot. The robot object and simulation experiment photos are displayed, and the realization of each function is described in detail.

3.1. Hardware Establishment

In order to improve the intelligent level of the edible fungi industry, meet the digital needs of the whole industrial chain of edible fungi and realize the collection of heterogeneous data information such as the grade and weight of mushroom products, according to the digital demand of the whole industrial chain of mushrooms, combined with the basic conditions of mushroom factories and the operation needs of mushroom picking and sorting, warehousing weighing, inventory management and other links, a special robot for mushroom measurement is designed and developed.
The main control unit of the information acquisition system uses MSP430F5438 A single chip microcomputer, equipped with ADAM Advantech acquisition card, and connects various types of sensors such as current type, voltage type and 485 protocol. Weighing sensor, RFID module, voice module, barcode scanning module, face recognition module through the data acquisition card to RS-485 protocol and MSP4305438A master control unit achieve data information transmission and reception; the speech recognition module, speech synthesis module and display control module interact with the main control unit through the TTL interface. The main control unit of the information acquisition system communicates with the wireless data transmission terminal VTU through TCP. The TCP/IP protocol is used to realize long-distance data transmission and reception, and the information collected in the mushroom shed is sent to the server for storage.
The robot system structure diagram is shown in Figure 1:
The specific functions are as follows:
  • Mushroom grading: Based on the intelligent robot, the mushroom grading algorithm based on Yolov5 + OpenCV is used to identify the image and measure the size of the mushroom cap. According to the established mushroom grading measurement standard, the mushroom is graded accordingly.
  • Mushroom measurement: Mushroom measurement system is based on resistance strain gauge sensor. When the sensor undergoes elastic deformation, the resistance value of the resistance strain gauge changes, and the strain of the mushroom weight through the equivalent resistance is converted into an analog signal (1) and (2). The weight of different grades of mushrooms is converted into voltage signal output according to the linear relationship. The analog signal is processed by the detection circuit, and the amplified analog signal is converted into the weight data of mushrooms through the AD conversion sub-module.
Analog signal output formula:
U o u t = U E ( R 11 + R 12 ) U E ( R 13 + R 14 )
Linear relationship conversion formula:
K ε = Δ R R
3.
Autonomous obstacle avoidance function: The multi-sensor fusion SLAM algorithm suitable for ROS environment is studied. The global exploration is used for path planning and autonomous navigation, and the dynamic window method is used for local obstacle avoidance. Among them, the red grid points in Figure 2 represent dynamic obstacles moving up and down, and Figure 3 represents additional unknown obstacles. The blue grid point represents the starting point; the green grid point represents the target point; the black dotted line is the global path planned before the obstacle is added; the blue solid line is the actual trajectory of the robot. The function simulation experiment is shown in Figure 2 and Figure 3.
The navigation path of the robot is constantly updated with the change in the target point or obstacle so that the robot can move autonomously and avoid obstacles in the mushroom shed. The automatic obstacle avoidance simulation experiment is shown in Figure 4 and Figure 5.
4.
The automatic navigation and robot mobile chassis are shown in Figure 6 and Figure 7.

3.2. Mushroom Grading Measurement Standard

In this experiment, by synthesizing the ‘mushroom quality grad’ standards formulated throughout the country, the mushroom grading measurement standards are summarized as follows:
  • Grade 1 mushroom: mushroom shape round, all open umbrella or slightly curled, more than 6 centimeters in diameter.
  • Grade 2 mushroom: the mushroom shape is round, the cap is fully open and flat, with a diameter of more than 4 cm.
  • Grade 3 mushroom: mushroom shape is not neat, the diameter of the cap is less than 4 cm and more than 2 cm.

3.3. YOLOV5

YOLOV5 is divided into four different network structures, namely YOLV5s, YOLOV5m, YOLO5L, YOLOv5x. According to the requirements of mushroom grading, the recognition algorithm should have certain real-time and high efficiency. YOLOv5 is a pre-trained object detection architecture and model series on COCO data set. It is an extension of YOLO series. The data set adopts COCO. Its network structure is divided into four modules: input, backbone, neck and head. Compared with YOLOv4, YOLOv5 has greatly improved performance in speed and accuracy, thanks to operations such as Mosaic data enhancement, adaptive anchor frame calculation and adaptive image scaling. In the network training stage, YOLOv5 uses Mosaic data augmentation operation to improve the training speed of the model and the accuracy of the network. However, when using the Yolov5 algorithm for image recognition, the size of the mushroom cap cannot be identified and marked, resulting in the size of the mushroom not being able to be identified. Therefore, this paper improves the Yolov5 algorithm to improve the practicability and recognition accuracy of its practical application. Figure 8 is the network structure of yolov5.

3.4. Algorithm Optimization

In this study, the method of mushroom size detection based on OpenCV pixel/metric ratio algorithm was used. The core of the algorithm is to establish the pixels_per_metric ratio index of the image by using the reference object in the image (which satisfies the real size that is known and easy to obtain, called the reference object). It is used to measure the number of pixels for each given target, that is, the ratio of the pixel width of the object to the true width of the object, pixels_per_metric = object_width/know_width. The size of the mushroom in the image is calculated by this index. At the same time, the OpenCV method is integrated into the Yolov5 recognition algorithm to improve the Yolov5 algorithm.
In this algorithm, the storage path of the mushroom image to be tested and the size of the reference object are used as two input parameters, and the Python package named imutils package is used. At the same time, the midpoint function for calculating the midpoint of two coordinates is defined. First, the image is grayed and smoothed by a Gaussian filter. On this basis, the edge of the mushroom image is detected, and the gap between the edges is eliminated by expansion and corrosion, and the edge of the mushroom is extracted. Then, the cv2.cv.BoxPoints function of OpenCV 2.4 and the cv2 ḃoxPoints method of OpenCV 3 are used to calculate the rotation bounding box of the image. The coordinates of the bounding box are arranged in the order of upper left, upper right, lower right and upper left. The midpoint function is used to calculate the midpoint of the four edges of the bounding box and connect them accordingly. Finally, the pixels_per_metric variable is initialized by the Euclidean distance between the midpoint sets, and the actual size of the mushroom is calculated by combining this variable with the Euclidean distance between the midpoints of the side lengths of the mushroom bounding box.
In this study, circular and elliptical regions were compared with the smallest quadrilateral outside the contour. It was found that the use of circular and elliptical regions under the irregular umbrella cover of Lentinula edodes exceeded the identification anchor frame or insufficiently identified the boundary of the anchor frame, resulting in inaccurate measurement of the diameter of the shiitake umbrella cover, which in turn affected the classification accuracy of Lentinula edodes.
The specific test results are shown in Figure 9 and Figure 10:

3.5. Mushroom Metering System Composition

The mushroom metering system takes the resistance strain gauge weighing sensor as the main body, including the detection circuit and the sensor protection device. The resistance strain gauge sensor is linked to the acquisition master microcontroller through the detection circuit. The detection circuit includes an amplifier and an AD converter, thereby realizing the amplification and AD conversion of the weighing sensor signal. The structure diagram of the resistance strain gauge sensor is shown in Figure 11, and the equivalent circuit diagram is shown in Figure 12. It is composed of resistance strain gauge 1, weighing tray 2, elastic element 3, weighing chassis 4, bracket 5 and 6. When the resistance strain gauge is subjected to elastic deformation, the resistance value of the resistance strain gauge 1 will also change.
When the mushroom is weighed, the resistance value of the resistance strain gauge changes when the sensor is elastically deformed. The weight of the mushroom is converted into an analog signal through the strain of the equivalent resistance. The weight of different grades of mushrooms is converted into a voltage signal output according to the linear relationship. The analog signal is processed by the detection circuit. The detection circuit diagram is shown in Figure 13,the operational amplifier sub-module includes an operational amplifier U6 (model AD8656). The + INA and + INB pins of the operational amplifier U6 are connected to the positive and negative s a and s b of the analog signal UOUT, respectively. The-INA and-INB pins of the operational amplifier U6 are connected by resistance R a, the-INA and OUTA pins of the operational amplifier U6 are connected by resistance R b, and the-INB and OUTB pins of the operational amplifier U6 are connected by resistance R c. The OUTA pin of the operational amplifier U6 outputs a positive signal S a that amplifies the analog signal, and the OUTB pin of the operational amplifier U6 outputs a negative signal S b that amplifies the analog signal. And the amplified analog signal is converted into the weight data of the mushroom through the AD conversion sub-module.

4. Experimental Section

In order to explore the feasibility and rationality of this study, this section sets up multiple sets of control experiments for the mushroom grading recognition algorithm and the mushroom weighing system. In order to ensure the scientificity of the experimental results and avoid experimental errors, all experiments were carried out in the same experimental environment. In order to explore the rationality and effectiveness of the test algorithm, this study set up a yolov5 series algorithm comparison experiment and a different recognition algorithm comparison experiment. In order to test the effectiveness of the measurement system, multiple experiments with different weights were set up.

4.1. Experiment Setting

Experimental Environment

The hardware facilities of this study were carried out in NVIDIA GeForce RTX 2060. The equipment comes from Nvidia Semiconductor Technology Co., Ltd. in Santa Clara, CA, USA.
The experimental parameters of mushroom grading are as follows:
  • Img size defaults to 640 × 640.
  • batch-size is 32.
  • The number of experimental iterations is set to 6000.
A total of 1000 samples were obtained by camera shooting. Labeling software was used to mark the front and back of the mushroom in the image, and the length and width of the cap were recorded. The target information in the image was saved to the XML file according to the PASCAL VOC format. Then, according to the ratio of 9:1, it was divided into training samples and test samples.

4.2. Mushroom Grading Training Experiment

The mushroom grading model training uses a unified data set, and the following experiments were performed under the same configuration environment:
  • Training of different YOLOV5 versions: The YOLOv5 algorithm has four main versions, namely YOLOv5 s, YOLOv5 m, YOLOv5 l and YOLOv5 x. The four types of structures are the same, and the differences lie in the depth and width of the network. The depth and width gradually increase from s to x. At the same time, the high-grade group and the low-grade group are set up for different yolov5 version training.
  • Different recognition model training: In this study, the Yolov5 algorithm is compared with other traditional algorithms SSD, Faster RCNN and Yolov3. The training is performed on the same data set and test set, and in the same environment. At the same time, the high-level group and the low-level group are set up to train different recognition models.

4.3. Mushroom Measurement Training Experiment

Ten measurement experiments were carried out for the two scenarios to test the accuracy of mushroom measurement. Under the condition of 20 °C, 20 kg and 35 kg load experimental groups were set up in the simulated environment of mushroom shed.

5. Results and Discussion

This part shows the results of the mushroom grading experiment and the mushroom measurement experiment, and discusses the experimental results.

5.1. Result

5.1.1. The Results of Mushroom Grading Experiment

The results of each grading test of Lentinula edodes are shown in Table 1, Table 2, Table 3, Table 4, Table 5 and Table 6.

5.1.2. The Results of Mushroom Measurement Experiment

The results of each measurement test of Lentinula edodes are shown in Table 7 and Table 8 below.

5.2. Discussion

5.2.1. Discussion on the Results of Grading Experiment of Shiitake Mushroom

The indicators used by YOLOv5 to evaluate the performance of its object detection system are accuracy, recall rate, and mAP. Generally speaking, the higher the correct rate, the higher the recall rate, indicating better system performance. The actual size of the mushroom was calculated by the OpenCV size detection algorithm after the mushroom image was detected by YOLOv5. The confidence of the detection result was estimated to be 0.96, which proved the feasibility of the algorithm. The twice-processed mushroom image was output. The experimental results show that the accuracy rate on the verification set is above 95%, indicating that the overall recognition effect of the model is very good. The results’ data are shown in Figure 14. Among them, the red circle represents the dense sample data located in the interval, and the blue circle represents the sparse sample data located in the interval.The mean value of the box loss function, the mean value of the target detection loss and the mean value of the classification loss are all in line with the requirements. The lower value and the higher accuracy and recall rate confirmed the availability and correctness of the mushroom recognition model in this study.
The training effects of the four versions are shown in Table 1. It can be seen that the accuracy is not much different, and the difference is basically within 1%. Among them, the model size is quite different. YOLOv5x reaches nearly 200 MB, while YOLOv5s is only a dozen MB. For many samples with high and low classification levels, different versions of Yolov5 training are used. The experimental results are shown in Table 2 and Table 3. It can be seen from Table 2 and Table 3 that the classification level of Lentinula edodes will not affect the accuracy of experimental recognition. Yolov5 and Yolov5 s models have strong applicability.
From Table 4, Table 5 and Table 6, the accuracy of YOLOv5 is higher than that of the three traditional algorithms. The model size of Yolov3 is about 210 MB, while the model size of SSD and Faster R-CNN is also higher than that of YOLOv5, and the difference is large. The FPS in the table indicates the number of pictures that the target detection network can process per second, and the detection speed is indicated by this; it can be seen from the table that the detection speed of YOLOv5 model is slightly worse than that of Yolov3. For the detection accuracy of Lentinula edodes front and back detection and pileus university detection, the detection effect of YOLOv5 is better.
Table 1. Training results of different versions of YOLOV5.
Table 1. Training results of different versions of YOLOV5.
Yolov5 ModelPrecisionRecallMAPParam SizeTime
Yolov5s0.7560.8760.85414.2 MB5.6 h
Yolov5m0.7540.9110.85345.6 MB5.7 h
Yolov5l0.7380.9290.850100.7 MB6.1 h
Yolov5x0.7510.9040.858194.2 MB6.4 h
Table 2. Training results of different versions of YOLOV5 (high grading level).
Table 2. Training results of different versions of YOLOV5 (high grading level).
Yolov5 ModelPrecisionRecallMAPParam SizeTime
Yolov5s0.7540.8760.85215.2 MB5.6 h
Yolov5m0.7510.9110.85345.9 MB5.8 h
Yolov5l0.7360.9290.852101.7 MB6.2 h
Yolov5x0.7510.9040.857195.2 MB6.4 h
Table 3. Training results of different versions of YOLOV5 (low grading level).
Table 3. Training results of different versions of YOLOV5 (low grading level).
Yolov5 ModelPrecisionRecallMAPParam SizeTime
Yolov5s0.7530.8740.85314.2 MB5.6 h
Yolov5m0.7540.9100.85446.9 MB5.9 h
Yolov5l0.7350.9250.853103.7 MB6.2 h
Yolov5x0.7520.9060.857196.2 MB6.3 h
Table 4. Training results of different recognition models.
Table 4. Training results of different recognition models.
ModelMAPParam SizeFPS
SDD0.70278.9 MB54
R-CNN0.743110.0 MB13
Yolov30.794218.7 MB31
Yolov50.85414.2 MB26
Table 5. Training results of different recognition models (high grading level).
Table 5. Training results of different recognition models (high grading level).
ModelMAPParam SizeFPS
SDD0.70378.4 MB55
R-CNN0.744110.5 MB13
Yolov30.794218.7 MB30
Yolov50.85314.6 MB27
Table 6. Training results of different recognition models (low grading Level).
Table 6. Training results of different recognition models (low grading Level).
ModelMAPParam SizeFPS
SDD0.70277.4 MB54
R-CNN0.744109.5 MB16
Yolov30.792217.7 MB32
Yolov50.85114.4 MB25

5.2.2. Discussion on the Results of Measurement Experiment of Shiitake Mushroom

It can be seen from Table 7 and Table 8 that the error range of the mushroom measurement system designed in this paper is within ±0.02 kg, which meets the needs of the accurate measurement of mushrooms.
Table 7. Weighing experiment data sheet (20 kg).
Table 7. Weighing experiment data sheet (20 kg).
Order Number12345678910
Load value20.0020.0020.0020.0020.0020.0020.0020.0020.0020.00
Weight value20.0020.0120.0220.0019.9920.0020.0120.0120.0119.99
Absolute value of error0.000.010.020.000.0100.0000.0100.010.010.01
Table 8. Weighing experiment data sheet (35 kg).
Table 8. Weighing experiment data sheet (35 kg).
Order Number12345678910
Load value35.0035.0035.0035.0035.0035.0035.0035.0035.0035.00
Weight value35.0235.0035.0034.9934.9935.0235.0134.9935.0235.00
Absolute value of error0.020.000.000.010.0100.0200.0100.010.020.00

6. Conclusions and Future Work

6.1. Future Work

In this study, yolov5, SLAM, autonomous navigation and other technologies were mainly applied, and the physical construction of a mushroom metering robot was completed through software and hardware design. In further studies, we mainly performed the following work:
  • Optimizing the yolov5 recognition algorithm, continuing to improve the recognition speed and stability, and making the mushroom classification recognition algorithm more accurate and effective.
  • Optimizing the path automatic planning algorithm, accelerating the mapping speed in a wide range of outdoor scenes, and improving the quality of mapping.
  • Further development of mushroom spraying, intelligent inspection and other functions to improve the service ability of special robots.

6.2. Conclusions

In view of the problems existing in the mushroom factory, a special robot for precise grading and measurement of mushrooms was constructed using modern information technology such as artificial intelligence. This robot was able to perform the tasks of grading measurement, autonomous navigation and path planning. Yolov5 and OpenCV were used to build a mushroom grading algorithm. The effectiveness and feasibility of the method were confirmed by later verification and practice. Using the method of deep learning image recognition, based on the principle of the target detection model, the network structure and optimization module were designed. In order to improve the robustness of model defect detection, the affine transformation matrix method was used to denoise the image, and the data set was expanded by rotation and translation. The YOLOv5 is improved, and opencv and tensorflow & keras are integrated into YOLOv5. The final average accuracy rate reaches 96%, which is 3.7% higher than the original MAP. The average accuracy of each damage is also improved, and the ability of small target defect detection is improved. The mushroom measurement system can automatically and accurately obtain the weight of mushrooms, and the error is maintained within ±0.02 kg. The special robot for precise grading and metering of Lentinula edodes designed in this paper can significantly improve the grading accuracy and speed of Lentinula edodes scale production, promote the deep integration of digitization and Lentinula edodes industry, and lay a foundation for the high-quality development of Lentinula edodes industry.

Author Contributions

Conceptualization, X.Z. and P.L.; Methodology, X.Z., K.Z., P.L., Y.Z. and H.J.; Software, X.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Huang, C.; Chen, Q.; Zhao, M. Analysis of the present situation and problems of industrialized production of edible fungi in China. Agric. Eng. Technol. 2016, 15, 2237–2246. [Google Scholar]
  2. Limei, T.; Jiao, D.; Lin, Z.; Dafeng, S. Analysis of the development status of mushroom industry and standardization in China. China Edible Fungi 2020, 39, 8–16. [Google Scholar]
  3. Ge, L. Study on Real-Time Grading Production Line of Lentinula edodes. Master’s Thesis, Huazhong Agricultural University, Wuhan, China, 2012. [Google Scholar]
  4. Heinemann, P.H.; Hughes, R.; Morrow, C.T.; Sommer, H.J.; Beelman, R.B.; Wuest, P.J. Grading of mushrooms using a machine vision system. Trans. ASAE 1994, 37, 1671–1677. [Google Scholar] [CrossRef]
  5. Zeng, C. Analysis of computer intelligent image recognition algorithm. Electron. Components Inf. Technol. 2020, 4, 61–63. [Google Scholar]
  6. Hwang, H. Development of on-line automatic grading and Internet based real time production management system for shiitake. Jpn. J. Food Eng. 2005, 6, 1–7. [Google Scholar] [CrossRef]
  7. Xi, X. Visual sorting technology and graphic defect detection of external quality of fresh Lentinula edodes. Edible Fungi China 2020, 39, 153–156. [Google Scholar]
  8. Xia, Q. Study on Classification Method of Dried Mushroom Based on Image Processing. Master’s Thesis, Huazhong Agricultural University, Wuhan, China, 2014. [Google Scholar]
  9. Chen, H.H.; Ting, C.H. The development of a machine vision system for shiitake grading. J. Food Qual. 2004, 27, 352–365. [Google Scholar] [CrossRef]
  10. Bhargava, A.; Bansal, A.; Goyal, V. Machine Learning–Based Detection and Sorting of Multiple Vegetables and Fruits. Food Anal. Methods 2022, 15, 228–242. [Google Scholar] [CrossRef]
  11. Bandyopadhyaya, I.; Babu, D.; Bhattacharjee, S.; Roychowdhury, J. Vegetable grading using tactile sensing and machine learning. In Advanced Computing, Networking and Informatics—Volume 1: Advanced Computing and Informatics Proceedings of the Second International Conference on Advanced Computing, Networking and Informatics (ICACNI-2014); Springer: Cham, Switzerland, 2014; pp. 77–85. [Google Scholar]
  12. Usha, S.; Karthik, M.; Jenifer, R. Automated sorting and grading of vegetables using image processing. Int. Eng. Res. Gen. Sci. 2017, 5, 53–61. [Google Scholar]
  13. Unay, D.; Gosselin, B. Artificial neural network-based segmentation and apple grading by machine vision. In Proceedings of the IEEE International Conference on Image Processing 2005, Genova, Italy, 11–14 September 2005. [Google Scholar]
  14. Biswas, H.; Hossain, F. Automatic vegetable recognition system. Int. J. Eng. Sci. Invent. 2013, 2, 37–41. [Google Scholar]
  15. Rong, D.; Rao, X.; Ying, Y. Computer vision detection of surface defect on oranges by means of a sliding comparison window local segmentation algorithm. Comput. Electron. Agric. 2017, 137, 59–68. [Google Scholar] [CrossRef]
  16. Tian, S.B.; Ashraf, M.A.; Kondo, N.; Shiigi, T.; Morin, M.A. Optimization of machine vision for tomato grafting robot. Sens. Lett. 2013, 11, 1190–1194. [Google Scholar] [CrossRef]
  17. Li, Y.; Luo, F.; Fan, Z. Hadoop + OpenCV cluster image processing development environment construction and test research. Comput. Knowl. Technol. 2016, 12, 203–205. [Google Scholar] [CrossRef]
  18. Bao, Y.; Gai, J.; Xiang, L. Field robotic systems for high-throu ghput plant phenotyping: A review and a casestudy. In High-Throughput Crop Phenotyping Concepts and Strategies in Plant Sciences; Zhou, J., Nguyen, H.T., Eds.; Springer: Cham, Switzerland, 2021; pp. 13–38. [Google Scholar]
  19. Kayacan, E.; Young, S.N.; Peschel, J.M.; Chowdhary, G. High-precision control of tracked fied robots in the presence ofunknown traction coefficients. J. Field Robot. 2018, 35, 1050–1062. [Google Scholar] [CrossRef]
  20. Shamshiri, R.R.; Weltzien, C.; Hameed, I.A.; Yule, I.J.; Chowdhary, G. Research and development in agricultural robotics: A perspective of digital farming. Int. J. Agric. Biol. Eng. 2018, 11, 1–14. [Google Scholar] [CrossRef]
  21. Majeed, Y.; Karkee, M.; Zhang, Q.; Fu, L.; Whiting, M. Development and performance evaluation of a machine vision system and an integrated prototype for automated green shoot thinning in vineyards. J. Field Robot. 2021, 38, 898–916. [Google Scholar] [CrossRef]
  22. Li, N. Research on Local Path Planning Algorithm for Mobile Robots in Home Environment. Master’s Thesis, Harbin University of Technology, Harbin, China, 2018. [Google Scholar]
  23. Zhang, H. Shopping Guide Robot Autonomous Navigation and Human-Computer Interaction. Master’s Thesis, Southwest University of Science and Technology, Mianyang, China, 2018. [Google Scholar]
  24. Korkmaz, M.; Durdu, A. Comparison of optimal path planning algorithms. In Proceedings of the 14th International Conference on Advanced Trends in Radioelecrtronics, Telecommunications and Computer Engineering (TCSET), Lviv-Slavske, Ukraine, 20–24 February 2018. [Google Scholar]
  25. Mohamed, A.; Ren, J.; Sharaf, A.M.; Ei-Gindy, M. Optimal path planning for unmanned groundvehicles using potential field method and optimal control method. Int. J. Veh. Perform. 2018, 4, 1–14. [Google Scholar] [CrossRef]
  26. Yan, J.; Zhao, J.; Cai, Y.; Wang, S.; Qiu, X.; Yao, X.; Tian, Y.; Zhu, Y.; Cao, W.; Zhang, X. Improving multi-scale detection layers in the deep learning network for wheat spike detection based on interpretive analysis. Plant Methods 2023, 19, 46. [Google Scholar] [CrossRef]
Figure 1. System structure diagram.
Figure 1. System structure diagram.
Applsci 13 10104 g001
Figure 2. Single-obstacle simulation experiment results.
Figure 2. Single-obstacle simulation experiment results.
Applsci 13 10104 g002
Figure 3. Results of multiple-obstacle simulation experiment.
Figure 3. Results of multiple-obstacle simulation experiment.
Applsci 13 10104 g003
Figure 4. Simulated mushroom shed experimental scene.
Figure 4. Simulated mushroom shed experimental scene.
Applsci 13 10104 g004
Figure 5. Automatic planning path simulation experiment.
Figure 5. Automatic planning path simulation experiment.
Applsci 13 10104 g005aApplsci 13 10104 g005b
Figure 6. Dimensions of mobile chassis.
Figure 6. Dimensions of mobile chassis.
Applsci 13 10104 g006
Figure 7. Physical diagram of mobile chassis.
Figure 7. Physical diagram of mobile chassis.
Applsci 13 10104 g007
Figure 8. Network structure of YOLOv5.
Figure 8. Network structure of YOLOv5.
Applsci 13 10104 g008
Figure 9. Yolov5 identification example.
Figure 9. Yolov5 identification example.
Applsci 13 10104 g009
Figure 10. Example of improved algorithm output.
Figure 10. Example of improved algorithm output.
Applsci 13 10104 g010
Figure 11. Structural diagram of resistance strain gauge sensor.
Figure 11. Structural diagram of resistance strain gauge sensor.
Applsci 13 10104 g011
Figure 12. Equivalent circuit diagram of resistance strain gauge sensor.
Figure 12. Equivalent circuit diagram of resistance strain gauge sensor.
Applsci 13 10104 g012
Figure 13. Schematic diagram of detection circuit.
Figure 13. Schematic diagram of detection circuit.
Applsci 13 10104 g013
Figure 14. Result data chart.
Figure 14. Result data chart.
Applsci 13 10104 g014
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Zhu, X.; Zhu, K.; Liu, P.; Zhang, Y.; Jiang, H. A Special Robot for Precise Grading and Metering of Mushrooms Based on Yolov5. Appl. Sci. 2023, 13, 10104. https://doi.org/10.3390/app131810104

AMA Style

Zhu X, Zhu K, Liu P, Zhang Y, Jiang H. A Special Robot for Precise Grading and Metering of Mushrooms Based on Yolov5. Applied Sciences. 2023; 13(18):10104. https://doi.org/10.3390/app131810104

Chicago/Turabian Style

Zhu, Xiaoyang, Ke Zhu, Pingzeng Liu, Yan Zhang, and Honghua Jiang. 2023. "A Special Robot for Precise Grading and Metering of Mushrooms Based on Yolov5" Applied Sciences 13, no. 18: 10104. https://doi.org/10.3390/app131810104

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

Article Metrics

Back to TopTop