In order to solve problems that convolution kernel was random initialization and the gradient descent method to train convolution neural network was easy to fall into local minimum, an image recognition method based on particle swarm optimization for convolution kernel was proposed. CNN(convolution neural network) was constructed by using the parameter migration method, and convolution kernel was extracted. The particle swarm algorithm was used to update the velocity and position of particles constantly and find the global optimal value to initialize convolution kernels. Convolution kernels were transferred to convolution neural network, and lung tumor images were used to train them. CNN model was trained by lung tumor images, and gradient descent method was used to modify network weights, hence global optimization ability of PSO algorithm was combined with local search ability of gradient descent method. The experiments verified effectiveness of method through three perspectives: batch sizes, iteration numbers, and network layer numbers. The particle swarm algorithm was compared with gauss function. The recognition rates of PSO optimized convolution kernel were always higher than that of randomized convolution kernel and gauss convolution kernel, its recognition rate reached 98.3%, which had certain feasibility and superiority.