Retinal vessel segmentation has important application value in clinical diagnosis. If experts manually segment the retinal vessels, the workload is heavy, and the result is strong subjectively. However, some existing automatic segmentation methods have the problems of incomplete vessel segmentation and low‐segmentation accuracy. In order to solve the above problems, this study proposes a retinal vessel segmentation method based on task‐driven generative adversarial network (GAN). In the generative model, a U‐Net network is used to segment the retinal vessels. In the discriminative model, multi‐scale discriminators with different receptive fields are used to guide the generative model to generate more details. On the other hand, in view of the uncontrollable characteristics of the data generated by the traditional GAN, a task‐driven model based on perceptual loss is added to traditional GAN for feature matching, which makes the generated image more task‐specific. Experimental results show that the accuracy, sensitivity, specificity and area under the receiver operating characteristic curve of the proposed method on data set digital retinal images for vessel extraction are 96.83, 80.66, 98.97 and 0.9830%, respectively.