## 3 Experimental Setup: Methods and Procedures
### Using Neural Networks for Hardness Determination
#### 3.2.2 Preparation of Inputs  
The results of the measurements of the intrinsic magnetic field of the investigated samples were data matrices with dimensions of 1000 \(\times\) 100 points, where each point represented the exact value of the magnetic field at a specific location of the measured sample. The data contained key information about the distribution of the magnetic properties of the materials under investigation, which had to be visualized in the form of images suitable for analysis by a CNN. For this purpose, it was necessary to transform the numerical matrices into image information, i.e., graphical maps, which allow for a more efficient evaluation  
Figure 4: Measurement setup in realization of experiments: Laboratory of electromagnetic non-destructive evaluation, University of Zilina. 1: lock-in amplifier; 2: XYZ stage controller; 3: synchronization and electronic circuit (MUX) device; 4: designed and realized AMR array probe; 5: XYZ positioning system; 6: precision PTFE table. when processed by a CNN (Figure 5). Therefore, a dedicated script was developed in the MATLAB (MathWorks, Inc., Natick, MA, USA) programming environment to automate the process of converting the matrices to image files in JPG format. This format, despite its inherent lossy compression, was chosen for pragmatic reasons. Despite the loss of detail, the file size is significantly reduced, allowing for a more efficient manipulation and storage of relatively large amounts of data. The reduction in data intensity was essential for our project, as the generation and subsequent analysis of more than 260 magnetic field distribution maps would have significantly strained storage and computational capacities when using uncompressed formats. Once the magnetic field distribution maps were obtained, these were divided into 13 classes based on the hardness of the material. This allowed the samples to be efficiently classified into different categories concerning their physical properties. This step was crucial for later analysis and data processing using a CNN, as it allowed for the assignment of each sample to the appropriate class, which is essential for proper model training. The next step was to split the obtained maps into training, validation, and test sets, ensuring that the model was trained on sufficient data. For this purpose, a split ratio of 70% on training data, 15% on validation data, and 15% on test data was chosen, which is the standard split in optimizing model performance in machine learning. This step was followed by optimizing the dimensions of the graphical maps for the needs of the CNN, specifically for GoogleNet, which we chose as the base model. GoogleNet is designed to process input images with a dimension of 224 \(\times\) 224 px, which necessitated resizing the original maps to these parameters. We then optimized the parameters of the CNN architecture, particularly the fully connected layer (layer 142) and the output layer (layer 144). The original GoogleNet architecture is optimized to recognize 1000 different classes. For our specific needs, we modified this configuration so that the network recognizes only 13 classes, thus adapting the model to this task and improving its performance in handling fewer classes. After updating the input map parameters and network parameters, the CNN's actual training followed. This step involved optimizing the network weights using backpropagation error algorithms while we employed advanced techniques (regularization and dropout layers due to reducing the risk of model overfitting). The whole process of input preparation, including parameter optimization and model training, is shown in Figure 6. This approach allowed us to efficiently exploit the potential of the CNN for data extraction and classification, which is crucial for the accurate hardness analysis of materials based on the obtained magnetic maps. Figure 5: The process of converting a numeric matrix to a graphical map with the colour coding of values.