Improving the spatial and spectral resolution of 2D X-ray near-edge absorption structure (XANES) has been a decade-long pursuit to probe local chemical reactions at the nanoscale. However, the poor signal-to-noise ratio in the measured images poses significant challenges in quantitative analysis, especially when the element of interest is at a low concentration. In this work, we developed a post-imaging processing method using deep neural network to reliably improve the signal-to-noise ratio in the XANES images. The proposed neural network model could be trained to adapt to new datasets by incorporating the physical features inherent in the latent space of the XANES images and self-supervised to detect new features in the images and achieve self-consistency. Two examples are presented in this work to illustrate the model’s robustness in determining the valence states of Ni and Co in the LiNixMnyCo1-x-yO2 systems with high confidence.