As the growth of science and technology, ophthalmic optical coherence tomography (OCT) image segmentation plays a key role in ophthalmic diagnosis. To improve the accuracy of segmentation, the experiment proposed an ophthalmic OCT segmentation method that combines the recurrent residual network (ResNet) and the attention mechanism (AM). In the process, the graph search (GS) algorithm is first used to perform fine segmentation operations on the OCT image, then a recurrent residual convolution network is introduced to correct the phenomenon of image drill and rapid degradation, and finally theAM is integrated to improve the utilization of the global information of the image and achieve accurate segmentation of the image. The results show that the research methodis tested on different data sets, and the research method shows the largest fitness value. There are four models, research methods, medical image segmentation technologies based on full-size connection Unet 3+(UNet 3plus),recurrent residual convolutional neural network (ResNet-RCNN) and deep learning and graphicssearch(DL-GS). The areas under the ROC curve of the four models of the patient retinal layer boundary segmentation method searching for automatic segmentation technology are 0.956, 0.911, 0.897 and 0.856 respectively. When the precision rate is 0.900, the recall rates of the four models corresponding to the research method, Unet 3+, ResNet-RCNN and DL-GS are 0.801, 0.663, 0.574 and 0.438 respectively. At the same time, the system can reach a stable state within 0.501s of the running time of the research method. When applying the research method to the segmentation of practical visual ophthalmicOCTimages,the outcomes are closer to the results of artificial expert annotation. Based on the above, the research method's segmentation accuracy and system stability are better, providing a certain reference for the optimization of image segmentation technology in the medical field.