1 Introduction

Additive manufacturing (AM), also known as 3D printing, is a rapidly evolving technology that has revolutionized the way objects are designed and manufactured. This technology enables the production of complex geometries, reduced lead times, and customization capabilities that traditional manufacturing methods cannot match [1]. One of the most widely used AM techniques is fused filament fabrication (FFF) which involves the layer-by-layer deposition of melted thermoplastic material to create physical parts. FFF is generally used for a variety of applications, including prototyping, tooling, and production of functional parts [2, 3]. Compared to traditional manufacturing methods, FFF has a smaller environmental impact per component created [4, 5]. It is also a cost-effective manufacturing method, especially for low-volume production runs, as it eliminates the need for expensive tooling and reduces the time required for prototyping and production. Aside from that, FFF allows on-demand production, meaning that parts can be printed as needed, reducing the require for large inventory storage. Despite the numerous advantages of FFF, there are some limitations and disadvantages. While FFF can print with a wide variety of materials, there are still limitations in terms of the range of properties that can be achieved with printed filaments. Some of them may not be suitable for high-temperature or high-stress applications. Also, the print quality can be affected by different factors such as printer condition and calibration or build parameters which are not in accordance with the requirements. This can lead to variations in part quality between prints. Other constraints can be found in the strength and durability of manufactured parts by FFF. They cannot reach the same values as conventionally manufactured parts and may be less suitable for heavy-duty applications [6,7,8]. To address these shortcomings, alternative methodologies and explorations have been established. These include vacuum-assisted material extrusion and the utilization of sandwich composites. These methods aim to mitigate matrix voids, enhancing the bonding quality of deposited layers. By minimizing heat loss and preventing air entrapment throughout the production process, these techniques contribute to improved overall performance [9,10,11].

One critical aspect that needs to be considered is the porosity of the printed components. Porosity is a significant concern in FFF, as it can impact the mechanical, chemical, and physical properties of the printed parts. Porosity can be defined as the presence of voids or air pockets in the printed part, which can result from various factors such as material selection, printing parameters, and post-processing steps. It can lead to lower density, reduced mechanical strength, and decreased resistance to environmental factors [12,13,14,15]. Therefore, understanding and controlling porosity is essential for ensuring the quality and reliability of the printed objects.

In this paper, the focus is on exploring the influence of the porosity of printed components on their mechanical properties. By varying the mass flow, the direct relationship between the volume of the extruded material and the pore distribution in the component will be investigated. For this purpose, a method for capturing image data during the process by means of a bird’s eye view camera is presented. Then, the data is processed using the u-net architecture, a convolutional neural network (CNN), to obtain fast, in comparison to XCT, and accurate information about the pore fraction. The necessity for using a CNN is explained in more detail in upcoming subchapters. XCT images are necessary to validate the assumption of this research investigation. This will determine the actual pore content. The presence of pores in FFF-manufactured components is natural and technology related. In order to obtain a better understanding of the causes, the working principle of FFF is shown in Fig. 1.

Fig. 1
figure 1

Working principle of fused filament fabrication

The process begins by supplying a spool of plastic filament. The filament is then passed into a temperature-controlled extrusion head, where it is heated to a viscous melt. The extrusion head is equipped with a nozzle that precisely directs and extrudes the melted material in thin layers onto a plate [16]. There are two different types of extruders. In the case of the Bowden extruder, the motor with the feeding gears is not located directly on the print head and the filament is fed into the hot end through a tube. The other variant is the direct drive extruder, in which the motor for feeding the filament is mounted directly above the hot end. Both variants have advantages and disadvantages, with the second being less slippery and therefore more susceptible to errors. Especially when printing with elastic materials, the distance between the motor and the nozzle has a direct effect on buckling [17]. The exiting compound is deposited in lanes on the plate while the print head is moved along three axes, x, y, and z. Again, there are different types of devices where either the print head or the plate is moved. After the lines have been laid down, they solidify and stack to each other. Together, they build a layer. When all the pre-programmed paths of a layer have been traversed, the print head is raised or the build plate is lowered, and the new layer starts. Due to the uncontrolled pressure in the nozzle during the outflow of the melt, there are fluctuations in the bonding forces and shape of the laid down lines. Depending on the set layer height and extrusion width, the shape may vary. Nevertheless, the form always remains as a cylindrical ellipse, owed to the shape of the nozzle opening. For geometric reasons, pores consequently appear in the component. Fig. 2 shows a cross-sectional view of a printed part with typical pores. These effects are amplified by the rapid temperature decrease and can additionally lead to uneven stresses in the component. Weak interlayer bonding, shape of voids and the direct effect on the stiffness, strength, and density have already been studied numerous times, among others by Tao et al. [14] and Gao et al. [18].

Fig. 2
figure 2

Cross-sectional view of a printed part

Overall, this paper aims to provide a comprehensive understanding of the porosity of FFF-printed parts and its impact on critical properties. This study shall contribute to the development of methods for controlling and reducing porosity in FFF-printed components, thus improving their quality and reliability for various applications. First, the materials and methods for the performed experiments are presented. The following section shows how the test specimens are made, the data from the process is collected and processed, and finally the components are qualified. It is also presented how XCT images are performed to set up a comparison to the shown methodology of detecting voids. Section 3 describes and discusses the results of the experiments. Lastly, the conclusion of the study is being summarized.

2 Materials and methods

This section covers details about the experimental setup, specimen geometry, used materials, and the performed tests.

2.1 Experimental setup

A desktop FFF printer from the company Prusa Research type MK3S+, which has been modified and upgraded, was used to perform the experiments of this study. The device has a build volume of 250 × 210 × 210 mm3 and allows to produce components with a layer thickness between 0.05 and 0.35 mm. It is equipped with a direct drive extruder, where a nozzle with a diameter of 0.4 mm is installed. This allows the processing of numerous materials with a filament diameter of 1.75 mm. Since the unit is not enclosed from scratch, a housing was installed to reduce the influence of the ambient temperature and thus stresses and defects in the component. This can also improve adhesion to the printing surface and overall component quality. In addition, constant lighting conditions can be ensured, which significantly simplifies the processing of the recorded image data. Two light-emitting diode lamps have been installed inside to illuminate the build area as evenly as possible in order to obtain high-contrast and sharp images and to avoid shadows on the build plate. The supplied software does not offer the possibility to communicate with the printer during the process or to address installed sensors. For this reason, the OctoPrint webinterface with the Octolapse plug-in was used. OctoPrint is an open-source project for web-based control of commercially available 3D printers and provides, among other things, the possibility to monitor the print via a web interface, to control the printer as well as to enable the integration of a camera to record images of the built component after each printed layer. After completion of a layer, the entire print head is moved to the side and the camera is triggered to take a picture.

A Raspberry Pi 4 with the Raspberry Pi OS, previously called Raspbian, is used as the communication interface. The device allows the connection of a camera and other components as well as the direct processing of the data. Compatible to this microcontroller, the Raspberry Pi High Quality Camera with a 12.3-megapixel Sony IMX477 sensor, 7.9-mm diagonal image size, and back-illuminated sensor architecture, with adjustable back focus, is used to capture the images. Together with a telephoto lens with a focal length of 16 mm and an aperture of F1.4-16, distortion-free and detailed images are possible. It is conscious that due to the parallel orientation of the camera above the printing plate, not all types of defects can be detected. However, this setup (Fig. 3) was deliberately chosen to explore the idea of this study.

Fig. 3
figure 3

Setup for specimen manufacture and data collection: a printer; b filament; c camera; d light sources; e enclosure

2.2 Material

For manufacturing specimen for the study, polyethylene terephthalate glycol (PETG) is used. PETG is a thermoplastic polyester that provides significant durability and excellent formability for manufacturing. Due to its low forming temperature, it is also very popular in consumer applications. PETG stands out as both a highly durable material and a cost-effective option when compared to other thermoplastics with similar mechanical properties like for example polycarbonate [19]. Its unique characteristics make it suitable for indoor and outdoor use. An overview of the filament used, and its properties are listed in Table 1.

Table 1 Material properties of the used PETG filament

The added Glycol to the polyethylene terephthalate (PET) during the manufacturing process modifies the properties of PET, so it becomes easier to process and less brittle. Printing larger objects, exclusive of an enclosure, without running the risk of warping is well possible due to its low thermal expansion. Moreover, the high ductility of the material prevents parts from breaking under pressure [20]. The color of the filament was not chosen unconsciously. The urban gray filament in this setup can ensure a good contrast to the printing surface, as well as between the pores and the material. This does not mean that a filament of a different color cannot be used. However, this would require an extension of the database for training the CNN. Reinforcement learning would be one way of using this approach to process different filaments.

2.3 Specimen fabrication

A shortened version of the specimen according to DIN 527-1 Type 1A is used for the tests. The reason for changing the geometry is to shorten the printing time and to save material by reducing the area of little significance. Fig. 4 shows the shape and dimensions of the modified geometry. The height of the component is 4 mm.

Fig. 4
figure 4

Shortened version of Type 1A specimen according to DIN 527-1

The specimen geometry was created using SolidEdge CAD software. The exported STL-file must be prepared for printing and converted to geometric code (G-Code) using a slicing program. For this purpose, the parameters must be defined. These include for example the nozzle and build plate temperature, filling density, infill pattern, and layer thickness. The most important parameters, which have partly been determined in preliminary tests, are summarized in Table 2.

Table 2 Printing parameters

The infill pattern was set to “aligned rectilinear” to ensure that all paths are unidirectional. This procedure allows a better comparison of the pores in the cross sections to the later shown XCT images. In addition, the paths correspond to the tensile direction of the tensile tests. This facilitates the investigation of the direct influence of the porosity on the mechanical properties. The exclusion of other infill patterns is not justified, as alternative patterns may also yield satisfactory results within the process. Nozzle temperature, bed temperature and speed were taken from the technical data sheet, which are given as optimum parameters. They are not the subject of this study. The infill density was chosen to be 100% because at this value the tensile strength is the highest and the influence of porosity can best be seen. The only parameter varied by the test series is the extrusion multiplier. It was changed in a range from 0.80 to 1.00 in 0.05 steps. The extrusion multiplier is a setting that controls the amount of filament that is being extruded. It is also known as the flow rate and is expressed as a percentage value. It is used to compensate for differences in filament diameter, nozzle size, and other factors that can affect the amount of extruded filament. By adjusting this setting, the accuracy and quality of prints can be improved and appearances of stringing, oozing, under, or over-extrusion can be reduced or prevented. In this case, the value was varied over a wide range to deliberately change the discharged volume and influence the porosity. In addition, larger defects were manually modeled into the structural geometries (Fig. 5), both on the surface and inside the component, to also investigate the on the fracture pattern and fracture location during the tensile tests. Furthermore, the defects will be used to ensure a better comparison between XCT images and the images taken in the printing process.

Fig. 5
figure 5

Schematic view of introduced major defects in the test specimen

A total of eight parameter sets were generated. Each parameter set contains six printed specimens. The number is made up of five specimens for the tensile tests, to be able to make a statistically correct statement, and one specimen for the micrographs. No extra specimens were manufactured for the XCT investigation, but specimens were used before they were damaged by the tensile tests. The designation of the samples is composed of an “F” for flow rate following by the set value. For example, “F100” means that the samples have been printed with an extrusion multiplier of “100.” Table 3 shows an overview of the number and nomenclature of the manufactured samples.

Table 3 Overview of the manufactured samples

Additionally to the change in flow rate, six samples each were also made with the three different manually introduced defects (Fig. 5 Type I/II/III).

2.4 Image processing and CNN

For the detection of the coverage of a layer, a segmentation method was developed as the tested conventional image processing did not give satisfactory results. To generate training data for segmentation, OctoPrint was used with a camera attached to the build platform. The camera was mounted centrally above the build platform to capture images. For segmentation, both the original image and its associated mask with classes were necessary. The masks for the build parts were created using an image editing software, as an alternative method was prone to errors due to shadows or slightly different lighting conditions. The printing platform was removed from the images using the alpha channel from the build part mask, followed by contrast enhancement. Adaptive thresholding was then applied to produce the defect masks. Fragments smaller than four pixels were removed to eliminate noise, usually caused by contrast enhancement. The data must then be segmented into classes or regions, called “defects,” “platform,” and “component.” The main tools used for this are thresholding and clustering, which provides different values for the different levels of contrast. Once the segmentation is done, each region is assigned a specific class label based on its characteristics. In addition, some post-processing is required to refine the results. For example, small material residues may be detected that are not actually connected to the main component. These are removed using morphological operations and connected component analysis. It is also important to identify defective regions within the main component. In some places, there are small areas within the component that are classified as a “platform,” but which are not logical or possible based on the design. In such cases, these regions can be classified as defects, based on the assumption that defects and print platform are similar in appearance. The build part and defect masks were then combined to create results, which underwent manual post-processing. The U-Net architecture was used because it is a reliable segmentation model that provides highly accurate and detailed segmentations, and it outperformed DeepLabV3+ in defect detection tests. The encoder and decoder paths of the U-Net model are shown in Fig. 6. The model was tuned using KerasTuner and Weights & Biases. During tuning, diverse hyperparameters were varied, such as learning rate, loss functions, batch normalization, filter count, optimizer, and activation functions to achieve the best possible results.

Fig. 6
figure 6

Visualization of the U-net-type network architecture [21]

Finally, once the segmentation and post-processing steps have been completed, the defect coverage within the component can be evaluated. This is done by calculating the ratio of the total defect area to the total component area. This is done by measuring the pore content of each of the 20 layers of the component and calculating the average. This metric is useful for assessing the overall quality of the component and identifying areas that may require further refinement or optimization. Fig. 7 shows the inspected area of the printed samples. The reduced area mainly saved time on the XCT images without losing any of the essential information, as this was the only area that was significant in the evaluation of the tensile tests and micrographs.

Fig. 7
figure 7

Examined section of the printed samples

2.5 Specimen characterization

To test the manufactured samples and make statements about the set parameters, it is crucial to consider the tensile strength and internal structure. Tensile tests, micrographs, and micro-CT measurements are useful methods to obtain this information.

Tensile tests

Due to the lack of methodologies for evaluating FFF-manufactured parts, many studies and investigations aim to apply existing standardized test methods to them. They are all faced with the challenge of understanding the influence of the various parameters and collecting a specimen geometry and a set of parameters in order to be able to deliver reliable test results.

The tension tests are carried out with the Quasar 100 tensile testing machine from the Galdabini company (Fig. 8). At first, the specimen is mounted into the grips of the tensile testing machine. One grip is fixed in place, while the other is attached to a five kN load cell that measures the force applied to the specimen. The test begins with the load cell applying a small amount of force to the specimen to eliminate any slack in the system. Then, the load is gradually increased at a constant rate until the specimen fractures or breaks. Throughout the test, the testing machine measures the deformation of the specimen by monitoring the change in length of the specimen using strain gauges. This allows for the calculation of stress and strain, which are used to determine the mechanical properties. After the test has been completed, the data is analyzed to determine the ultimate strength, modulus of elasticity, and other mechanical properties. For each geometry and flow rate setting, five specimens were tested to determine the strength of the printed tensile specimen. A total of 40 tensile tests was carried out.

Fig. 8
figure 8

Clamped tensile specimen in the testing device

Microsections

In order to analyze the porosity within the component, micrographs were obtained. For each parameter variation, three sections (A/B/C), representing a total of 24, were embedded in a cylindrical mold using a two-component resin. Fig. 9 shows the approximate positions at which the sections were examined.

Fig. 9
figure 9

Approximate positions for the examination of the micrographs

The embedding material, “Epoclear” from Schmitz Metallographie GmbH, was used with a weight ratio of 100/55 % (resin/hardener). After allowing 12 h for hardening, the specimens were ground using abrasives of different grain sizes ranging from 240 to 4000 before being polished using a three- and one-micron diamond suspension. Prior to microscopic examination, the specimens were cleaned with isopropanol and dried. The Olympus SC50 light microscope, equipped with a 2.5× objective and a 10× ocular, was used to obtain micrographs in bright field (BF) mode.

XCT measurements

The use of XCT measurements can effectively detect pores, inclusions and inhomogeneities, thereby enabling the non-destructive measurement of three-dimensional physical parts. In the case of FFF-printed components, micro-CT measurements are essential for determining the morphology of the printed material. In this study, micro-CT measurements were conducted on a total of eight printed specimens, one of each parameter set (Table 3). The experiments were performed using a micro-CT measuring system, phoenix v|tome|xs 240/180 from Baker Hughes Digital Solutions GmbH, with phoenix datos|x 2 acquisition 2.5.1 as the recording software and Volume Graphics VG Studio Max as the evaluating software. The voxel size was set to 30 μm, and a three-dimensional image recording was achieved by the composition of 1500 images.

3 Results and discussion

In the following, all results of the previously described conducted tests are shown and evaluated for the significance for the presented approach.

Evaluation of the predictive model

The best tuning result among all combinations is achieved by the model with a learning rate of 1e-3, SeLU activation, no batch normalization, IoU loss, a starting filter number of 16, and the RMSprop optimizer. It achieves a mean validation IoU of 93.28 % or a validation Dice score of 96.36%. The combination includes hyperparameters that do not always match the evaluation of the parameter importance and correlation with respect to the achieved validation-IoU. This may be due to the fact that a particular parameter leads to poorer performance in most models, but a specific combination still yields good results. However, this could also be based on to Bayesian tuning, which may fixate on certain parameters or favor them based on previous results, and thus, certain combinations are not tested. To tune the model, a dataset of 87 images for training and 29 images for validation was created. Finally, after expanding the database with additional images from augmentations, the final training of the model was performed with 162 trained images, 54 validated images, and then verified with 30 test images.

In the final test by training on the extended and augmented dataset, the U-Net model achieved the results shown in Table 4. Based on the results, it can be seen that overall the printing platform and component are very well detected. Detection of defects performs slightly worse, which is due to the difficulty in detection as defects only represent a very small portion of the data. A Dice score of ~ 90%, which describes the average performance of the model, represents a satisfactory result (Fig. 10). Fig. 11 shows the predicted image of the trained model in comparison to the ground truth of the original image, that was used for training. Considering the relatively small database, these results can be considered successful and can be further improved by increasing the number of training images. This is also necessary to enable this approach for industrial manufacturing.

Table 4 Result for U-Net evaluated using IoU & Dice/F1 score
Fig. 10
figure 10

Comparison between the predicted output mask and the ground truth of the original image

Fig. 11
figure 11

Section of the area for the evaluation of coverage (left: captured image, right: generated mask)

Image processing and CNN

After designing and evaluating the model for creating the masks, the coverage of all printed layers was analyzed. For this purpose, the white pixels in the relevant area are added up and set in relation to the total pixels of the cutout. Fig. 12 shows a section of a layer in which the relevant pixels for the coverage were counted.

Fig. 12
figure 12

Results of the coverage of the individual layers

The values of all twenty individual layers are added and set in relation to the total volume. Table 5 gives an overview of the results of the calculated volume.

Table 5 Results of the calculated volume from the 2D images

The calculated volume decreases with declining flow rate. The extruded material directly influences the volume by the set flow rate value. In order to analyze the distribution of the pores in the entire component, the results of the individual layers must be considered (Fig. 13).

Fig. 13
figure 13

Ultimate tensile strength and elongation at yield of the different specimen

Based on the graphical representation in Fig. 13, the pore distribution appears to be uniformly spread throughout the layers. Notably, in samples with a lower extrusion factor, complete coverage is observed in the initial layers, despite the lower factor. This result can be attributed to a deliberate decrease in the nozzle-to-platform distance during the first layer, which enhances adhesion and increases the strength of the interconnecting filaments, thus resulting in fewer defects. The excess material from the initial layer influences the subsequent layer, leading to a reduced void ratio. The distribution of excess material continues until the third layer, leading to a uniform disposition of pores across the remaining layers.

Tensile tests

From the evaluation of the tensile tests, statements can be made about the influence of the pore fraction and defects on the mechanical properties. Fig. 14 presents the results of this analysis.

Fig. 14
figure 14

Failure locations of the specimen during the tensile tests

The analysis reveals that specimens with an extrusion factor of 100 and no additional defects exhibit the highest maximum tensile strength. These specimens surpass the technical data sheet value provided by Prusa Polymers (47 ± 2 MPa) and exhibit a maximum strength of 54.4 MPa. The comparative values from the technical data sheet (“TDS”) of the Prusa Polymers filament used are shown in the bar chart. As the extrusion factor of the remaining specimens decreases, the measured tensile strength uniformly decreases. The specimen with the lowest tensile strength is F80, exhibiting a value of 40.4 MPa. Interestingly, all three specimens with introduced defects display a tensile strength greater than 50 MPa, indicating that such defects have a significantly lower impact on strength when compared to a reduced extrusion factor. The elongation of specimen F100 aligns well with the values provided in the data sheet (5.1 %). The elongation values decrease as the extrusion factor gets reduced, reaching a minimum value of 3.4% for specimen F85 with the lowest extrusion factor. The introduced defects have a more pronounced effect on elongation values. An interesting observation can be made upon examining the fracture points of the tensile specimens (Fig. 15). Although the introduced defects do not exert a significant impact on the ultimate tensile strength, it is evident that in all three specimens (*DI, *DII, and *DIII), the fracture occurs at the location of the defect. This can be attributed to the reduced cross-sectional area of the defects and the lack of stress relief at these points due to their shape. Future research will explore the influence of defect size, shape, and location to enable more precise conclusions. The specimens without inserted defects, on the other hand, all break in the same places at the end of the transition of the rounding to the middle part of the specimen.

Fig. 15
figure 15

Microsection (top) of the F90-specimen and corresponding mask (bottom)

Microsections

In order to gain a more comprehensive understanding of the results obtained from the tensile tests and to validate the image analysis, micrographs of the printed specimens are acquired and examined. Fig. 16 shows one of the micrographs of specimen F90 (B) and the corresponding mask used to evaluate the pore fraction.

Fig. 16
figure 16

XCT of the *DII (left) and *DIII (right) specimen

The acquired micrographs provide insight into both the pore size and shape, as well as the pore distribution within the printed specimens. The micrographs reveal that the lower layers of the printed specimens exhibit fewer or much smaller pores, which is consistent with the observations made in Fig. 13. The underlying reasons for this phenomenon have been discussed in the previous section. Table 6 displays the calculated percentage of pores observed in the acquired micrographs.

Table 6 Results of the evaluation of the coverage [%] from the micrographs

The evaluation of the pore fraction from the acquired micrographs shows a decline in the pore fraction with decreasing extrusion factor, consistent with the findings in the previous section. Additionally, it can be observed that the introduced defects do not have a significant impact on the pore fraction. However, it should be noted that the images were captured at three specific locations on the sample and may not be fully representative of the entire volume of the component. Consequently, it is not possible to ensure that all three spots correspond to the location of the introduced defects. In comparison to the outcomes presented in Table 5, an observable discrepancy or deviation in the measured values is evident. Nevertheless, it is noteworthy that neither approach accurately portrays the entire proportion of the component. Specifically, with regards to the micrographs, only three points were evaluated, whereas in the case of the camera images, a total of 20 points were assessed, each after every layer. Consequently, it is imperative to conduct an analysis of the X-ray computed tomography (XCT) images, which will be explicated in the following section.

XCT measurements

In order to better compare and interpret the results of the previously performed experiments, XCT images were taken of each sample from a parameter set. A significant difference here is the number of images from which the 3D image is created. Each scan is composed of 1500 images, whereas in the presented approach to evaluate porosity using the camera from above, only 20 images are available. This results in a much finer resolution and allows a more accurate assessment of the pores and present defects. Fig. 17 and Fig. 18 show possible images of the specimens. The defects and pores are colored dark red in the figures to provide a better overview of the distribution and proportion.

Fig. 17
figure 17

XCT of the F90 specimen from cross-sectional view (left) and top view (right)

Fig. 18
figure 18

Stacked bar chart with comparison between the porosity determined by different methods

A difficulty in the evaluation of the results is the threshold value to be set for the demarcation between the material and the pore. Similar problems can be found with the conventional creation of masks via thresholding. For this reason, trained CNNs were used as previously described. To address this challenge, reference markers were established to enable the calibration of the threshold value. Despite this measure, it is anticipated that slight inaccuracies may persist in the outcome. Another conceivable solution to mitigate this issue is to enhance the resolution of the scan, although this would considerably prolong the duration of the scanning process. However, the resolution is sufficient for this approach taking into account small deviations. Thus, all scans were evaluated, and the pore fraction determined.

Comparison of the methods and mapping to the mechanical properties

An overview of the values and comparison to the previously presented methods can be found in Table 7.

Table 7 Comparison between the three methods for determining porosity

For a better overview and comparison, the data in Fig. 19 are compared in a stacked bar chart.

Fig. 19
figure 19

Schematic representation of the detected areas by the 2D imaging method

This overview reveals that, similar to the findings of the other two techniques, the porosity within the component also decreases as the extrusion factor declines, as observed through XCT evaluation. Nonetheless, the values obtained through this method are comparatively lower. This occurrence can be attributed to the fact that this approach can identify more defects and pores due to its significantly superior resolution. It is noteworthy that in the samples with the highest flow rate, barely any defects can be identified using the 2D imaging technique. This finding is explicable by the fact that, with an accurately regulated mass flow, the defects become exceedingly diminutive, rendering them indistinguishable through the present camera resolution. A potential remedy for this issue could involve utilizing a camera with superior resolution or reducing the distance between the object and camera, which could only be achieved by attaching the camera to the extruder. However, such an arrangement could have an adverse impact on the printing process by increasing the weight on the print head. With the exception of the initial sample F100, the trends of the values obtained through XCT and 2D imaging methods are comparable, even though with an offset of approximately 10 %. This deviation can be attributed to the incapacity of the 2D imaging method to detect all the voids present in the component. Specifically, as illustrated in Fig. 19, interlayer voids exist that only emerge following the acquisition of an image of the layer, and subsequently become obscured by the deposited material in the subsequent image.

The findings obtained from microsections lie within the range of values obtained from the XCT images and the 2D imaging method. However, they are comparatively lower than the values obtained from the 2D imaging method due to the limitations previously highlighted in Fig. 20, and higher than the values obtained from the XCT images. This is attributed to the partial closure of pores resulting from grinding and polishing of specimens, which leads to abrasion of the plastic, embedding material and grinding paper. As such, the values obtained from microsections may not be entirely reflective of the actual state of affairs. This is also the reason why the offset between the values is not uniform. To obtain more accurate results, increasing the number of cross sections in the specimens is recommended.

Fig. 20
figure 20

Linear relationship between calculated volume and ultimate tensile strength

The use of microsections and XCT images was intended to validate and confirm the results derived from the 2D images generated during the process. The purpose of these validations was to establish the accuracy and reliability of the 2D image results, rather than to establish a direct correlation with mechanical properties. It is important to emphasize that the focus is primarily on using the results from the 2D imaging process for mapping purposes. These mappings are specifically linked to two key parameters, the reduction in tensile strength and the variation in extrusion factor. The linear relationship, shown in Fig. 20, between measured porosity and tensile strength suggests that as porosity increases, strength decreases. This is useful for initial evaluation. However, it is a simplistic view—factors such as pore size, shape and material type are also important. While helpful, this relationship should be part of a broader analysis.

4 Conclusion and outlook

In AM processes where intricate parts are built up layer-by-layer, the accurate determination of defects, material coverage, or pore content within each layer plays a crucial role in predicting the mechanical properties of the final printed part. Gradual error refers to the accumulation of small inaccuracies or discrepancies in the measurement over the course of the printing process. As each layer is deposited and fused, small deviations in material deposition, temperature control, or structural integrity can accumulate over successive layers. These errors, although small individually, can have a significant cumulative effect on the overall structural quality and mechanical behavior of the printed part. For example, if the intended coverage of a particular layer is not achieved due to minute errors in material flow or nozzle positioning, this could result in gaps or voids that could potentially weaken the mechanical properties of the part. Eliminating cumulative errors in AM requires meticulous attention to detail throughout the printing process. Equipment calibration, precise material handling, and robust quality control measures are essential to minimize the accumulation of defects. Advanced monitoring techniques such as real-time layer analysis, in-process inspections, and post-print inspections can help identify and mitigate these errors before they manifest as significant mechanical defects in the final printed component.

XCT imaging offers a comprehensive approach to analyzing porosity and defects in FFF-printed components. However, this method is not only expensive, but also time-consuming, resulting in longer scan times to obtain sufficient resolution. Moreover, it is impossible to correct any process parameters while the component is being printed. The presented method addresses these issues by equipping a FFF printer with a camera to capture images of the printed layers from a top perspective. At the end of each layer, a 2D picture is taken. A convolutional neural network (CNN) is then built, based on a small database, to segment the pores and defects. In this context, the use of CNNs makes it possible to evaluate camera images for the presence of pores or defects. Without the use of a CNN, conventional image processing is not sufficient to detect small defects, especially given the dynamic variations in process conditions such as different printing plates or varying lighting conditions. By training a CNN, these images can be effectively evaluated in different scenarios. With a relatively small training database of 162 images for training, 54 images for validation and 30 images for testing, an IoU of 93.28% and a Dice score of 96.36% were obtained. When these values are divided into the individual segmentation classes, the defects are detected with an IoU of 82.14% and a Dice score of 90.20%. This is due to the fact that the number of defects represents a significantly lower percentage of the total pixels than the platform or the component. Considering the size of the database, however, this is a very good result, which, with an increase in the size of the database, can significantly improve the results and enable them to be used in industry. Finally, this model was used to evaluate the captured images of the individual layers from the process. In total, there were 20 images per component at a height distance of 0.2 mm from each other. The results show that the determined volume decreases as the flow rate is reduced. The volume is directly impacted by the extruded material, controlled by the specified flow rate value. Remarkably, specimens with a lower extrusion factor exhibit full coverage in the initial layers, despite the diminished factor. This outcome is ascribed to the decrease in the nozzle-to-platform distance during the first layer, augmenting adhesion and reinforcing interconnecting layer strength. The excess material from the initial layer influences the subsequent layers, leading to a reduction in the void ratio. This excess material distribution persists until the third layer. The pore content values obtained correspond approximately to each parameter variation of the extrusion factor. This means that with an extrusion factor of 100% a component volume of 99.92% can be determined and with the lowest extrusion factor of 80% a calculated volume of 80.74%. This shows the quality of the segmentation model and the correct calibration of the extrusion factor. Based on these values, deviations in the filament diameter can be detected in the process and subsequently measures can be taken on this parameter during the process. The latter is not part of the current investigations. In order to verify the previous results from the CNN and relate them to the actual volume of the component, two further methods are used to check the pore content. In the first method, XCT images are taken of one component from each parameter set. Each scan took approximately 13 min and resulted in 1500 images. On the one hand, this method gives a much higher resolution and correspondingly more images (compared to 20 for the 2D imaging method), but it also requires an additional examination time by a factor of 39 (780s for XCT compared to 20s for 2D imaging). In the second method, micrographs were taken from three locations on the component and analyzed for pores. This requires a disproportionate amount of effort compared to 2D imaging and is not very resource-efficient for the high throughput of test parts. It is important to note that this validation did not aim to establish a relationship with mechanical properties. The focus was solely on the use of the process 2D images for mapping purposes. These images were correlated with the loss in tensile strength and the difference in extrusion factor. The mechanical properties of the printed tensile bars are then analyzed, and the impact of porosity on these properties is assessed. Specimens with an extrusion factor of 100 and no other defects show the highest tensile strength, exceeding the data sheet value (47 ± 2 MPa) with a peak of 54.4 MPa. As the extrusion factor decreases, the tensile strength decreases consistently. Interestingly, all three specimens with defects still have a strength above 50 MPa, suggesting that defects have less of an effect than reduced extrusion factor. Elongation is in line with the data sheet for F100 (5.1%) and decreases as the extrusion factor decreases, bottoming out at 3.4% for F85. Defects have a greater effect on elongation. Based on the results from the process images using CNN, a relationship between porosity and mechanical properties can be deduced. As porosity and defects have a significant influence on these, a statement can be made about the strength without destroying the component. Previously, it was only possible to determine these properties for a representative sample of a series.

The method proposed in this paper has demonstrated the direct influence of porosity on the mechanical properties of printed components, highlighting the importance of monitoring and controlling this characteristic. The comparison of the three methods for determination of the pore content of printed components reveals that each method can provide a representation of the porosity of the samples to some extent. However, all the methods exhibit both advantages and limitations, and may not accurately reflect the actual pore fraction in the samples. Nevertheless, the results presented in this paper demonstrate that the 2D imaging method, in conjunction with a camera, can provide a reasonably good trend, taking the offset into account. Future research should aim to extend the database for the CNN and integrate the method into the system control. This should be done with data from different systems under varying environmental conditions. This will not only make the method more accurate, but will also make it more universally applicable to other types of printers, if not other processes, like for example selective laser sintering (SLS). Moreover, experiments on more complex geometries and a larger variety of defects can provide additional insights into the influence of the shape, size, and position of the defects on the mechanical properties. Active control of parameters in FFF processes is essential to maintain the desired target state and thus ensure smooth and error-free printing. The investigations carried out in this thesis can serve as a basis for the development of dynamic or real-time control of the flow rate and other parameters in the FFF process for future work. This is done by taking an image after each printed layer and using artificial intelligence to adjust those parameters that deviate from the target value. Thus, it can be said that the present work represents a cornerstone for a more controllable FFF process.