Since the contact line equation is a transcendental equation, the relationship between the installation angle and the shape could not be expressed by explicit functions, which made it difficult to obtain the optimal shape, this paper firstly took three evaluation parameters of the shape, overrun, shift and offset as the objective function as well as the installation angle as variables the contact line optimization model was establish. Secondly, a neural network was introduced to solve the evaluation parameters. Through training the neural network by setting the installation angle as the input, the evaluation parameters as the output, the results show that the trained neural network can respond correctly, and has the advantages which the other method do not obtain. As an example of end relief modified helical gear, the results shows that the method can reduce the grinding errors effectively. Finally, the grinding experiments proven the effectiveness of the method.