Anomalies such as microaneurysms, exudates, and hemorrhages are diagnosed by retinal vessel segmentation to identify different phases of Diabetic Retinopathy (DR); several typical ways to detect Hard Exudates (HE) in retinal images have been used to determine the severity of diabetes. This work proposes a hybrid approach to better segment such abnormal cells. It optimizes the learning parameters of a Convolutional Neural Network (CNN) with a nature-inspired optimizer, the Self-Adaptive Jaya Optimization Algorithm (SAJOA). The SAJOA helps in avoiding trapping in local minima. It uses the SAJOA to steer the search for obtaining near-optimal parameter values for the CNN training. We choose the learning parameters such as batch size, dropout rate, learning rate, etc. The batch size affects the batch normalization performance, and the dropout rate involves the regularization property of the model. The near-optimal values of these two parameters help improve the generalization ability of the deep learning architecture. Thus, this hybrid approach improves the CNN performance and generalizability, leading to precise segmentation of unseen data, which aids in diagnosing diabetic retinopathy. The results of many trials were evaluated against the DRIVE dataset; the proposed method achieved accuracy and F1 score on average, higher by 7 to 8% than the state-of-the-art methods.