Detecting the chiral magnetic effect via deep learning