Preterm birth presents a major challenge in perinatal care, and predicting preterm birth remains a major challenge. If preterm birth cases can be accurately predicted during pregnancy, preventive interventions and more intensive prenatal monitoring may be possible. Deep learning has the capability to extract image parameters or features related to diseases. We constructed a deep learning model to predict preterm births using transvaginal ultrasound images. Patients who were hospitalized for threatened preterm labor or shortened cervical length were enrolled. We used images of the cervix obtained via transvaginal ultrasound examination at admission to predict cases of preterm birth. We used convolutional neural networks (CNNs) and Vision Transformer (Vit) for the model construction. We compared the prediction performance of deep learning models with two human experts. A total of 59 patients were enrolled in the study, including 30 cases in the preterm group and 29 cases in the full-term group. Statistical analysis of clinical variables including cervical length showed no significant differences between the two groups. For accuracy, the best CNN model had the highest accuracy of 0.718 with an area under the curve (AUC) of 0.704, followed by Vision Transformer with accuracy of 0.645 and AUC of 0.587. The accuracy of two human experts was 0.465 and 0.517, respectively. Deep learning models have important implications for extraction of features that provide more accurate assessment of preterm birth than traditional visual assessment by the human eye.