**1. Introduction**

X-rays have been used in medical images since 1896, and they also help doctors determine whether a patient is healthy. X-rays are widely used in dental treatments [1], such as periapical radiographs (PA), bitewing radiographs (BW), and panoramic radiographs (PANO). The PA film is important in routine dental X-ray examinations because it requires lower radiation dose exposure and could identify periapical pathology efficiently. Periapical radiographs are commonly the result of trauma, caries, or tooth wear. These conditions will bring out root canal infection if the dental treatment has no intervention, and pulp necrosis may occur [2,3]. Numerous studies have confirmed that this oral problem requires prompt and thorough treatment. Otherwise, it may lead to tooth loss and repeated inflammation [4–6]. Detection of the peri-apical lesion and opportune endodontic procedure intervention can treat root canal infection caused by these problems. The PA film can capture local teeth, which can effectively and quickly enable dental professionals

**Citation:** Chuo, Y.; Lin, W.-M.; Chen, T.-Y.; Chan, M.-L.; Chang, Y.-S.; Lin, Y.-R.; Lin, Y.-J.; Shao, Y.-H.; Chen, C.-A.; Chen, S.-L.; et al. A High-Accuracy Detection System: Based on Transfer Learning for Apical Lesions on Periapical Radiograph. *Bioengineering* **2022**, *9*, 777. https://doi.org/10.3390/ bioengineering9120777

Academic Editors: Paolo Zaffino and Maria Francesca Spadea

Received: 3 October 2022 Accepted: 23 November 2022 Published: 6 December 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

to find local details of tooth lesions [7,8] and undertake the treatment [9]. Despite advances in treatment and access to extensive care, the prevalence of apical lesions remains high [10]. Dentists use PA to find diseased areas, but it is very time-consuming to find lesions that do not contrast well with normal areas. In addition, the dentist may become tired after long working hours, thereby ignoring subtle differences. In a day, a dentist must review hundreds of X-rays of a patient and diagnose and document the patient. However, the current method for detecting periapical noise still needs to be judged by the dentist. Dentists may inevitably make mistakes as the length and number of consultations increase.

With the continuous advancement of technology, artificial intelligence has shined in many industries, such as vehicle image recognition [11], smart city [12], product recommendation systems [13], and emotion recognition [14]. The development of medical imaging is also changing with each passing day. More and more cases have shown that the combination of artificial intelligence and medical imaging has good results, such as breast cancer (BC) [15], arrhythmia [16], and lung function prediction [17]. There are also related studies in dentistry, for example, adding machine learning to the color recognition of dentures [18] or adding deep learning to the detection of tooth decay [19]. Artificial intelligence was used to improve the apical lesion detection accuracy rate of the dental Panoramic Radiograph Identification System to about 75.53% in [20], while the accuracy rate of CT image identification is about 82% [21]. For clinical use, there is still a lot of room for improvement. Therefore, in order to reduce the workload of dentists and provide more objective data, this study proposes an automatic detection system for periapical radiographs using CNN transfer learning. The purpose is to improve the symptom enhancement technology in the existing technology and to analyze and compare the final research results. In [22], a system combining PA and CNN was proposed. The authors improved the classification accuracy of batch normalization by adjusting the parameters such as the layers of convolutional blocks in the CNN. The accuracy rate obtained was as high as 92.75%. This article will use this as the main reference. However, its image enhancement improvements are not outstanding. Therefore, in this proposal, the focus is on improving image segmentation and image enhancement. In order to increase the reference value of the data obtained from the Alexnet classification model, three different CNN models are constructed, namely Googlenet, Resnet50, and Resnet101 which are trained, tested, and verified through the same database. During this period, the parameters of each model were kept consistent by the control variable method which was convenient for subsequent comparison. The research in this paper also utilizes CNN technology for dentists to diagnose symptoms and ultimately provide patients with more effective and better adjuvant treatment. The innovations of this method are as follows:


The presentation structure of this proposal is as follows: Section 2 introduces the materials and methods for apical lesion detection on periapical radiographs based on transfer learning. Section 3 mainly describes and analyzes the evaluation method of the model and the experimental results. The results of the study are discussed in Section 4. Finally, the conclusions and future prospects are given in Section 5. The purpose of

this paper is to predict root apical lesions located at the base of a tooth by means of a convolutional neural network (CNN).

#### **2. Materials and Methods**

This study is divided into three parts: image cropping, image preprocessing and CNN training. The image cropping part extracts a single tooth which helps model training more efficiently. In addition, through a series of image preprocessing techniques, possible lesion areas can be highlighted, resulting in more accurate detection. The output of these image preprocessing steps is saved in the CNN database. The clinical images used in this research were collected by attending physicians with more than three years of experience in hospital dentistry. All clinical images utilized in this research had been approved by the Institutional Review Board Statement (permission number 202002030B0). For enhancement, the most challenging problem is that after image segmentation, there is too much noise in the original apical slice and the resected part of the lesion area. Therefore, the angle of cutting or image noise reduction became the challenge of this project. This proposal uses the same Gaussian high-pass filter as that of [23] to achieve the best noise reduction result. The flow chart of this study is shown in Figure 1.

**Figure 1.** The flow chart of this research.

#### *2.1. Image Segmentation and Retouching*

In order to build a high-precision model and conform to the judgment of dentists, this research uses a single tooth image to build a clinical image database. However, since the original image is a PA composed of about three to four separate vertical teeth, segmentation of individual teeth must be performed on the original image. In [24], the vertical cutting method of dividing the image is a very good idea. However, its target image is a BW film; there would be some flaws in the process of cutting the PA film. Therefore, the segmentation method that this proposal focuses on is improved on the basis of [24] to make the segmentation more accurate. The next step is to retouch the segmented photo by adding a technique to block non-target areas on the segmented image.

#### 2.1.1. Vertical Cutting

The core concept of vertical cutting is to calculate the sum of the horizontal pixels of the image and find the point with the smallest sum making that point the segmentation point. Before performing the calculation, the image is first converted from an RGB image to a grayscale image for easier calculation. In this research, the method of iterative thresholding in [23] is improved and adaptive thresholding is used for transformation. The feature of adaptive threshold processing is that each image behaves differently from RGB to grayscale which means that each image has its own most suitable adaptive threshold. In this proposal, the most appropriate adaptive threshold is selected for each image and image transformation is performed. Figure 2 is the image result applying the conversion method using [23], and Figure 2b is the image result of the improved adaptive threshold. From a data point of view, this method can effectively improve the accuracy of image segmentation.

**Figure 2.** The result of the images. (**a**) image binarization, (**b**) adaptive threshold processing.

This proposal summarizes the range of the sum of pixels where the appropriate threshold is located by calculating the sum of the pixels of each grayscale image. However, the calculation cannot be performed immediately after converting the image because not every interdental gap is vertical. Therefore, rotating the image is a necessary step before calculation. Additionally, image rotation is performed by rotating the image 12 degrees clockwise and 12 degrees counterclockwise [24]. After rotating the image, the 24 positions and value of the minimum pixel sum for each angle can be computed. The 24 values are then compared with the smallest value being the most suitable position and angle for segmentation. Since the number of PA image teeth in the database is at most four teeth, a maximum of four cutting lines are required. This means that the above steps need to be repeated four times. However, the number of teeth in the PA images is not always four and some images have only three. In this case, the redundant dividing line needs to be removed. Therefore, this study designed two methods to address this problem. The first method is based on the relative position of the fourth cutting line to the other cutting lines. Assuming that the distance between the fourth cutting line and the other cutting lines is less than the width of one tooth, the fourth cutting line should be removed. The second method is that if the value of the fourth row is greater than the average, it means that the fourth row is very likely not on the tooth. Thus, the fourth row can be removed by this feature. Figure 3a shows the result of finding all the dividing lines. Figure 3b is the result of removing the redundant dividing lines. When the cutting line is inclined, the image segmented by the cutting line is not rectangular. However, for the subsequent training of CNN when normalized, the target in this step is a rectangular one. Therefore, this proposal adds a green vertical line to the far right and a blue vertical line to the far left of each cutting line. Moreover, it segments the first segmented image with the leftmost position of the original image and the first green vertical line as the boundary. The second segmented image is bounded by the first blue vertical line and the second green vertical line. The third and fourth cut images are similarly divided.

**Figure 3.** The result of cutting lines. (**a**) all cutting lines, (**b**) removed unnecessary cutting lines.

#### 2.1.2. Image Masks

The inclination of the cutting line is designed to match the inclination of the teeth. However, most of the cutting lines have oblique angles which means that most segmented images will contain a small fraction of adjacent teeth as shown in Figure 4a. This leads to disturbances in the accuracy of the CNN model. In view of this, this study retouches the segmented images according to the cutting line (red line in Figure 3). It sets the mask template according to the clipping line and the mask template will be superimposed with the original clipping image. This can effectively mask the non-target area as shown in Figure 4b. The modified image will be the final output and result. The retouched image will optimally preserve the desired feature areas.

**Figure 4.** The results of the masking image. (**a**) original segmented, (**b**) retouched segmented.

#### *2.2. Enhancing Lesion*

In the collected original images, the root apical lesions will be affected by factors such as shooting angle, dose, and operator, thus, the lesions are sometimes inconspicuous. In this regard, this research proposes an advanced and intuitive enhancement method that can highlight the lesions. The first work is converting the RGB image to a grayscale image using a conversion formula. It then uses the Gaussian high-pass filter to filter out the noise. In order to make the lesion more obvious, the result of the Gaussian high-pass filter is used to superimpose it back to a grayscale image. Finally, the simple enhancement technique is used to change the color of the possible lesion area to green. In this way, clinical images for efficient training of CNN models can be obtained.

#### 2.2.1. Grayscale Image

The original apical section is an RGB image. However, this is not very friendly to the subsequent image processing step. To make image processing easier and accelerate the subsequent CNN training, the first step in lesion enhancement is to convert the image from an RGB three-channel image to a grayscale single-channel image. This step generates all the points needed for the subsequent steps described by the *x*- and *y*-axes of the grayscale image and at the same time achieves a more efficient process.

#### 2.2.2. Gaussian High Pass Filter

The biggest challenge in judging symptoms is the noisy points in the image. Therefore, attribute filters that reduce these noisy points are crucial. In the existing technology, there are many different filters. How to choose the most suitable filter is the key. Gaussian filters are used in two different ways. The Gaussian low-pass filter on the other hand is used to reduce certain noise points while the Gaussian high-pass filter is used to enhance dark areas. For the purpose of preprocessing to make possible apical lesions as evident as possible, the Gaussian high-pass filter is clearly the most suitable filter. This filter is able to pass high-frequency pixels and block low-frequency terms. Marginal and possibly apical lesion areas belong to high frequencies in the frequency domain. Hence, these pixels will remain in the resulting image as shown in Figure 5. The Gaussian high-pass filter [25] can be represented by Equation (1).

**Figure 5.** The results of the Gaussian high-pass filter. (**a**) original apical lesion image, (**b**) image after Gaussian filtering.

$$H(\mu, v) = 1 - e^{-D^2(\mu, v)/2D\_0^2} \tag{1}$$

Although the image lesions after applying Gaussian high-pass filtering are obvious, the results are not as expected after model training. Therefore, other methods must be explored to enhance the lesions. In [23], in order to obtain better edges, the image preprocessing is performed by taking the grayscale image array minus the Gaussian high-pass filtered films array. The reason is that the filtered image will preserve the noisy areas and the result may not be significantly different from the input image. Therefore, by subtracting the filtered film from the input array, a clear tooth outline image can be obtained. Based on the above method, this study attempts to improve it by adding a film array to the grayscale image array after passing through a Gaussian high-pass filter to increase the likelihood of the lesion area. After applying a Gaussian high-pass filter, the filtered image retains the high-frequency pixels thus including the noise points, edges and possible lesion pixels.

After superimposing this filtered image, the contrast between the light and dark areas of the grayscale original image and the filtered image becomes evident as shown in Figure 6.

**Figure 6.** The image after adding the result of the Gaussian high-pass filter. (**a**) before, (**b**) after.

#### 2.2.3. Lesion Heightened

The last step of feature enhancement is to adjust the color of the suspected lesion area where the color of the root tip is darkened. The biggest challenge for this step is how to lock the dark area of the suspected lesion. The filtered film makes it easier to find dark areas than the original image because bright areas have much larger pixel values than dark areas. However, directly using the threshold to adjust the whole block will cause other non-lesion areas in the image to be adjusted at the same time. Hence, this proposal calculates the pixel average and selects the threshold range. It can be simply reserved for possible lesions and excluded for bright areas as shown in Figure 7a. Moreover, this research used the method of calculating the pixel value difference between each pixel and its upper and lower pixels to ensure that possible lesion areas were determined. If the pixel value difference between the pixel and the pixel above or below is higher than the standard pixel value, it means that the pixel may be a point in the lesion area or just a noise point. At this time, a standard pixel value is selected. Figure 7b shows the experimental results. After using the above method of calculating the mean and calculating the difference in pixels, an AND operator is performed on the processed film to keep the points where the result is true after the AND operator. MATLAB programming provides a function to find several large regions in an image which this project uses to get the three regions that are larger than the others. Figure 7c presents the superimposed image. Finally, comparing these regions with their position in the film and their distance from the center pixel of the film, the regions that meet the above conditions will be changed into a green color and overlap with the original image. The final result is shown in Figure 7d.

**Figure 7.** The image in different computing methods. (**a**) computed average image, (**b**) calculated pixel value difference for every pixel to the upper pixels and to the lower pixels, (**c**) superimposed image after going through the previous methods, (**d**) the final preprocessed image.
