The choroidal vascularity index (CVI) is a new biomarker defined for retinal optical coherence tomography (OCT) images for measuring and evaluating the choroidal vascular structure. The CVI is the ratio of the choroidal luminal area (LA) to the total choroidal area (TCA). The automatic calculation of this index is important for ophthalmologists but has not yet been explored. In this study, we proposed a fully automated method based on deep learning for calculating the CVI in three main steps: 1—segmentation of the choroidal boundary, 2—detection of the choroidal luminal vessels, and 3—computation of the CVI. The proposed method was evaluated in complex situations such as the presence of diabetic retinopathy and pachychoroid spectrum. In pachychoroid spectrum, the choroid is thickened, and the boundary between the choroid and sclera (sclerochoroidal junction) is blurred, which makes the segmentation more challenging. The proposed method was designed based on the U-Net model, and a new loss function was proposed to overcome the segmentation problems. The vascular LA was then calculated using Niblack’s local thresholding method, and the CVI value was finally computed. The experimental results for the segmentation stage with the best-performing model and the proposed loss function used showed Dice coefficients of 0.941 and 0.936 in diabetic retinopathy and pachychoroid spectrum patients, respectively. The unsigned boundary localization errors in the presence of diabetic retinopathy were 3 and 20.7 μm for the BM boundary and sclerochoroidal junction, respectively. Similarly, the unsigned errors in the presence of pachychoroid spectrum were 21.6 and 76.2 μm for the BM and sclerochoroidal junction, respectively. The performance of the proposed method to calculate the CVI was evaluated; the Bland–Altman plot indicated an acceptable agreement between the values allocated by experts and the proposed method in the presence of diabetic retinopathy and pachychoroid spectrum.