Automated analysis of retinal images is a crucial diagnostic method for the early detection of disorders affecting the eyes, such as glaucoma, diabetic macula edema (DME), and retinopathy brought on by diabetes. The current study introduces a reliable technique for segmenting and detecting optic discs using a deep learning-based technique. This is comparable to the initial stage of creating a diagnostic system supported by a computer for diabetic macula edema in retinal images. The suggested approach is predicated on the recommended approach using the YOLO (You Only Look Once) algorithm for detection objects and segmentation for bounding boxes that belong to the same category, comparing the Intersection over Union (IOU) values of each bounding box with those of the others. If IOU values are higher than thresholds, they will consider them the same targets and maintain the boundary boxes with the highest reliability. Three retinal image databases that are accessible to the public are used to quantitatively assess the technique: Messidor-1, Messidor-2, and the IDRID Database. The technique yields a success rate of 99.5% for optic disc identification, a precision of 99.9%, and a recall of 100% for Messidor-1, and testing for all Messidor-2 and IDRID databases accepts accuracy of 99.1% and 98.7% respectively. When it comes to the identification and border extraction of the optic disc, this special technique has demonstrated a notable improvement over the previous approach.