Higher-order Hermite–Gaussian modes, characterized by their intricate spatial distribution, are garnering significant interest in domains such as precision measurement and optical communication. This paper introduces a beam shaping method that integrates the Gerchberg–Saxton algorithm with a convolutional neural network to generate the higher-order modes. Employing this approach, we successfully generated various orders of Hermite–Gaussian modes and light fields with arbitrary intensity distribution. Furthermore, a comparative assessment was undertaken, contrasting the root mean square error of the generated modes against those obtained via the Gerchberg–Saxton algorithm. The results demonstrated that our method yields a closer match between the generated and target light fields, translating to superior beam quality. This study not only enhances the theoretical underpinnings of beam shaping technology but also opens up new avenues for the application of neural networks in optics.