The structure of heavy nuclei is difficult to disentangle in high-energy heavy-ion collisions. The deep convolution neural network (DCNN) might be helpful in mapping the complex final states of heavy-ion collisions to the nuclear structure in the initial state. Using DCNN for supervised regression, we successfully extracted the magnitude of the nuclear deformation from event-by-event correlation between the momentum anisotropy or elliptic flow (\(v_2\)) and total number of charged hadrons (\(dN_{\rm ch}/d\eta\)) within a Monte Carlo model. Furthermore, a degeneracy is found in the correlation between collisions of prolate-prolate and oblate-oblate nuclei. Using the Regression Attention Mask algorithm which is designed to interpret what has been learned by DCNN, we discovered that the correlation in total-overlapped collisions is sensitive to only large nuclear deformation, while the correlation in semi-overlapped collisions is discriminative for all magnitudes of nuclear deformation. The method developed in this study can pave a way for exploration of other aspects of nuclear structure in heavy-ion collisions.