Retinal optic disk (OD) fundus imaging is a valuable tool for glaucoma diagnostics, while deep learning methods are often used to assist ophthalmologists in their clinical practice. Nonetheless, the performance of deep learning-assisted OD evaluation can be severely affected by the experiment variations and the use of small samples in network training. This study proposes using a particle swarm optimization (PSO)-optimized U-Net model to automatically segment OD in fundus photographs. The PSO method is used to fine-tune the training hyperparameters, i.e., learner, number of epochs, mini-batch size, and initial learning rate, to achieve good generalization performance even with a small training dataset. The findings showed a considerably good performance of the trained model with average overlap measures of 0.93-0.96 and mean performance evaluation metrics ranging between 0.89 and 0.99, comparable with the results of the state-of-the-art methods. This study concluded that the segmentation model trained using the proposed optimization framework could potentially be used for early glaucoma detection and improve healthcare delivery.