Artificial intelligence is a computer technology that has attracted considerable attention in recent years. As computer equipment has become increasingly advanced, deep learning in the field of artificial intelligence has made breakthroughs. In recent years, the use of deep learning in the medical field has contributed to many issues of efficiency and accuracy. Regardless of the excellent results in radiology, pathology, endoscopy, ultrasound, and biochemical examination, in this study, we used deep learning as a tool to identify spinal canals and spinal foramen stenosis. Based on previous studies, new techniques, such as erosion and expansion, were added to make the results more accurate, and provide area, IoU and other indicators for evaluation. This paper not only applies the latest computer science and information engineering technology--deep learning to medicine, but also uses a breakthrough network model to improve the recognition effect.Use quantitative indicators to make results more reliable. In this study, we compared two network architecture, Resnet50 and VGG16, to identify the spinal canal and intervertebral foramen. Resnet50 had quite good results in IoU, which were 77.4% and 80.9% in spinal canal and intervertebral foramen, respectively.