Material Classification for Terahertz Images Based on Neural Networks

Terahertz time-domain spectroscopy enables the extraction of electrical properties from materials. An extraction of the complex permittivity can be carried out with measurements in transmission or reflection geometry enabling the identification of materials. To perform an exact identification, the sample thickness, and the angle of incidence of the terahertz radiation must be known. However, when those parameters are unknown and additionally the materials show strong absorbances, a precise differentiation between materials is challenging. A promising approach is the use of a neural network for automated material classification of terahertz images from different materials. Here, we show that a trained neural network can differentiate between 16 3D printed dielectric materials with a high accuracy of 98 % from measurements taken in transmission mode. For unknown thicknesses, the accuracy is reduced to 35 %. As the constitution of the dataset has a big impact on the accuracy, various data preparations were investigated as well as the number of traces needed for achieving a well-trained network was determined. Finally, the trained neural network was evaluated with different sample thicknesses, revealing the huge impact of the materials absorbance on the extrapolation ability. This approach can be used in security application to classify harmful substances as well as for the automated generation of material maps.


I. INTRODUCTION
Terahertz radiation has the potential to be used in many common security applications with the goal to detect hidden weapons or harmful substances [1]. Mostly, images are taken in reflection geometry at one frequency, leading to a monochrome image [1]. An enhancement of this method is the mapping of certain materials to parts of the taken image. This can be achieved by using terahertz time-domain spectroscopy (THz-TDS), where broadband information such as frequency depended refractive index and absorption coefficient can be obtained [2].
Some materials like drugs, explosives, and other complex chemicals have unambiguous spectral fingerprints in the terahertz frequency range [3], [4]. Simple methods like comparing frequencies where spectral absorption lines are The associate editor coordinating the review of this manuscript and approving it for publication was Eduardo Rosa-Molinar . present enable an automatic differentiation between materials with a high accuracy [3]. As many dielectric materials do not have spectral fingerprints in the terahertz frequency range, simple classification fails. Often, a high classification accuracy was achieved for materials which strongly differ like organic materials against metals and polymers [5] or minerals against organic materials [6]. As the used materials have significantly different dielectric properties, high accuracy levels can be achieved with established methods. Most of the approaches perform an extraction of features either with statistical methods [5], [6] or linear feature mapping [7], [8]. Rather uncommon is the use of raw data [9], time-domain features [10], and filtered data. Support vector machines (SVM) and neural networks are widely used for automatic learning of relationships in measurement data [5], [6], [7], [8], [9], [10], [11].
Common issues of most of the presented methods are the size of the dataset and the evaluation method. The amount of data used for training and testing of the algorithms is low and often consists of just 3-25 THz-TDS traces per category [5], [7], [8], [10]. In consequence, the low amount of data may not show the generalization ability of the presented methods. Also, an evaluation was not carried out on different sample thicknesses, limiting the approaches to a narrow field of applications. Siuly et al. highlight the importance of generalization of the approach on different sample thicknesses [6].
In contrast to many different dimensionality reduction methods, the use of a neural network is a simple approach for classifying individual terahertz traces [12]. Neural networks have the capability of performing a dimensionality reduction on their own and learning relations in a dataset, outperforming separation methods like SVMs [13], [14]. While algorithms can be applied to the data directly, neural networks need in general a high amount of training data before they reach a reliable classification accuracy [14].
In [15] and [16] we have demonstrated that a neural network can differ between materials either in reflection or transmission geometry. However, an investigation of different data preparation techniques, material thicknesses as well as an investigation into the amount of data required for a generalization of the method did not take place.
In this paper, a generalized approach for material mapping with neural networks of THz-TDS measurements in transmission geometry is proposed. The method is intended to provide a general solution and is focused on a variety of similar dielectric materials without any spectral fingerprints to consider a challenging scenario for material classification. As the preprocessing of the measurement data might have an impact on the classification accuracy, various data preparation techniques are implemented and evaluated regarding their influence on the classification accuracy. In addition, the amount of data required to successfully train the neural network is examined. Finally, the approach is evaluated for different sample thicknesses. Additionally, the performance of the trained neural network is compared to an SVM.

II. EXPERIMENTAL SETUP
For obtaining THz-TDS data from different materials in one measurement run, an automated measurement setup is realized. In addition, the manufacturing of samples from different materials and thicknesses was carried out. To include statistical influences, multiple repeated measurements were done for each material thickness.

A. SAMPLE FABRICATION AND PROPERTIES
To make the classification as realistic as possible, we decided to study 16 different polymers without spectral fingerprints in the considered frequency range. Here, 3D printing by fused deposition modeling (FDM) is a well-established fabrication method for terahertz devices [17], [18], [19]. 3D printing of polymers enables an accurate sample fabrication with high reproducibility. This enables the fabrication of samples with well-defined thicknesses. For automated measurements of multiple samples, we designed a 3D printed sample holder shown in Fig. 1. The sample holder was coated with conductive paint to enhance the image contrast and can be loaded with 16 cuboidal shaped samples with the size of 32 mm × 32 mm (cf. Fig 1). Two sample sets and holders were fabricated for a thickness of 1 mm and 5 mm to investigate the influence of the sample thickness on the classification accuracy.
By a simple raster scan of the sample holder, a large amount of data from the 16 samples can be generated. Since the position of the samples within the sample holder is known, the data can be easily labelled. The clear aperture of the sample holder is 30.5 mm x 30.5 mm per sample window. To get measurement data from samples with different thicknesses in one measurement run, a second sample structure was designed that has four different stages with thicknesses of 1 mm, 2 mm, 3 mm, and 4 mm (cf. Fig 1). Since edge effects occur at steps, the multistep samples (from now on called verification samples) are not suitable for training but will be used later for verification.
The samples and the sample holder were fabricated by the 3D printer Ultimaker S5. The company offers a variety of materials with predefined printing parameters. Printing without optimized parameters can result in nonuniform samples and hence varying material properties [20]. An overview of the used materials together with the refractive index n and the absorption factor α at 1 THz is given in Table 1. Two materials, COC, and HIPS are non Ultimaker materials. The two materials were added because they are highly interesting for the fabrication of terahertz devices due to their low absorption losses [21]. The printing parameters for the two materials have been carefully optimized to ensure a high printing quality and reproducibility.
For the fabrication of the samples, a nozzle size of 0.4 mm was used. A filament with a diameter of 2.85 mm is printed  on a heated glass bed. To keep the complexity of the samples as low as possible, a simple infill structure was chosen. The infill structure is the zigzag pattern which was rotated by 90-degree for each layer. While printing, the cohesion to the glass printing surface was improved with a small layer of glue. Samples were cleaned after printing to remove residues of the glue and other materials.

B. MEASUREMENT SETUP
To collect THz-TDS traces from the whole sample holder in an automated measurement run in transmission mode, a focused setup is used as depicted in Fig. 2. Here, the fibercoupled terahertz spectrometer Tera K15 from Menlo Systems is utilized for the generation and detection of broadband terahertz radiation: a femtosecond laser source excites free carriers in a biased photoconductive antenna. The accelerated carriers generate a broadband terahertz pulse. A part of the optical pulse is used to gate a photoconductive antenna which acts as the receiver. Here, a photocurrent is measured that is proportional to the incident terahertz field. A delay line in the receiver arm enables optical sampling of the terahertz trace [2]. To obtain a fine spatial resolution, the terahertz radiation is focused. Planoconvex TPX lenses with a focal length of 50 mm collimate the emitted terahertz radiation. Another set of identical lenses focus the collimated terahertz beam on the receiver. Positioning the sample holder on a translation stage enables, as shown in Fig. 2, the measurement of terahertz traces at varying positions in y-and z-direction with the focused terahertz beam in transmission mode.
A measurement can be considered as a terahertz image which is made by stepwise moving the translation stages and scanning the whole area. A step size of 1 mm in each axis and a fixed time window of 100 ps is used for every THz-TDS trace. If no sample is present in the terahertz path a single shot bandwidth > 4 THz with a peak dynamic range of 56 dB was obtained.

C. PERFORMED MEASUREMENTS
Since the training of neural networks requires in general a large amount of data, we recorded six terahertz images of each printed sample set. In this way, different datasets can be combined from the measurements.
A summary of the measurement data is given in Table 2. To keep the training data clean from edge effects, an area of 20 mm × 20 mm was chosen for each training sample. For each height step of the verification samples an area of 8 mm × 8 mm was chosen. In this way, 400 traces can be obtained for each training sample and 64 traces per thickness for each verification sample. In total, 101,376 useable THz-TDS traces were collected, distributed on 2,400 traces per thickness and material from Measurement 1 and Measurement 2 and 384 THz-TDS traces per thickness and material from Measurement 3.

III. DATA PREPARATION
While dealing with neural networks and other classification algorithms, the data preparation is important as it directly affects the interpretation of the measurement data. The presence of unwanted signal components or false correlations in the THz-TDS traces may lead to a lower classification accuracy. To characterize the influence of different data preparations, the neural network will be trained with differently processed data. As a neural network is capable of processing not only time-domain but also data in the frequency-domain, another interesting aspect is the comparison between both domains. From Fourier theory, the information present in both VOLUME 10, 2022 domains is identical for periodic signals or signals ranging from −∞ to ∞. However, the nonperiodic nature of the recorded signals affects the transformation. Therefore, data preparation will be performed for both domains.

A. GENERAL DEPENDENCIES
The transmitted spectrumÊ t (ω) of a THz-TDS pulse through a dielectric sample (relative permeability µ r = 1) depends on the sample specific complex and frequency dependent permittivity by: For normal incidence and dielectrics with low losses, the transmitted spectrum can be calculated as [2]: where α(ω) is the absorption coefficient, n(ω) the refractive index,t 12 ,t 21 the Fresnel coefficients, and d the sample thickness. The material parameters can be reformulated into the complex permittivity with and As the terahertz pulse propagates through a sample, it is delayed due to the reduced phase constant in the medium (see equation (2)). The time shift directly correlates with the refractive index and the thickness of the sample. Here, different combinations of thicknesses and refractive indices may lead to an identical delay. A similar situation can be constructed for the absorption coefficient. In addition, the absolute delay can only be determined, if a reference terahertz pulse through air is measured.
For evaluating a general data preparation approach, a neglection of the time shift must take place. By shifting each recorded THz-TDS trace's zero-crossing point (cf. Fig. 3) of the main pulse to the same position, the time shift is removed, and all THz-TDS traces are comparable.
As each terahertz trace not only contains the sample's information but measurement dependencies like system characteristics or environmental influences, a reference measurement (terahertz path without sample) is considered. By dividing the sample measurement with the reference measurement in the frequency-domain, i.e. calculating the transfer function, the complex permittivity can be directly extracted [2].
The different absorption coefficients of the samples result in different bandwidths of the measured THz-TDS traces (cf. Fig. 3). Calculating the transfer function results in high values for the magnitude outside of the valid bandwidth due to the normalization and noise. A fixed windowing in the frequency domain is not possible as the high noise components will lead to a distorted time-domain pulse. To solve this problem, a valid bandwidth is selected for each transfer function by Tukey windowing the range in the frequency-domain where a linear phase exists. The filtered transfer function can be transformed back into the time-domain and results in the impulse response. Here, the time shift is once again removed with the above-described method and the signal represents the impulse response function of the sample.

B. NOISE FILTERING AND SIGNAL-TO-NOISE RATIO
For every transmitted terahertz pulse through a plan-parallel sample with low losses, reflections occur. The received terahertz signal consists hence not only of the direct transmitted pulse but of a sum of transmitted and multiple reflected pulses. To ensure that each THz-TDS trace contains just the initially transmitted pulse without any reflections, a windowing takes place in the time-domain. The Tukey window, as shown in Fig. 3, is applied on every THz-TDS trace, reducing the relevant datapoints to 450 points (15 ps window). The window starts 150 datapoints before the zero-crossing point of the main pulse and has a width of 450 points. The flat rooftop has a width of 95 % with a weight of 1.
As the system shows a high peak dynamic range of about 56 dB for free-space transmission, a complex preprocessing for enhancing the signal-to-noise ratio (SNR) is not considered. The removal of unwanted noise components containing DC, low-and high-frequency noise is a main part of the data preparation. The removal is achieved by windowing in the frequency-domain. A Tukey window starting at 200 GHz and ending at 4.5 THz discards the unusable frequency components in all filtering approaches, where a division with the reference is not conducted. The flat rooftop with a weight of 1 and a width of 95 % enables a flat bypass of all relevant frequency components. The harmonic attenuation at the edges leads to a good suppression of harmonics for the retransformed time-domain data.

C. NORMALIZATION
In this approach, all material properties are unknown parameters for the neural network. Thus, an amplitude change (frequency-or time-domain) depends on the thickness as well as on the absorption coefficient of the material. In addition, a change of the amplitude is evoked by the Fresnel coefficients depending on the material-air-interfaces and are related to the difference of the refractive indices. To evaluate the imprinting of false correlations as well as the over imprinting of the thickness, a normalization to the maximum amplitude of all THz-TDS traces is considered.

D. DIMENSIONAL REDUCTION
In some approaches, THz-TDS traces are not only filtered, but are reduced by the principal component analysis (PCA) [8] or by the extraction of statistical values [5], [6]. The PCA is a common approach for feature reduction, where a datapoint mapping to orthogonal vectors is performed [22]. It can be used for a reduction to relevant datapoints while trying to keep the information content unchanged. With a reduced number of datapoints, the training time is accelerated, as well as the classification process. To compare this approach with the presented filtering techniques, a reduction of the raw data with the PCA is considered.

E. DATA PREPARATIONS
Finally, all used approaches for the data preparation are depicted in Fig. 4. Here, all imprints of different correlation which might occur are covered. Except for the PCA, all terahertz traces are moved to the same temporal position and are windowed in the time-domain. For half of the preparations, the filtered frequency-domain spectrum is built. ''frequencydomain (FD)'' thus contains the attenuation coming from the Fresnel coefficients and the slope from the absorption coefficient. ''FD normalized'' is the normalized spectrum, where just the slope of the absorption coefficient is coded in the data. As the absolute value is built for the spectrum, the phase slope coming from the refractive index is neglected.
Without building the absolute value, ''time-domain (TD)'' contains after applying the inverse fast Fourier transform (IFFT) also the phase information, where ''TD normalized'' neglects the attenuation of the Fresnel coefficients. The transfer function is built after dividing each trace with a measurement specific reference while windowing a valid spectrum. Thus, just the sample information is left and systematic influences coming from the measurement setup are removed. In the frequency-domain for ''transfer function'' the phase information is neglected considering just the attenuation from the absorption coefficient. ''impulse response'' is the time-domain representation of the transfer function, containing the possible phase information.

IV. NEURAL NETWORK ARCHITECTURE
Data processing with neural networks enables many applications like the extraction of features and classification of patterns or categories. Data is propagated through layered and differently connected neurons, enabling a weighted data flow. In this paper, a classification is performed with a feed forward neural network, where the input data is reduced to an output value which indicates the material type of the input data. While calculating gradients based on a metric for the accuracy of the network, the weights are updated through backpropagation [13]. As the material type of each recorded THz-TDS trace is known, a supervised training is performed. By comparing the calculated result with the known state, a better calculation of the gradients can be achieved.

A. ARCHITECTURE
Following common design rules for neural networks, a classification is realized by adding up multiple fully connected layers (dense layers) of neurons [13]. The layer count of the dense layers was chosen to three as this enables the learning of relations from the data [13]. For a higher count of dense layers, the training time increases significantly whereas the accuracy remains the same. The number of neurons per layer was also chosen according to general design rules, which provide for a high number of neurons in the first layer, decreasing in the following layers to allow for higher performance in feature elaboration. One layer of neurons with one neuron for each material class in the output layer enables a multinomial classification [14].
For achieving a trainable network with a high generalization ability, a 50 % dropout as a regulating element was added to prevent the network from overfitting while training [23]. The nonlinear activation function for all dense layers was VOLUME 10, 2022 chosen to be the Gelu function [24], as it shows a higher performance over other more traditional activation functions like ReLu [24]. The output layer is activated with the Softmax function [13] to normalize the output values to the range [0, 1] whereas the sum of all output neurons is 1. The final structure of the neural network can be seen in Fig. 5 and was implemented in the programming language Python with the TensorFlow framework [25] and Keras [26].

B. TRAINING AND VALIDATION
To achieve a well-trained neural network, not only the structure was optimized. Several so called hyperparameter were adapted, which control the training process. For the training, the Adamax optimizer was used for the calculation of the gradients with an initial learning rate of 0.005. The learning rate schedule Reduce Learning Rate on Plateau lowers the learning rate by a factor of 10 % when no progress while training occurs. Here, the optimization was carried out over the loss function, determined by the output's binary cross entropy. The batch size determines the count of traces propagated through the network before the gradient is calculated. A batch size of 512 leads here to a sweet spot between training speed and training quality.
Before training, the training measurements are additionally split up into training data and validation data. After each training epoch, the loss is calculated for the training and validation data resulting in a train loss and validation loss. In addition, the training data is shuffled before continuing with the next epoch. When training is complete, the holdback test data unknown to the neural network is used to determine overall accuracy.
As a training with a rising count of traces per material class should take place, the influence of an increasing number of traces must be analysed. An increasing trace count results in an increasing batch count, as the batch size is fixed. Each additional batch has an influence on the training as a partwise calculation of the gradient is performed after each batch. Therewith, accuracy jumps may occur, while the trace count gets higher. To overcome this problem and prevent overfitting, training is stopped prematurely when the validation loss stops at one level and shows no progress [27]. After selecting the best performing data preparation, a cross validation will be performed. Therefore, the prediction accuracy for each possible selection of the retained measurement is calculated for 1 mm and 5 mm.

V. RESULTS
For testing the functionality of the trained neural network, one measurement for each measurement type containing 400 unknown traces per material and thickness is hold back and not used for training. The 5 remaining measurements per material thickness are filtered with all presented data preparation techniques. Finally, the neural network is trained with all filtered datasets of the thicknesses 1 mm and 5 mm. To obtain information about the amount of terahertz traces needed for achieving a high accuracy for each filtered dataset, the network was trained with a rising number of traces starting from 25 traces per material going to 4000 traces per material.

A. TRAINING ACCURACY AND AMOUNT OF DATA
The training was stopped according to the introduced stop criteria and the accuracy was evaluated with the holdback test measurement. Fig. 6 shows the prediction accuracy for the test data over a rising THz-TDS trace count per material for different data preparations.
The trained neural networks show a high accuracy for every data preparation between 90.6 % (PCA) and 98.1 % (TD) for the maximum count of traces per material. In contrast, the amount of data needed for reaching high accuracies differs. Traces in the time-domain reach for 100 traces accuracies 90.71 % (TD) and 94.2 % (TD-normalized) whereas 86.5 % are reached for FD and 75.2 % for FD-normalized.
For 2000 traces per material a saturated accuracy is reached, and an increase of traces does not lead necessarily to an increase of accuracy. In general, trained neural networks with data in the frequency-domain tend to need more traces until an equal accuracy with regards to trained neural networks with data in the time-domain is reached.
The class-wise evaluation of the neural network trained with the data preparation ''transfer function'' yields the confusion matrix shown in Fig. 7. Most of the materials are classified with a 100 % accuracy. A 100 % differentiation is not possible for most of the PLA materials. Since they share the same base material, the dielectric properties are similar (see Table 1). An overall differentiation is possible since an accuracy over 86 % was achieved.
As the similarity between COC and free space is high due to the low absorption of COC and the dielectric properties of ABS, CPE, and CPE+ are comparable, we hypothesize that all errors are related to the similar physical properties of the materials. As the classification errors seem to be based on physical properties, the structure of the neural network is well constituted for this classification problem.

B. INTERPOLATION AND VERIFICATION
For evaluating the performance with unknown thicknesses, the trained network is tested with the verification measurements, containing the unknown thicknesses 2 mm, 3 mm, and 4 mm. The results can be seen in Fig. 8. As the network was trained with 1 mm and 5 mm, an approximation of the thicknesses in between as a kind of interpolation is possible.
The overall accuracy varies for the different filter techniques while the count of traces per material has no big influence on the accuracy. This indicates that the trained neural networks perform an estimation on the unknown thicknesses. The data with the applied PCA performs worst with accuracies below 10 %. A possible reason is the linear form of the decision regions for PCA analysed data. As the PCA of the different thicknesses leads to different positions in the spanned space, the calculated principal components are more likely to be outside of the learned linear decision regions.  The neural network trained with data in the time-domain performs with 34.5 % accuracy for 4000 traces better than neural networks trained with data in the frequency-domain, whose accuracy is only between 20 % and 25 %.
As the material response for low absorption coefficients is similar for different sample thicknesses (cf. Fig. 9), a thickness independent classification is possible. For higher absorption coefficients a measurement in transmission mode leads to stronger variations in the signal for different thicknesses. Thus, the neural network's ability for interpolation is dependent of the absorption coefficients of the materials under investigation. A training with data from different thicknesses for materials with higher absorption coefficients will possibly VOLUME 10, 2022 lead to a better interpolation and classification accuracy of unknown thicknesses.

C. MATERIAL MAPPING
For evaluating the influence of edge effects and possible manufacturing problems, the complete terahertz images were classified with the data preparation ''impulse response'' since it delivered the best overall performance. The classified images are depicted in Fig. 10 for the holdback test measurements of thicknesses 1 mm (Fig. 10a) and 5 mm (Fig. 10b). Both subfigures show a very accurate material map. The sample holder is identified as the material PLA G. This is reasonable as the attenuation of the coated sample holder is comparable to the attenuation of PLA G. An influence of the edge effects can also be seen, as the classified material randomly differs at the outmost pixels of the quadratic sample. This confirms the expected effect that the transition between two materials and the changes of height between the sample and sample holder have a huge impact on the classification. The positions of false material classification are not related to a pattern, indicating that either noise or structural changes in the 3D printed samples occur.
The classified verification measurement 3, as seen in Fig. 10 c, also reveals the false classifications at the edges of the samples. All samples and its thicknesses are aligned as follows: the upper right part is the 1 mm thickness, lower right is 2 mm, upper left is 3 mm and lower left is 4 mm. For materials with a higher absorption coefficient (i.e. PLA materials), the false classifications due to edge effects are stronger since also a change of thickness is present.
A map of the values for the selected output neuron of the classified verification measurement 3 can be seen in Fig. 11. It was created by considering the output value for the generated material map. The values for the output layer range between zero and one, as the neural network has a Softmax activated multinomial output. If the selected highest value is not close to one but lower, a higher unsureness of the neural network is given. While for safely identified materials the values are around one. The values tend to be under 0.3 for the gray and black marked areas. This unsureness map highlights the missing interpolation ability of the trained neural network, as not only the edges in the samples show a great unsureness, but also complete parts of the sample. For each classified THz-TDS trace, this unsureness can be calculated. Therewith, not only material maps can be generated, but also assessments of the accuracy are provided.

D. CROSS VALIDATION
Now, a cross validation takes place where the holdback measurement is varied for training. The data preparation ''impulse response'' and ''transfer function'' are used for training with the maximum THz-TDS count per material. The selected measurement per thickness for holding back is varied over all measurements. The calculated prediction accuracy can be seen in Table 3 and Table 4. The mean deviation for the predicted test data is 0.3 % for the impulse response and 0.26 % for the ''transfer function''. This indicates that the trained neural networks do not overfit and the method generalizes in terms of the present variations in the measurements.   The mean deviation for the predicted verification test data is 1.28 % for the ''impulse response'' and 0.83 % for the ''transfer function'' showing a slightly higher variation. However, the interpolation ability of the network does not seem to be greatly affected by the variations in the measurement, indicating the generalizability of the method.

E. COMPARISON WITH SVM
Finally, the performance of the trained neural network is compared with the performance of a standard SVM. Therefor the  overall best performing data preparation ''impulse response'' is used. The SVM is trained with a Gaussian kernel as suggested in [28] to be the best kernel for the analysis of THz-TDS data so far. Figure 12 shows that the neural network performs much better than the SVM. The overall accuracy reached is 88.73 % being lower than the performance of the neural network with the data preparation ''PCA''. However, as the accuracy shows an improvement for a rising THz-TDS trace count, higher prediction accuracies may be possible for a higher trace count.
The low accuracy in separating similar materials, e.g. PLA-based materials or CPE+ and ABS (cf. Figure 13), results in an overall low accuracy. This shows that SVM have an overall high prediction accuracy in separating materials with different dielectric properties. For materials with similar VOLUME 10, 2022 dielectric properties, neural networks perform better than SVMs. In addition, a smaller amount of training data is required for the neural network here.

VI. CONCLUSION AND OUTLOOK
In this paper, we presented an approach for material classification of terahertz transmission measurements with neural networks. After training the neural networks with five measurement sets of dielectric samples with the thicknesses of 1 mm and 5 mm, holdback unknown test measurements were classified with an accuracy of 100 % for most of the materials. The differentiation between materials with shared base materials is more challenging. Here, an accuracy of 86 % and more was be achieved for the best trained network resulting in an overall accuracy of 98 %. The best results were achieved for data preparation techniques in the time-domain. As the results for the classification of the impulse function leads to an overall high accuracy also with the verification data, this method should be preferred as additionally a comparison between different systems is possible.
For 2000 traces per material, the neural networks are well trained, and the accuracy has reached its maximum for all data preparations in the time-domain. The here used data preparations in the frequency-domain tend to need more data to reach equally high accuracies. For the impulse response and transfer function as well as the data preparations in the frequency-domain even 4000 traces per material seem to be not enough to reach the maximum accuracy. indicates that more traces may lead to higher accuracies.
The other filter techniques not only need more data to perform equally well as the data in time-domain, but also perform worse while interpolating to different material thicknesses. Here, all filter techniques in the time-domain perform slightly better by reaching an overall accuracy of 26 %-35 %. This shows that an interpolation in small thickness ranges is possible but depends strongly on the absorption of the material.
One possible method to overcome the influence of different thicknesses, are measurements carried out in reflection mode. As the time-of-flight for all traces is the same after shifting, this approach should work with the same high accuracies as the thickness does not play a role in measurement in reflection geometry. Reflections from the backside of the sample can be filtered in the time-domain. Also, a reference free material characterization can be carried out using an ellipsometry measurement setup [29]. As the presented approach is capable of a classification in a certain thickness range, a training with more thicknesses leads possibly to a welltrained network capable of classifying all materials within the trained range. In addition, this method can be combined with lensless imaging to classify the material of arbitrary shaped objects at unknown orientation and distance [30], [31].

APPENDIX
The raw data of all measurements are available as well as the labelled data used for training the neural network. Each measurement file is named after the measurements listed in Table 2. All raw data contain an array of 150 × 150 THz-TDS traces for each step of the translation stage. Each pixel is also labelled with the corresponding material name. Not used data for training is labelled with the category ''Undefined''. The sampling period in the time-domain is 33.34 fs. The data is available at the following doi: 10.17185/duepublico/76495.