AUTHOR=Zhang Guangwei , Wang Zhichao , Liu Bo , Gu Limin , Zhen Wenchao , Yao Wei TITLE=A density map-based method for counting wheat ears JOURNAL=Frontiers in Plant Science VOLUME=Volume 15 - 2024 YEAR=2024 URL=https://www.frontiersin.org/journals/plant-science/articles/10.3389/fpls.2024.1354428 DOI=10.3389/fpls.2024.1354428 ISSN=1664-462X ABSTRACT=Wheat production is closely related to national food security. Traditional manual counting methods for wheat ears are susceptible to subjective factors and are inefficient. Moreover, dense wheat ears often lead to duplicate counts. The segmentation and counting of dense wheat ears face multiple challenges: mutual occlusion between ears, irregular shapes, different maturity levels, and the presence of weeds that can be easily confused with ears. In this paper, we propose a robust segmentation model based on the density map mechanism for the dense wheat ear counting problem. The mechanism we designed strengthens our model's perception of wheat ear regions, allowing it to better differentiate between ears and background elements like stems and leaves. Firstly, we optimize the Convolutional Block Attention Module (CBAM) by replacing the pooling layer with Generalized Mean Pooling (GeM) and integrate it into the You Only Look At CoefficienTs(YOLACT) framework. By adjusting the hyperparameters of GeM pooling, greater flexibility is provided, allowing for adaptive pooling based on the varying densities of target scenes. This enables the model to focus more on relevant features, thereby enhancing performance in counting dense targets. Through optimizing attention distribution, target areas can be captured more effectively, leading to better feature extraction in dense scenes. The model refines features and pays closer attention to wheat ear information. Lastly, the density map mechanism is introduced. Our approach imposes loss on feature maps and conducts back propagation, enabling the model to utilize density information and adaptively adjust detection strategies, gaining better insights into the distribution of targets in dense scenes. This mechanism helps to reduce both missed detections and false alarms, ultimately improving counting accuracy. Specifically, compared to the original YOLACT model, introducing the attention mechanism and the density map mechanism reduces the root mean square error (RMSE) from 1.83 to 1.29, with respective reductions of 0.26 and 0.28. The coefficient of determination (R2) also increases from 0.9516 to 0.9798, indicating a significant performance improvement. This research method can address issues such as missed detections due to wheat ear occlusion in dense scenes, providing a valuable reference for practical wheat yield prediction in agricultural production.