The ability to detect atoms in high spatiotemporal resolution provides a powerful tool for us to investigate the quantum properties of ultracold quantum gases. Plenty of useful imaging methods, including absorption imaging, phase contrast imaging and fluorescence imaging, have been implemented in detecting atoms. Among them, absorption imaging is the most widely used method in cold atoms laboratory. However, the traditional absorption imaging method is affected by perturbations such as interference between optical elements, fluctuation of laser power, frequency, and spatial position, resulting in residual spatially structured noise and degradation of imaging quality. Especially for regions with lower density or for longer time-of-flight, a large number of repetitions are often required to obtain better signal-to-noise ratio, which would increase the time cost and induce other noise. One must reduce the time between two imaging pulses to suppress the spatial noise. A better charge coupled device (CCD) with higher frame transfer rate or other method like fast-kinetic mode will be used to improve the imaging quality. In this paper, a single-shot cold atom imaging method based on machine learning is proposed, in which only one absorption imaging of cold atoms is required, and the corresponding background image can be generated through the neural network of an autoencoder. This effectively reduces the spatial striped noise in imaging, significantly improves the imaging quality, and makes it possible for cold atoms to be imaged multiple times in a single cycle.