Melanoma is considered the deadliest form of skin cancer, and the number of cases is increasing day by day. The early diagnosis of melanoma is critical, as it significantly increases the patient's chance of survival. However, distinguishing melanoma from other skin lesion types by the physician can be a complicated process due to the diversity of its structural and textural features. Numerous computer-aided diagnosis (CAD) systems have been developed to assist the physician in detecting melanoma during recent years. The segmentation is a critical step for CAD systems, as it directly contributes to the performance of both feature extraction and classification steps. The optimization of the hyperparameters of deep learning methods is a challenging research topic. In this paper, the Bayesian optimized SegNet approach is proposed for precise skin lesion segmentation. The proposed method is obtained competitive results with the latest skin lesion segmentation methods. The hyperparameters optimized SegNet has achieved the best results with the average Jaccard Index of 84.9 on ISBI2016 and 74.5 on ISBI2017 dataset. Experimental results indicate the validity of Bayesian optimized SegNet. In this study, it has been observed that the bayesian hyperparameter optimization in the SegNet, which is the latest deep learning architecture, increased the segmentation performance of the SegNet by 16% in the ISBI2016 dataset and by 7% in the ISBI2017 dataset.