Measuring the kyphotic angle (KA) and lordotic angle (LA) on lateral radiographs is important to truly diagnose children with adolescent idiopathic scoliosis. However, it is a time-consuming process to measure the KA because the endplate of the upper thoracic vertebra is normally difficult to identify. To save time and improve measurement accuracy, a machine learning algorithm was developed to automatically extract the KA and LA. The accuracy and reliability of the T1-T12 KA, T5-T12 KA, and L1-L5 LA were reported. A convolutional neural network was trained using 100 radiographs with data augmentation to segment the T1-L5 vertebrae. Sixty radiographs were used to test the method. Accuracy and reliability were reported using the percentage of measurements within clinical acceptance (≤9°), standard error of measurement (SEM), and inter-method intraclass correlation coefficient (ICC 2,1 ). The automatic method detected 95 % (57/60), 100 %, and 100 % for T1-T12 KA, T5-T12 KA, and L1-L5 LA, respectively. The clinical acceptance rate, SEM, and ICC 2,1 for T1-T12 KA, T5-T12 KA, and L1-L5 LA were (98 %, 0.80°, 0.91), (75 %, 4.08°, 0.60), and (97 %, 1.38°, 0.88), respectively. The automatic method measured quickly with an average of 4 ± 2 s per radiograph and illustrated how measurements were made on the image, allowing verifications by clinicians.