Aiming at the problems of large scale changes of the lesion area, blurred edges, and low contrast between polyps and normal tissues in the image segmentation of colorectal polyps, which lead to low segmentation accuracy of lesion areas and artifacts in the segmentation boundary, an automatic segmentation algorithm combining Swin Transformer and graph-line reasoning is proposed. To adapt to the network, the network first uses the Swin Transformer encoder to extract the global context information of the input image layer by layer, and analyzes the salient characteristics of the lesion area at multiple scales. The second is to propose a local global feature interaction module to enhance the network's spatial perception of complex lesions and highlight the key location information of the target to be segmented. The third is to use the region-guided graph reasoning module to mine the high-order explicit relationship between prior information in the way of graph cycle reasoning. The fourth is to design an edge-constrained graph reasoning module oriented to edge details, which integrates edge details and improves the segmentation effect. Experiments were carried out on the CVC-ClinicDB, Kvasir, CVC-ColonDB and ETIS datasets, the Dice coefficients were 0.939, 0.926, 0.810 and 0.788, and the average cross-merge ratios were 0.889, 0.879, 0.731 and 0.710 respectively. There is a way. Simulation results show that the segmentation accuracy is high for colorectal polyp images with complex morphology, low contrast and blurred edges.