Neural network algorithms and intelligent algorithms are hot topics in the field of deep learning. In this study, the neural network algorithm and intelligence are optimized, and it is used in simulation experiments to improve the target image recognition ability of the algorithm in the machine vision environment. First, this paper introduces the application of neural networks in the field of machine vision. Second, in the experiment, the improved VGG-16 convolutional neural network (CNN) model is applied to metal block defect detection. Experimental results show that the optimized network can classify metal block defects with the maximum accuracy of 99.28%. Then, the intelligent algorithm based on neural network is studied, and the CIFAR-10 data set is taken as the experimental target for training test and verification test. Using BP algorithm, particle swarm optimization algorithm (PSO-BP), and improved neural network algorithm, respectively, the convergence speed of ICS algorithm based on BP neural network is compared. In contrast, ICS-BP algorithm has the fastest convergence speed and converges when the number of iterations is 32, followed by PSO-BP algorithm.