# Automated Chest X-Ray Diagnosis Report Generation with Cross-Attention Mechanism
## 5 Conclusions  
This paper proposes a neural network model for the task of automatically generating chest X-ray diagnostic reports, aiming to solve two key challenges faced in this task: data bias and granularity of image and text modality matching. Data bias is a common phenomenon in chest X-ray image data, and is manifested in the serious imbalance between the ratio of normal and abnormal areas. The number of normal samples and their corresponding diagnostic reports in the dataset far exceeds that of abnormal samples. This data imbalance affects the performance of the model. To address this problem, we integrated the convolutional block attention module (CBAM) into the ResNet network structure, so that the visual feature extractor can dynamically assign attention weights to the channels and spatial dimensions of the input image, significantly improving the model's ability to focus on abnormal areas. This improvement enables the model to more accurately capture the key areas in the image and effectively suppress the interference of irrelevant areas on the model, thereby alleviating the negative impact of data bias. In terms of the granularity of image and text modality matching, traditional methods can often only achieve coarse-grained image-text correspondence, resulting in a lack of correspondence at the detail level between chest X-ray images and generated diagnostic reports. To this end, we introduced a cross-attention mechanism, which achieves implicit alignment between the two modalities by calculating the cosine similarity between image features and text sequences. This mechanism can automatically learn the correlation between image features and text information during training, enabling the model to more accurately match abnormal areas in the image with the description content in the diagnostic report, enhancing the semantic relevance between image and text data, thereby improving the accuracy and coherence of report generation. Through experimental verification and result analysis on the IU-X-ray dataset, our model shows good performance in all indicators, especially in alleviating data bias and improving the accuracy of image and text alignment. The visual feature extractor integrated with CBAM effectively improves the model's ability to recognize key areas and significantly improves the attention effect of abnormal areas; the cross-attention mechanism further promotes the deep fusion between images and text, making the generated diagnostic reports more accurate and in line with clinical expression requirements. Compared with existing mainstream methods, our method has achieved advantages in evaluation indicators such as BLEU-2, METEOR, and ROUGE-L, verifying the effectiveness of the model in the task of diagnostic report generation. In summary, the innovative network model proposed in this study effectively solves the data bias problem and modality matching granularity problem in chest X-ray diagnosis report generation by improving the visual feature extractor and introducing the cross-attention mechanism, providing new ideas and technical support for improving the quality of automated diagnosis report generation. In future work, we will further optimize the attention mechanism, explore more advanced language modeling methods, and improve the model's ability to generate long sentences and capture complex abnormal features. Conceptualization, W.Y. ; methodology, W.Y. ; software, W.Y. ; validation, W.Y., L.S. ([PERSON]) and L.S. ([PERSON]); formal analysis, W.Y. ; investigation, W.Y. and C.W. ; resources, J.Z. ; data curation, L.S. ([PERSON]); writing--original draft preparation, W.Y. ; writing--review and editing, J.Z. and Z.K. ; visualization, W.Y. and Q.H. ; supervision, J.Z. and Z.K. ; project administration, J.Z. ; funding acquisition, J.Z. All authors have read and agreed to the published version of the manuscript. This work was supported by the Education Department of Jilin Province (No. JKH20230673 KJ). Not applicable.