# Automatic Tooth Detection and Numbering Using a Combination of a CNN and Heuristic Algorithm
## 3 Materials and Methods  
### Study Design  
Based on previous research results, we propose an algorithm that can recognize the regions of the teeth and classify them using DPR images during the training process. To achieve this, we also propose methods to obtain images for training purposes. The images obtained were labeled, and the objects within the images were detected using a Single Shot Multibox Detector (SSD) and a regional convolutional neural network (RCNN) algorithm. These images were classified again using a heuristic algorithm [23]. The dataset used in this study is composed of 303 anonymized DPR images. The equipment models used for acquiring the DPR images were Vatech PaX-i, HDX Will, and Rayscan. Dislocated teeth and late residual teeth are not covered in this study. The reason for this is that we did not have sufficient data for these two categories of teeth, and hence, classification would be difficult. Therefore, images containing dislocated teeth and late residual teeth were excluded from this study. The overall research design flow is presented in Figure 1. The DPR images were divided into 253 training sets and 50 test sets. Each data entry was labeled with dental objects (implant fixture, crown, tooth), and numbered by three dentists. We then developed two algorithms using a CNN and a faster RCNN, object detection, and tooth classification algorithms, respectively. Figure 2 shows the flow of this study for implementing a heuristic algorithm for tooth and implant detection and numbering. The primary task is to locate areas related to the teeth or implant fixtures in the given X-ray image. To achieve this, an object detection technique, which is frequently used in the field of image recognition, was used. The technique applied to conduct the training process is called a faster RCNN algorithm. Among the various learning models, the learning model we used was the Faster RCNN Inception v3 architecture developed by Google. During the training process, the objects were divided into three labels: teeth, crowns, and implant fixtures. Faster RCNN is a method that derives better accuracy than existing object detection algorithms by extracting image features and minimizing noise for image analysis. Faster-RCNN is composed of a  
Figure 1: (**a**) Sample DPR image and (**b**) study report. Figure 2: Study flow of teeth and implant detection. convolution feature map and ROI feature vector. The convolution feature map delivers images to the convolution and max-pooling layers, and the received information is placed as features in the ROI feature vector map. It is converted to a map with various features and moved to fully connected layers (FCs) to determine the object value of the image for the object of the K class. In this process, through the loss function, the multi-task loss is minimized, and the learning accuracy is increased. In Equation (1), i represents the index value of the anchor, and \(p_{i}\) is an object or a value predicting whether it is a background. \(p_{i}^{*}\) is 1 if the value is an object, and 0 if it is an object. Here, the object is detected through the loss function \(L_{cls}\) and smooth L1 loss function values \(L_{reg}\) and normalization mini-batch values \(N_{cls}\) normalization anchor location value \(N_{reg}\) values between classes [24]. \[\text{L}(\{p_{i}\},\{t_{i}\})=\frac{1}{N_{cls}}\sum_{i}L_{cls}\Big{(}p_{i},p_{i }^{*}\Big{)}+\lambda\frac{1}{N_{reg}}\sum_{i}p_{i}^{*}L_{reg}(t_{i},t_{i}^{*}) \tag{1}\]  
An SSD simultaneously performs the bounding box and class prediction while processing an image in a single shot. The SSD works well on low-resolution images, derives output through each multi-feature map, and predicts bounding box and class scores through appropriate convolution operations on each feature map. Therefore, the SSD is represented by the predicted value for the class and the predicted value for the bounding box.