Apple Grading Method Design and Implementation for Automatic Grader Based on Improved YOLOv5
Abstract
:1. Introduction
2. Materials and Methods
2.1. Automatic Apple Grader Design
- (1)
- Feeding and material handling lifting mechanism. The Feeding and material handling lifting mechanism is a scraper elevator, as shown in Figure 2. The scraper elevator consists of a funnel-shaped storage tank and a vertical conveyor belt, where the funnel-shaped storage tank includes the back plate of the hopper and the support plate, the three-dimensional conveyor belt includes the guide plate and the curved scraper, and the whole mechanism is placed at an inclination of 45°. The scraper elevator moves the conveyor belt by means of an AC motor driven by a frequency converter, which organizes the disordered apples into an orderly quadruple queue, transporting them from the bottom upwards and conveying them into the Turnover detection conveyor.
- (2)
- Turnover detection conveyor. The Turnover detection conveyor is shown in Figure 3 and consists of sprockets, chains, sponge rollers, and motors. The apples are lifted by the scraper elevator into the turnover detection conveyor. The turnover detection conveyor uses pairs of double-tapered rollers to turn the apples axially, and a CCD industrial camera mounted on top of the lampshade collects images of the tumbling apples several times to obtain complete surface information about the apples in a moving position.
- (3)
- Visual inspection and automatic grading control system. The visual inspection and automatic grading control system are shown in Figure 4 and consist of a CCD industrial camera and automatic grading control system. The visual inspection and automatic grading control system determines the grading of apples according to the information collected by the CCD industrial camera on the whole surface of the apples and finally sends the grading results to the graded actuators.
- (4)
- Graded actuators. The graded actuator is shown in Figure 5 and consists of a Trigger grading mechanism, sprocket chain drive, grading fruit cup, grading channel, and a motor. The grading fruit cup is shown in Figure 5b and consists of a cup body, a drop door, and rollers. The grading actuator receives the grading results from the image detection and automatic grading system and allows the apples to reach the corresponding grade position and then open the cups and fall into the corresponding grade storage bin.
2.2. Apple Image Acquisition and Data Augmentation
2.2.1. Image Acquisition
2.2.2. Apple Grading Criteria
2.2.3. Dataset Annotation and Expansion
2.3. Design of Apple Grading Method Based on Improved YOLOv5
2.3.1. Improvement of the Activation Function
2.3.2. Improvement of the Loss Function
2.3.3. Integration of Attentional Mechanisms
3. Result and Discussion
3.1. Experimental Validation and Analysis of Results
3.1.1. Experimental Environment
3.1.2. Analysis of Experimental Results
- (1)
- Experiments related to the improved algorithm
- (2)
- Comparison experiments between different models
3.2. System Solution Validation
3.2.1. Automatic Apple Grader Control System Set Up
3.2.2. Results of the Grading Experiment
4. Conclusions
- (1)
- In order to achieve more accurate apple grading and better real-time performance, the DIoU loss function and Mish loss function were chosen to replace the GIoU function and Relu activation function of the original algorithm model in terms of algorithm optimization, which improved the feature extraction capability and convergence speed of the model. The attention SE module is embedded in the Backbone structure to discard unnecessary features, which improves the training accuracy of the model without burdening the model. The experimental results show that the improved YOLOv5 has improved the average accuracy rate mAP by 3.1% compared to YOLOv5, 11% compared to YOLOv4, and 15% compared to SSD, and the real-time grading speed has reached 59.63 FPS, which is a large improvement in both the apple-grade grading accuracy rate and real-time performance. A portion of the improved YOLOv5 feature extraction layer was visualized to show the features extracted by different convolutional layers, enhancing the interpretability of the apple grading model in this paper.
- (2)
- An automatic apple grader was developed and designed, and the grading method in this paper was experimentally verified on an automatic apple grading machine platform. The experimental results showed that the grading accuracy of the grading method on the automatic apple grader reached 93%, with an average grading speed of four apples/sec. It has high accuracy and real-time performance, which can meet the grading needs of farmers and small and medium-sized enterprises in the field and has practical application in the apple grading industry.
Author Contributions
Funding
Institutional Review Board Statement
Data Availability Statement
Conflicts of Interest
References
- Tian, Y.N.; Yang, G.D.; Wang, Z.; Wang, H.; Li, E.; Liang, Z.Z. Apple detection during different growth stages in orchards using the improved YOLO-V3 model. Comput. Electron. Agric. 2019, 157, 417–426. [Google Scholar] [CrossRef]
- Zhu, D.S.; Ren, X.J.; Wei, L.; Cao, X.H.; Ge, Y.; Liu, H.; Li, J.R. Collaborative analysis on difference of apple fruits flavour using electronic nose and electronic tongue. Sci. Hortic. 2020, 260, 108879. [Google Scholar] [CrossRef]
- Musacchi, S.; Serra, S. Apple fruit quality: Overview on pre-harvest factors. Sci. Hortic. 2018, 234, 409–430. [Google Scholar] [CrossRef]
- Courtemanche, B.; Montpetit, B.; Royer, A.; Roy, A. Creation of a Lambertian microwave surface for retrieving the downwelling contribution in ground-based radiometric measurements. IEEE Geosci. Remote Sens. Lett. 2015, 12, 462–466. [Google Scholar] [CrossRef]
- Abdullah, M.Z.; Mohamad-Saleh, J.; Fathinul-Syahir, A.S.; Mohd-Azemi, B.M.N. Discrimination and classification of fresh-cut starfruits using automated machine vision system. J. Food Eng. 2006, 76, 506–523. [Google Scholar] [CrossRef]
- Marchant, J.A.; Onyango, C.M.; Street, M.J. High speed sorting of potatoes using computer vision. ASAE Pap. 1988, 88, 3540. [Google Scholar]
- Moallem, P.; Serajoddin, A.; Pourghassem, H. Computer vision-based apple grading for golden delicious apples based on surface features. Inf. Processing Agric. 2017, 4, 33–40. [Google Scholar] [CrossRef] [Green Version]
- Gui, J.S.; Zhang, Q.; Hao, L. Apple shape classification method based on wavelet moment. Sens. Transducers 2014, 178, 182–187. [Google Scholar]
- Fan, S.X.; Li, J.B.; Zhang, Y.H.; Tian, X.; Wang, Q.Y.; He, X.; Zhang, C.; Huang, W.Q. On line detection of defective apples using computer vision system combined with deep learning methods. J. Food Eng. 2020, 286, 110102. [Google Scholar] [CrossRef]
- Raikar, M.M.; Meena, S.M.; Kuchanur, C.; Girraddi, S.; Benagi, P. Classification and grading of Okra-ladies finger using deep learning. Procedia Comput. Sci. 2020, 171, 2380–2389. [Google Scholar] [CrossRef]
- Luna, R.; Dadios, E.P.; Bandala, A.A.; Vicer, R.R.P. Tomato fruit image dataset for deep transfer learning-based defect detection. In Proceedings of the 2019 IEEE International Conference on Cybernetics and Intelligent Systems and IEEE Conference on Robotics, Automation and Mechatronics, Bangkok, Thailand, 18–20 November 2019; pp. 356–361. [Google Scholar]
- Cubero, S.; Aleixos, N.; Albert, F.; Torregrosa, A.; Ortiz, C.; Garcia-Navarrete, O.; Blasco, J. Optimised computer vision system for automatic pre-grading of citrus fruit in the field using a mobile platform. Precis. Agric. 2014, 15, 80–94. [Google Scholar] [CrossRef] [Green Version]
- Baigvand, M.; Banakar, A.; Minaei, S.; Khodaei, J.; Behroozi-Khazaei, N. Machine vision system for grading of dried figs. Comput. Electron. Agric. 2015, 119, 158–165. [Google Scholar] [CrossRef]
- GB/T 10651—2008; Fresh apple General Administration of Quality Supervision, Inspection and Quarantine of the People’s Republic of China. Standardization Administration of PRC (SAC): Beijing, China, 2008.
- Chen, Z.Y.; Wu, R.H.; Lin, Y.Y.; Li, C.Y.; Chen, S.Y.; Yuan, Z.E.; Chen, S.W.; Zou, X.J. Plant disease recognition model based on improved YOLOv5. Agronomy 2022, 12, 365. [Google Scholar] [CrossRef]
- Xu, X.W.; Zhang, X.L.; Zhang, T.W. Lite-YOLOv5: A lightweight deep learning detector for on-board ship detection in large-scene sentinel-1 SAR images. Remote Sens. 2022, 14, 1018. [Google Scholar] [CrossRef]
- Lv, J.D.; Xu, H.; Han, Y.; Lu, W.B.; Xu, L.M.; Rong, H.L.; Yang, B.A.; Zou, L.; Ma, Z.H. A visual identification method for the apple growth forms in the orchard. Comput. Electron. Agric. 2022, 197, 106954. [Google Scholar] [CrossRef]
- Jagtap, A.D.; Kawaguchi, K.; Karniadakis, G.E. Adaptive activation functions accelerate convergence in deep and physics-informed neural networks. J. Comput. Phys. 2020, 404, 109136. [Google Scholar] [CrossRef] [Green Version]
- Li, S.; Wang, Y.H.; Feng, C.Y.; Zhang, D.; Li, H.Z.; Huang, W.; Shi, L. A thermal imaging flame-detection model for firefighting robot based on YOLOv4-F model. Fire 2022, 5, 172. [Google Scholar] [CrossRef]
- Li, Y.M.; Zhang, J.; Hu, Y.; Zhao, Y.N.; Cao, Y. Real-time safety helmet-wearing detection based on improved YOLOv5. Comput. Syst. Sci. Eng. 2022, 43, 1219–1230. [Google Scholar] [CrossRef]
- Wang, Y.N.; Fu, G.Q. A novel object recognition algorithm based on improved YOLOv5 model for patient care robots. Int. J. Hum. Robot. 2022, 19, 2250010. [Google Scholar] [CrossRef]
- Lv, H.F.; Lu, H.C. Research on traffic sign recognition technology based on YOLOv5 algorithm. J. Electron. Meas. Instrum. 2021, 35, 137–144. [Google Scholar]
- Ji, W.; Gao, X.X.; Xu, B.; Pan, Y.; Zhang, Z.; Zhao, D. Apple target recognition method in complex environment based on improved YOLOv4. J. Food Process Eng. 2021, 44, e13866. [Google Scholar] [CrossRef]
- Ji, W.; Peng, J.Q.; Xu, B.o.; Zhang, T. Real-time detection of underwater river crab based on multi-scale pyramid fusion image enhancement and MobileCenterNet model. Comput. Electron. Agric. 2023, 204, 107522. [Google Scholar] [CrossRef]
- Zheng, Z.; Wang, P.; Liu, W.; Li, J.Z.; Ye, R.G.; Ren, D.W. Distance-IoU Loss: Faster and better learning for bounding box re–gression. In Proceedings of the 34th AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 December 2020. [Google Scholar]
- Chen, W.; Zhang, J.F.; Guo, B.Y.; Wei, Q.Y.; Zhu, Z.Y. An apple detection method based on des-YOLO v4 algorithm for harvesting robots in complex environment. Math. Probl. Eng. 2021, 2021, 7351470. [Google Scholar] [CrossRef]
- Guo, S.Y.; Li, L.L.; Guo, T.Y.; Cao, Y.Y.; Li, Y.L. Research on mask-wearing detection algorithm based on improved YOLOv5. Sensors 2022, 22, 4933. [Google Scholar] [CrossRef] [PubMed]
- Ji, W.; Pan, Y.; Xu, B.; Wang, J.C. A real-time apple targets detection method for picking robot based on ShufflenetV2-YOLOX. Agriculture 2022, 12, 856. [Google Scholar] [CrossRef]
- Yao, J.; Qi, J.M.; Zhang, J.; Shao, H.M.; Yang, J.; Li, X. A real-time detection algorithm for kiwifruit defects based on YOLOv5. Electronics 2021, 10, 1711. [Google Scholar] [CrossRef]
- Jung, H.K.; Choi, G.S. Improved YOLOv5: Efficient object detection using drone images under various conditions. Appl. Sci. 2022, 12, 7255. [Google Scholar] [CrossRef]
- Wang, C.; Zhang, X.F.; Liu, C.; Zhang, W.; Tang, Y. Detection method of wheel hub weld defects based on the improved YOLOv3. Opt. Precis. Eng. 2021, 29, 1942–1954. [Google Scholar] [CrossRef]
- Shin, H.C.; Roth, H.R.; Gao, M.C.; Lu, L.; Xu, Z.Y.; Nogues, I.; Yao, J.H.; Mollura, D.; Summers, R.M. Deep convolutional neural networks for computer-aided detection: CNN architectures, dataset characteristics and transfer learning. IEEE Trans. Med. Imaging 2016, 35, 1285–1298. [Google Scholar] [CrossRef] [Green Version]
- Zhou, T.; Yu, Z.T.; Cao, Y.; Bai, H.Y.; Su, Y. Study on an infrared multi-target detection method based on the pseudo-two-stage model. Infrared Phys. Technol. 2021, 118, 103883. [Google Scholar] [CrossRef]
- Chang, Y.H.; Zhang, Y.Y. Deep learning for clothing style recognition using YOLOv5. Micromachines 2022, 13, 1678. [Google Scholar] [CrossRef]
- Ji, W.; Cui, X.; Xu, B.; Ding, S.H.; Ding, Y.; Peng, J.Q. Cross-coupled control for contour tracking error of free-form curve based on fuzzy PID optimized by improved PSO algorithm. Meas. Control. 2022, 55, 807–820. [Google Scholar] [CrossRef]
- Raza, T.Z.; Lang, W.; Jedermann, R. Integration of wireless sensor networks into industrial control systems. In Dynamics in Logistics; Springer: Cham, Switzerland, 2017; pp. 209–218. [Google Scholar]
- Cai, W.Z.; Tian, J.Y.; Wang, S.Y.; Li, J.F.; Yang, S.Q. Research of joint virtual commissioning of robotic grinding based on NX MCD and TIA. Mod. Manuf. Eng. 2022, 7, 37–42. [Google Scholar]
Index | Quality Grade | |||
---|---|---|---|---|
Projects | Grade-1 | Grade-2 | Grade-3 | |
Ripeness | Bright red or dark red | Greenish red | Greenish yellow | |
Fruit shape | No deformities | No deformities | deformities | |
defects | NO | NO | Area not exceeding 4 cm² | |
diameter(Maximum cross-sectional diameter)/mm | ≥70 | ≥70 | ≥65 |
Computer Configuration | Specific Parameters |
---|---|
CPU | Intel i7-9750k |
GPU | NVIDIA GTX1660Ti(16G) |
Operating system | Windows 10-x64 |
Random Access Memory | DDR4 32G (8G*4) |
CUDA | CUDA 10.3 |
Index | Precision | Recall | mAP @0.5 | FPS(f/s) | |||||
---|---|---|---|---|---|---|---|---|---|
Models | Grade-1 | Grade-2 | Grade-3 | Grade-1 | Grade-2 | Grade-3 | |||
SSD | 0.812 | 0.612 | 0.884 | 0.926 | 0.645 | 0.895 | 0.789 | 34.78 | |
YOLOv4 | 0.821 | 0.656 | 0.892 | 0.862 | 0.609 | 0.923 | 0.815 | 50.42 | |
YOLOv5s | 0.938 | 0.692 | 0.991 | 0.950 | 0.655 | 0.993 | 0.879 | 56.64 | |
Im-YOLOv5 | 0.951 | 0.806 | 0.992 | 0.952 | 0.751 | 0.995 | 0.906 | 59.63 |
Grade | Manual Grading Results | Equipment Grading Results | Consistency Rates | Completions Time(/s) |
---|---|---|---|---|
RP-grade-1 | 100 | 92 | 92% | 27 |
RP-grade-2 | 100 | 88 | 88% | 27 |
RP-grade-3 | 100 | 100 | 100% | 27 |
Accuracy | 93% | 81 |
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. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Xu, B.; Cui, X.; Ji, W.; Yuan, H.; Wang, J. Apple Grading Method Design and Implementation for Automatic Grader Based on Improved YOLOv5. Agriculture 2023, 13, 124. https://doi.org/10.3390/agriculture13010124
Xu B, Cui X, Ji W, Yuan H, Wang J. Apple Grading Method Design and Implementation for Automatic Grader Based on Improved YOLOv5. Agriculture. 2023; 13(1):124. https://doi.org/10.3390/agriculture13010124
Chicago/Turabian StyleXu, Bo, Xiang Cui, Wei Ji, Hao Yuan, and Juncheng Wang. 2023. "Apple Grading Method Design and Implementation for Automatic Grader Based on Improved YOLOv5" Agriculture 13, no. 1: 124. https://doi.org/10.3390/agriculture13010124
APA StyleXu, B., Cui, X., Ji, W., Yuan, H., & Wang, J. (2023). Apple Grading Method Design and Implementation for Automatic Grader Based on Improved YOLOv5. Agriculture, 13(1), 124. https://doi.org/10.3390/agriculture13010124