# Visual Detection of Surface Defects Based on Self-Feature Comparison in Robot 3-D Printing
## 1 Introduction  
Fused deposition modeling (FDM) is a widely used additive manufacturing (commonly known as 3-D printing) which fabricates parts by adding material layer-by-layer [1; 2; 3; 4]. The quality and accuracy of the surface may be affected by the defects which are unavoidably generated in the process, and even worse, the defects may cause the surface collapse. [5; 6]. In 3-D printing, early defect detection may facilitate the printer taking corrective measures, reducing the material waste of printing resources. Defect detection is a hot research field. The existing defect detection methods can be divided into two groups: machine vision-based monitoring systems and laser scanning-based monitoring systems. The former mainly uses cameras to take pictures, while the latter can measure the height of the object, which cannot be achieved by a monocular vision-based system. [PERSON] et al. [7] adopt laser scanning technology to detect overfill and underfill defects on upper surface of the deposited parts in the additive manufacturing process by comparing the existing point cloud with the pre-sliced stereolithography (STL) model. [PERSON] et al. [8] proposed a stereo vision measurement system that could simultaneously acquire the surface grayscale image and depth image without extra data registration and the calibration method, improving the accuracy of surface defect detection. [PERSON] et al. [9] proposeda data-driven photometric stereo by establishing the Gaussian process (GP) model to represent the nonlinear reflectance behavior of various materials based on measured reflectance datasets. Defect detection algorithms can be classified as conventional methods and methods based on deep learning. The main difference between the two methods is that deep learning can extract features automatically by convolutional neural networks, while conventional machine learning methods need to manually design corresponding features engineering. There are many researchers developing deep learning methods for their particular application fields. [PERSON] et al. [10] designed an image acquisition module to capture surface images through bright field illumination. A deep learning model named TinyDefectNet was proposed to detect the location and classes of defects. [PERSON] et al. [11] proposed segmentation-based deep learning architecture to detect and segment surface cracks. [PERSON] et al. [12] developed a deep neural network to classify optical defects, proving a great application potential in Industry 4.0. Methods based on deep learning usually need much data. [PERSON] et al. [13] proposed a deep convolutional neural network named UCR to detect both common and rare defects of the surface of aluminum profiles. [PERSON] et al. [14] proposed Feature Pyramid Network (FPN) to improve model performance from data augmentation and algorithms in detecting X-ray image defects of automobile die cast aluminum parts. To improve the performance of the model based on deep learning, as much labeling information as possible must be offered which costs time and money, while methods based on machine learning could get better performance in small datasets. [PERSON] et al. [15] proposed an automatic inspection system with five-plane array charge-coupled device (CCD) cameras and four LED light sources in a closed environment. A support vector machine algorithm was adopted to classify defects based on the extracted features in candidate defect regions. [PERSON] et al. [16] developed a computational framework that contains three steps to detect complex component surface defect position, shape, number, and size, respectively. [PERSON] et al. [17] created visual and numerical tools to analyze a rough surface, through characterizing the rough surface by building its information pattern through imaging micro-roughnesses on the controlled surface and using the parameter value. [PERSON] et al. [18] proposed two modified adaptive median filterings of impulse noise in images.