## 3 Convolutional Neural Networks
They influence anchor selection, scale adaptation, learning rate control, data augmentation, and the training strategy, all of which are critical for robust and accurate object detection in machine learning applications. The output data obtained from the predictions include the object's location on the image surface, its size, and its assignment to one of the nine defined classes. For each identified object in the analyzed image, the CNN furnishes this information. The number of objects can vary in different images and depends on how many objects the model detects within a given image. The implementation was developed in Python version 3.9. Using the Tensorflow library was a great help in preparing the implementation. The Adam optimizer, famous in classification issues, was used. The tests were performed on a workstation equipped with an MD Ryzen 9 3950X 16-Core @3.5 GHz processor, 32 GB of RAM, and Windows 10 Pro operating system. The learned CNN model was tested on real-time video streams. Outstanding results of the model operation were obtained, primarily a relatively fast (average 15 fps) prediction speed and a high accuracy in finding objects in the image and their classification. However, this way of verifying the correct operation of the network is highly subjective. Therefore, to obtain measurable results, the tests were also carried out on a test set of images (frames of video streams). This way, it was possible to compare the predicted data with the actual data. The object search accuracy was 96.79% for the prepared test set. It should be emphasized that these were images that did not participate in the learning process of this model. Figure 4 shows an exemplary result of the learned model. The figure demonstrates the presentation of results by the utilized model. Detected objects are outlined with colored bounding boxes, each accompanied by a label specifying the object's class. Objects belonging to the same class are marked with identical box colors, resulting in a maximum of nine distinct colors that can appear in a single image. Next, the metrics suitable for classification were calculated. For this purpose, a confusion matrix was created (Table 2), which allowed us to categorize objects into the following sets: TP--true positive classification (correctly classified) objects, FP--false positive classification (found but incorrectly classified) objects, TN--true negative classification objects, and FN--false negative classification (found and incorrectly not classified) objects. Figure 4: An exemplary image outcome of the trained model. Based on the prediction results classified according to the adopted confusion matrix, metrics [28,29] were separately calculated for each class. All the metrics listed here assume values within the range of <0.1>. The first Equation (1) was employed to compute the accuracy (A), providing information about the degree of correct responses across the entire set of results:  
\[A=\frac{TP+TN}{TP+FP+TN+FN}. \tag{1}\]  
The second Equation (2) enables the calculation of recall (R). The closer its value is to 1, the more sensitive the model is:  
\[R=\frac{TP}{TP+FN}. \tag{2}\]  
Another metric, specificity (S), was computed according to Equation (3). The closer the value is to one, the better the model at preventing false positives:  
\[S=\frac{TP}{FP+TN}. \tag{3}\]  
The next metric, calculated by using Equation (4), is precision (P), which quantifies the value of an optimistic forecast; the higher its value, the greater the precision of the network model:  
\[P=\frac{TP}{TP+FP}. \tag{4}\]  
The final computed metric is the model quality indicator, the F1 score, which is calculated based on Equation (5):  
\[F1=\frac{2*TP}{2*TP+FP+FN}. \tag{5}\]  
The results are presented in Table 3, confirming the achievement of excellent test results. The utilization of artificial intelligence in the form of the YOLOv4-Tiny model allows for relatively rapid image segmentation and the classification of separated objects with a high degree of accuracy.