Diagnosing the nitrogen content of cotton using model pruning
-
-
Abstract
Cotton nitrogen deficiency can seriously reduce the grain yield and quality. It is the prerequisite condition to detect the nitrogen nutrition level of cotton, and then implement the accurate fertilization and foundation. Traditional diagnostic technology cannot fully meet the large-scale production in recent years, due to the destructive, time-consuming and labor consuming. Artificial intelligent (AI) technology can be expected to identify the nitrogen nutrient level of cotton in a shorter period of time without any breakage to the cotton. Among them, deep learning has been gradually applied to the diagnosis of the nitrogen nutrition level of crops, due to its automation, high accuracy, and robustness. But the high dependence on high-performance devices has limited the deployment and application of resource-constrained edge devices. In this study, a Raspberry Pi 4B-based model was proposed to diagnose the nitrogen nutrient level of cotton. The data was collected at different nitrogen levels (0, 72, 144, 192, and 240 kg/hm2) during the bolling stage. The images were converted from the RGB to HSI color space. The overexposed or underexposed noises in the images were adjusted to make the features clearer using the gamma function (Gamma). Random flip, rotation and mirroring were also utilized for data enhancement. The final dataset with 5780 images was randomly divided into training, validation and test sets, according to the ratio of 8:1:1. The ResNet101 network was used to construct the diagnostic model, due to the special structure and powerful performance. The model was also pruned and optimized by the network thinning. A comparison was made on the model accuracy, the number of parameters, FLOPs, and model storage volume of the models with different pruning ratios. The results showed that the model with a pruning ratio of 87% was suitable for diagnostic modeling. The model with 87% was suitable to be deployed on Raspberry Pi 4B with limited resources; The model inference time was shortened from 3.22 to 0.91s when the model was converted from PyTorch to ONNX format. Raspberry Pi 4B was ported for the inference with ONNX Runtime. The experimental results show that when the model pruning ratio reached 87%, the loss of model accuracy was 2.55%, while the number of model parameters, FLOPs, and storage volume were 4.37 M, 1.05 G, and 16.65 MB, respectively. The inference speed of the model was significantly improved on the equipment with limited computing power. The nitrogen nutritional status of cotton was rapidly and accurately assessed in the field. The precise application of nitrogen to cotton was realized in this case. Thus, the accurate fertilization of cotton was realized to improve the yield and quality. This finding can provide a technical reference to realize the rapid diagnosis of the nitrogen nutrition level of cotton over a large area. A strong reference was also offered for the research and development of intelligent terminal equipment to detect the crop nutrition level.
-
-