# A Deep Learning-Based Algorithm for Ceramic Product Defect Detection
## 2 Materials and Methods  
### Dataset Construction  
Given the extreme scarcity of publicly available ceramic defect datasets, constructing a specialized ceramic defect dataset is particularly essential. In this study, through data collection, annotation, and validation processes, a ceramic product defect dataset was created, encompassing four typical defect types: cracks, gaze missing, damage, and black spots.  
During the data collection phase, the research team first gathered defective ceramic products from the market and used high-resolution cameras (Canon EOS R5, Canon Inc., Tokyo, Japan) to capture detailed images under various lighting conditions to obtain authentic and diverse samples. Meanwhile, to supplement the natural samples, the team simulated the creation of defective samples in a laboratory environment. For instance, damage was simulated by gentle tapping, and black spots were replicated using specific chemicals, ensuring the completeness and representativeness of the dataset. Considering that the study focused on the products themselves, the team selectively collected ceramic crafts with relatively uniform colors and shapes during the collection process, discarding handicrafts with complex colors or intricate designs to ensure data consistency and relevance.  
In the annotation phase, members of the research team manually annotated the type and location of defects in each image using the professional image annotation tool Labellmg (GitHub, Inc., San Francisco, CA, USA). Given the lengthy full names of the defect types, only the capitalized initial letters of each type were used as annotation labels. To ensure the quality of the dataset, the research team invited professional annotators to conduct rigorous manual inspections, reviewing each annotation result individually to correct errors or inconsistencies. Simultaneously, ambiguous, duplicate, and poorly annotated samples were removed to guarantee the purity and usability of the dataset. After a series of implementation processes, a YOLO-formatted ceramic defect dataset containing 3030 original images was ultimately formed. This dataset was divided into a training set, a  
Figure 1: Main workflow of the defect detection algorithm for ceramic products.  
validation set, and a test set in an 8:1:1 ratio, respectively, used for training, evaluating, and testing the ceramic product defect detection model. Details of the ceramic defect dataset and original images are shown in Table 2 and Figure 2, respectively.  
The experiment was conducted on a Windows system, utilizing PyCharm 2021 as the programming software. The experimental environment was configured with Python 3.9.19, the PyTorch 2.0.1 framework, and CUDA 11.8 for the training and evaluation of the algorithm model. In the experiment, all images were uniformly resized to 640 \(\times\) 640 pixels. The training was set with 500 epochs, a batch size of 32, and 8 worker threads. In terms of hardware, a 64-bit Windows 10 operating system was employed, paired with an Intel(R) Core(TM) i5-14600 KF 3.50 GHz processor (Intel Corporation, Santa Clara, CA, USA) and an NVIDIA GeForce RTX 4060 Ti graphics card with 16,380 MiB of video memory (NVIDIA Corporation, Santa Clara, CA, USA) to ensure efficient and stable operation of the experiment.