# A Study on Defect Detection in Organic Light-Emitting Diode Cells Using Optimal Deep Learning
## 3 Research Methodology
### Development of an OLED Defect Detection Model Using VGG-16 Algorithm  
After comparing and analyzing various deep learning algorithms, the optimal choice, VGG-16, was selected to construct the OLED defect detection model. To construct the model using the VGG-16 algorithm, the required libraries, including TensorFlow, Matplotlib, and OpenCV, were used. We imported the required libraries, such as TensorFlow, Matplotlib, and OpenCV. The VGG-16 algorithm was implemented using the default implementation of VGG-16 provided by TensorFlow. VGG-16 is a binary classification algorithm designed to train images for specific defect identification tasks. Pretrained weights can be utilized, and layers can be frozen to prevent them from being trained during the process. In addition, a flattened layer was added to convert the 4D tensor output of VGG-16 into a 2D tensor. The rectified linear unit ReLu activation function was applied, and a dropout layer was incorporated to mitigate overfitting. The final dense layer used a sigmoid activation function for binary classification to generate the ultimate output. The model was compiled using a binary cross-entropy loss function and the RMSprop optimizer. The learning rate was set to \(10^{-4}\), and an accuracy metric was specified for the evaluation. The pseudocode  
Figure 2: Validation of VGG-16 Algorithm. (**a**) Graph representing the accuracy of the model. (**b**) Graph illustrating the loss values of the model.  
for implementing the OLED defect detection using the VGG-16 algorithm is presented in Algorithm 1.  
```
# Library  Import TensorFlow, Matplotlib, OpenCV
Application of VGG16 Algorithm x = base model VGG16 input shape = (224, 224, 3) weights = image net'  Flatten = base model.output  Dense = 256, Activation = relu  Dropout = 0.5,  Dense = 1, Activation = sigmoid # Model Compile model.compile loss = binary crossentropy, optimizer = RMSprop 10\({}^{-4}\) metrics = accuracy # Image Upload and Preprocessing Read image in directory For image in directory: Target size = (224, 224) VGG16 preprocessed Input images # Displaying an image x = image to array x = np.expand dims(axis = 0) # If the result is 0.95 or higher, output 'pass'; otherwise, output 'nonpass' val = model images IF val \(\geq\) 0.95 Print \"pass\" ELSE: Print \"nonpass\" END
```  
**Algorithm 1** VGG-16 for OLED Cell Defect Detection  
In Algorithm 1, the image data were resized to 224 \(\times\) 224 for defect detection. This resizing was performed to optimize the image data for the defect detection model. Cell defect detection involves classifying the defects as either \"pass\" or \"non-pass\" based on a threshold value represented as 'val'. The selection of the threshold value 'val' was based on the performance metrics of the model, such as accuracy, recall, and specificity. Setting the threshold value to 0.95 was motivated by achieving high performance in detecting cell defects. Therefore, the defects in OLED cells can be effectively detected by adjusting the image size and defining a threshold value. This automation of the cell defect detection process is expected to enhance efficiency, making it more effective and reliable.