Abstract:Abstract: Measuring pod number per plant has been one of the most important parts of the pod selection in the soybean growth period. However, traditional manual measurement is costly, time-consuming, and error-prone. Alternatively, artificial intelligence can ever-increasing be used to determine the type and quantity of each pod, thereby accurately predicting soybean yield in modern agriculture. In this study, a soybean phenotyping instrument was employed to collect the phenotype video of soybean plants, and then to process the phenotype data using the YOLOv4 dynamic object detection. The size of the initial anchor box and the complexity of image objects were also considered during the data set training and testing. Specifically, the COCO data set was selected for the prior box in the YOLOv4 model. The size of the objects varied in each category. K-means clustering was selected to adjust the size of original prior box for a higher accuracy of pod recognition. The size and position of container were calculated to test the original anchor frame suitable for pod detection. Accordingly, a total of 9 initial anchor frames were obtained. The average and maximum pooling operations of the global channel information were adopted to obtain the new weights and re-weighed the new weights to generate the output of module, in order to accurately locate pods for the better characterization ability of detection model. The improved attention mechanism module was integrated into the last layer of the backbone network in the YOLOv4 object detection. Migration learning was also utilized to pre-train the neural network for the optimal detection model in the prediction of test set. The experiment was performed on the Pytorch framework under the GPU (Nvidia GeForce RTX 2080 Ti). The parallel computing framework of CUDA10.1 and CUDNN deep neural network acceleration library were used to train the original and the improved YOLOv4 on Linux operating system. Experiment results showed that the improved model greatly improved the accuracy of pod detection. The mean average precision for all categories was 80.55%, 5.67 percentage points higher than the original. The average accuracy rate reached 84.37% after data expansion, The average prediction of the pod with two beans effectively reached 99.46%, indicating more suitable for pod detection. Consequently, the improved model can more accurately identify the most categories that the original model cannot recognize. Some errors were also corrected in the predictions for a better confidence score. In the recognition of pods on a simple background, the prediction mean average precision of the improved model reached 99.1%, 1.81 percentage points higher than the original. More importantly, the improved model presented strong generalization ability and detection performance. The data acquisition was 30-40 times the speed of traditional ones. Moreover, the soybean phenotype instruments performed better to greatly save the human and material resources using the improved model.