Image recognition is an important direction in computer vision. After years of research, image recognition technology has made great progress. This paper mainly studies the application of convolutional neural network (CNN) in image recognition. This paper first analyzes the basic mechanism of CNN, and on this basis, uses genetic algorithm to optimize CNN for image recognition application. Experimental results show that the optimal connection structure searched by this method can significantly improve the effect of CNN image recognition and speed up the training speed of the model.