## 2 Materials and Methods
### Learning Process to Detect Selected Defects During the Powder Distribution Process  
The learning process was divided into several stages: setting up the Google Colaboratory environment, installing the necessary libraries for the project, and adjusting the machine learning parameters to optimize learning outcomes. The configuration of the Google Colaboratory environment commenced with the creation of a \"new notebook\" for the project. Subsequently, the appropriate GPU and execution environment type were selected. The code execution was conducted in the Python 3 environment, and the training process of the YOLOv8 model utilized the Tesla V100-SXM2 GPU. One of the important add-ons used in this project is the Ultralytics package, which contains the libraries necessary for training the model. This package includes various libraries that perform specific functions, such as implementing the YOLOv8 model, monitoring the training process, visualizing results, and creating graphs to display the process outcomes. The package incorporates popular libraries used in deep learning, computer vision, and data management, including PyTorch, OpenCV, TensorFlow, Pandas, and SciPy. The code generated by the Roboflow package was then entered in the Python environment to download the prepared training dataset. The downloaded data were transferred from the notebook's temporary memory to Google Drive to avoid re-downloading the same files if the model's training parameters were modified and the model needed to be re-trained. One crucial issue for the model training process was that it was necessary to establish key learning parameters that significantly impact the effectiveness and efficiency of the process. The YOLOv8 models offer a range of initial settings, the most important of which include the following [32; 33]:  
* **Model:** This parameter defines the chosen model and its size. For this project, the yolov8n.pt (nano) model was used, representing the smallest version available in the YOLOv8 model series. This choice was justified by the size of the training dataset and the expected duration of the learning process, with an emphasis on minimizing training time. * **Task:** This parameter configures the task performed by the model, allowing the selection of detection, classification, or segmentation. In the project, the detection mode was selected. * **Mode:** This specifies the task mode of the model, with three main modes available, including train (training), val (validation), and predict (prediction). * **Data:** This argument includes the path to the training data. In the project, this was the path to the data.yaml file in the training set generated by Roboflow, which contains further paths for each mode implemented. * **Imgsz:** This parameter specifies the size of the input images. It was set to 640, according to the resolution of the prepared images in the training dataset. * **Batch size:** This parameter determines the number of training examples processed concurrently during a single training iteration for weight adjustment. Altering this parameter influences the frequency of weight updates by the algorithm, thereby impacting the efficiency and duration of the training process. * **Epochs:** This parameter defines the number of complete passes through the entire training set. After each epoch, the optimization algorithm adjusts the model's weights to minimize the loss function on the training data. This parameter has the most significant impact on the model's learning outcomes. * **Patience:** This parameter is the number of epochs after which the algorithm is to stop the learning process if there is no noticeable improvement. The model learning process began after setting up the environment, adjusting the appropriate training parameters, and downloading the training dataset prepared with Roboflow.