1. Introduction
Definition of porosity. Participating in sports is a daily routine for many individuals, whether they are amateurs or professionals. The selection of suitable and comfortable sportswear is a crucial element in achieving peak performance. Comfort, defined as the psychological sensation experienced during physical activity in the current environmental conditions, is paramount. Knitted fabrics are preferred in sportswear manufacturing due to their comfortable properties, characterized by high stretchability and low stress. Given that sports activities lead to the generation of heat and sweat through the contact of clothing with the body, it becomes essential to dissipate heat and release water vapor into the environment, influencing the wearer’s sense of comfort. This phenomenon is intricately tied to the porosity of the garment [
1].
The porosity of a fabric is defined as the ratio of the total void area of the fabric to the total surface area of the fabric. Porosity responds to various parameters such as fabric thickness, pore shape and size, and the distribution of space between threads.
Importance of porosity in clothing comfort. Porosity plays a pivotal role in enhancing clothing comfort through its multifaceted impact on various key factors. Primarily, the relationship between porosity and air permeability is crucial, as higher porosity allows for improved airflow through fabrics. This contributes significantly to heat dissipation and the maintenance of a comfortable microclimate between the fabric and the wearer’s skin.
Air permeability is an important factor in fabric comfort as it plays a role in the transport of moisture from the skin to the outside atmosphere, as water vapor travels mainly through the interstitial spaces of the fabric by diffusing air from one side of the fabric to the other [
2]. Air permeability depends on the structural parameters of the fabric and porosity, as described by Havlova and Špánková [
3].
Moreover, porosity influences moisture management by facilitating efficient wicking and evaporation of sweat, preventing the discomfort associated with damp or wet clothing. Benltoufa et al. confirmed that the amount of liquid absorbed by the garment, as well as the thermal comfort of clothing, are closely related to the pore size and distribution [
4].
Beyond functional aspects, the flexibility and stretchability of knitted fabrics are often heightened with higher porosity, enhancing ease of movement. Additionally, the overall feel and texture of a fabric are influenced by the arrangement and distribution of pores, creating a subjective sense of lightness and breathability. Ultimately, porosity is instrumental in tailoring clothing to be adaptable to different activities, ensuring that individuals experience optimal comfort across diverse settings and physical exertions.
Digital image analysis in porosity study. To delve deeper into exploration of porosity, digital image analysis emerges as an invaluable tool, offering a nuanced perspective on fabric structure. In the field of digital image analysis porosity is often investigated in terms of a cover factor. If porosity represents the total void area of the fabric, cover factor is the opposite measure, representing the proportion of the fabric’s surface covered by fibers or yarns.
Since the 1980s, it has been an ongoing mission of scientists to use image analysis for the evaluation of textile properties, including the porosity and description of pore size [
5]. The first attempts used to obtain images for textile evaluation were based on the use of a scanner, a microscope with a CCD camera, or a digital camera with a lens. Further attempts were focused towards calculated optical porosity by analyzing white and black images [
6,
7].
In the most recent studies, Ramatan et al. used digital image analysis to measure pore size. The study also included the investigation of the effect of pore size, pore volume, and air permeability on fluid retention and air transfer [
1].
The comparison of different algorithms that can be used to calculate the approximate porosity value of the fabric, such as air permeability calculation, digital image analysis, and geometric modeling, was a main topic of scientific interest of Bentoulfa et al. Their investigation indicated that the air permeability method is best for stretched fabric structures, digital image analysis for fabrics with high porosity, and geometric modeling for determining the shape of any structure’s conformation [
4].
Fouda et al. presented a method of image analysis for the determination of pore size distribution [
8]. Another group of scientists developed a theoretical model to predict the porosity and air permeability of the knitted fabric before production as a function of the following geometrical parameters: cross-sectional area of each pore, depth of each pore or fabric thickness, and number of pores per unit area [
2]. It has been shown that the proposed model can be used to predict porosity with high reliability.
Researchers also developed a computer program to calculate porosity based on the threshold used to convert a digital image from a grayscale to a binary scale and calculate pore size by counting pixels [
9].
When conducting the image analysis, image processing is extremely important to reduce the loss of data on the structure and size of individual pores. Owczarek described the influence and importance of image pre-treatment methods for interstitial pore (ITP) detection with the aim of accurately identifying each ITP tissue structure using an optimal pre-treatment algorithm for further quantitative morphometric structural analysis of specialized fabrics [
10]. As indicated, the main problem with ITP identification in image analysis was the misclassification of pixels that were close to the edges of the yarn, resulting in image noise among other problems.
Research focus. Against this backdrop, our research endeavors to contribute to this evolving dialogue on textile comfort by contributing to the digital image analysis field with application in knitted fabrics. We present five digital image analysis algorithms—the single threshold algorithm (ST) and two multiple threshold algorithms (ML and MT, each with two variants). The introduction of five new algorithms for calculating porosity is driven by the need for precision and applicability to the specific context of knitted fabric used for football, swimming, and outdoor wear. While existing algorithms may effectively calculate porosity in general scenarios, the intricacies of knitted fabrics necessitate tailored approaches.
Moreover, traditional methods for calculating cover factor and porosity of knitted fabrics can face difficulty when dealing with the inherent complexity of fabric images. This complexity includes variations in color, texture, and structure. To overcome this, we have developed multiple computational models, leveraging machine learning algorithms. These algorithms can investigate the intricacies of the samples and uncover patterns that may not be immediately apparent. Computational models developed in this research can predict the cover factor value based on the parameter specific for each knitted fabric. Through this approach, we aimed to improve the accuracy and efficiency of cover factor and porosity calculation in the textile industry.
3. Results
3.1. Cover Factor Results per Sample in a Dataset
Multiple samples of knitted fabrics in the F, S, and I series were analyzed using five algorithms: ML-1, ML-2, MT-1, MT-1, and ST. The results, specifically cover factors, are summarized in
Table 3,
Table 4, and
Table 5, respectively. The cover factor was calculated for a total of 22 knitted samples, each identified by a specific code (F1–F9, S1–S9, I1–I4). Multiple pictures of each sample were taken. Samples F1–F9 consisted of five photos each, as did samples S1, S3, S6, S8, and I1–I3. Samples S2, S4, S5, and S9 consisted of eight photos. Sample S7 consisted of ten photos and sample I4 consisted of four photos.
Table 3 features results for nine knitted samples in series F, labeled F1, F2, …, F9. Each row in the table corresponds to a specific sample from knitted samples, identified as F1-1, F1-2, …, F9-5, depending on how many photos of a knitted sample were obtained. The columns represent different algorithms for cover factor calculation. In each field a cover factor obtained for a sample using one of the five algorithms is noted. The value of a cover factor is expressed as a percentage. For example, for sample F1-1, the cover factor values obtained using the ML-1, ML-2, MT-1, MT-2, and ST algorithms are 86.30%, 83.13%, 86.63%, 82.04%, and 84.77%, respectively.
We can generalize that higher cover factors are preferable since they indicate lower porosity (although this generalization will be discussed and analyzed later in the paper).
Table 4 and
Table 5 consist of cover factors for the knitted samples in the S and I series, respectively. The structure of these tables is similar to
Table 3, with rows representing different samples and columns representing different algorithms.
Additional insights are provided by averaging the cover factors for all photos in each of the samples.
Table 6 presents the resulting cover factors obtained from all algorithms, accompanied by descriptive statistical parameters:
Arithmetic mean (AVG): the average cover factor value for each algorithm and sample.
Standard deviation (STDEV): the measure of the dispersion or variability of the cover factor values for each algorithm and sample.
Relative standard deviation (REL STDEV): the standard deviation expressed as a percentage of the arithmetic mean.
Minimum (MIN): the lowest cover factor value observed for each algorithm across all samples.
Maximum (MAX): the highest cover factor value observed for each algorithm across all samples.
Range (RANGE): the difference between the maximum and minimum values for each algorithm.
The table presents cover factor values (%) obtained by five algorithms (ML-1, ML-2, MT-1, MT-2, and ST) for different samples within three fabric series (F, S, and I).
Detailed analysis of parameters including the average, standard deviation, variance, minimum, maximum and range of each sample per each method is presented in
Supplementary Table S1.
Based on the results displayed in
Table 6, we observed that ML-1 generally has higher cover factor values compared to ML-2, MT-1, MT-2, and ST, across most samples. There is considerable variability in cover factor values within each fabric series and algorithm.
In the examination of fabric series, distinct trends emerge. In the football clothing (F series), ML-1 consistently exhibits elevated cover factor values, surpassing other algorithms. Notably, Sample F5 stands out with the highest range of cover factor values, reaching 6.61%. The swimwear (S series) also showcases ML-1’s tendency towards higher cover factor values, with Sample S5 demonstrating the most considerable variability, boasting a wide cover factor range of 32.00%. The differences are larger for samples S2, S4, S5, S7, S9, and I3. It should be noted that for these samples we encountered difficulties in determining cover factor. The fabric in sample S7 was dark. In samples S5 and S9, the fabric was two-colored, dark blue and white, which further complicated the calculation of porosity factor. Other challenges included the fact that the contrast algorithm greatly altered the photo (sample S4), the fabric was relatively porous (sample S2), or the structure of the fabric was irregular (sample I3), all of which made it very difficult to determine what was knitted and what was not (i.e., holes in the mesh). A more reliable cover factor could be calculated with the simple threshold algorithm, but with a higher threshold value than T = 200.
In contrast, the casual wear (I series) reveals a nuanced picture. While ML-1, ML-2, and ST exhibit comparable cover factor values, Sample I3 within this series displays a noteworthy range of cover factor values, indicating substantial variability at 11.98%. These fabric series analyses underscore the algorithmic nuances in capturing porosity, offering valuable insights into the distinctive characteristics of each series.
In algorithmic comparison, ML-1 consistently exhibits the highest average cover factor values, followed by ML-2, MT-1, MT-2, and ST. ML-2, MT-1, MT-2, and ST generally show lower variability (lower STDEV and REL STDEV) compared to ML-1.
To sum up, ML-1 tends to yield higher cover factor values compared to other algorithms. Variability in cover factor values suggests algorithmic sensitivity to the fabric structure or characteristics. Further statistical tests will be conducted to assess significant differences between algorithms. The observed differences may have implications for the choice of algorithm depending on the specific requirements of the application.
In
Figure 5, box-and-whisker plots have been made, representing obtained data for five algorithms across all samples.
3.2. Computational Models Based on Machine Learning for Cover Factor Prediction Based on Parameters of Knitted Fabric
In this section, we present computational models based on machine learning developed for predicting porosity in knitted fabrics using the knitted fabric parameters mass per unit area and thickness of knitted fabric. The regression model was implemented using WEKA 3.9.6 [
18] on a dataset with 127 instances of two attributes, mass per unit and thickness of the fabric, taken from
Table 2, and a class value for algorithm taken from
Table 3,
Table 4 and
Table 5.
A comprehensive comparative analysis of nine regression models created in Weka was conducted. The developed models were: (1) random tree, (2) random forest, (3) linear regression, (4) multilayer perceptron, (5) support vector machine (SMOreg in Weka), (6) k-nearest neighbor classifier (IbK in Weka), (7) K* (KStar in Weka), (8) additive regression, and (9) regression by discretization.
These models were employed with their default parameter as set in WEKA. Model evaluation was conducted using 10-fold cross-validation, wherein the dataset was randomly divided into 10 equal-sized subsamples. One subsample was utilized for model validation, while the remaining nine were employed for training the model, following the principles outlined in [
19]. Each experiment was iterated 10 times, each iteration employing a distinct random seed, resulting in a total of 100 results per model.
The results of the obtained correlation coefficients are presented in
Table 7. Correlation coefficients close to 1 indicate a strong linear relationship between the predicted and actual values. The asterisk sign (
*) in the superscript indicates the base model obtained a statistically higher result than the model it is compared to. The base model in this research is the random tree model. Similarly, the
v sign in the superscript indicates the base model obtained a statistically lower result than the model it is compared to. For example, a correlation coefficient value of 0.95 obtained by the random tree model is statistically significantly higher than the one obtained by the linear regression model at 0.51, with significance α = 0.05.
Linear regression and k-nearest neighbor classifier have comparatively lower correlations, while random tree, random forest, support vector machine, and K* show strong correlations. Although the latter four models might obtain results with similar accuracy and can be used for porosity prediction, the random tree model is shown in
Figure 6 due to its simplicity and error analysis in
Section 4.5.
4. Discussion
In this research, five algorithms were developed for cover factor calculation: ST and improvement algorithms MT-1, MT-2, ML-1, and ML-2. In this section, we delve into the development and comparison of cover factor calculation algorithms. Notably, ML and MT differ in threshold determination and subsequent pseudo-grayscale transformations. In ML-1, the grayscale range is evenly divided into eight parts, employing empirically chosen thresholds (T1 to T8) for creating a pseudo-grayscale image. Contrastingly, MT-1 utilizes the Otsu method for threshold calculation, optimizing the separation of porous and non-porous regions. Both algorithms then undergo a pseudo-grayscale to binary conversion, enhancing segmentation accuracy and accounting for image variations. This refinement allows for a more precise differentiation between the background and the fabric regions, leading to better identification and calculation of the cover factor.
An additional attempt to account for image variations was made with ML-2 and MT-2 algorithms. Fabric images can exhibit variations in color, texture, and complexity. By defining additional threshold ranges (1–6 as black and 7–8 as white), we account for such variations and adapt the segmentation algorithm to better handle the specific characteristics of their fabric images. These improvements, grounded in empirical observations, fine-tune the segmentation process, enabling more precise porosity calculation than the ST algorithm.
4.1. Assessing the Influence of Multiple and Adaptive Thresholding: Comparative Analysis of ML-1 and MT-1 with ST
In this part of the study, the influence of the adaptive thresholding processing steps on the performance of ML-1, MT-1, and ST algorithms is investigated across all samples. The goal was to assess hypothesis H1 that algorithms ML-1 and MT-1 will obtain higher cover factors than the basic algorithm with a fixed threshold ST. Visual comparison is presented in
Figure 5.
The statistical significance of the results was evaluated using the Wilcoxon signed-rank test, a non-parametric test for paired samples [
20]. Like other non-parametric tests, the Wilcoxon signed-rank test does not make any assumptions about the distribution of the differences, specifically the absence of a normal distribution assumption. This test is typically used when analyzing pairs of measurements from the same subjects under two different conditions, or when there exists a one-to-one relationship between the two samples, with each value in one group corresponding to one value in the other group. The Wilcoxon signed-rank test calculates the comparison between the positive and negative ranks of the differences [
21].
Null hypothesis of Wilcoxon signed-rank test claims there is no difference between the variables ML-1 [%] and ST [%]. Results indicated that there is a significant large difference between ST (median = 94.4, n = 127) and ML-1 (median = 96.4, n = 127), Z = 9.8, p < 0.001, r = 0.9, with significance level 0.95. The null hypothesis is thus rejected.
Results of the two-tailed Wilcoxon signed-rank test also indicated that there is a significant medium difference between MT-1 (median = 96, n = 127) and ST (median = 94.4, n = 127), Z = 9.8, p < 0.001, r = 0.9, with significance level 0.95. Null hypothesis that there is no difference between the variables MT-1 [%] and ST [%] is thus rejected.
Additionally, results of the Wilcoxon signed-rank test indicated that there is a significant medium difference between ML-1 (median = 96.4, n = 127) and MT-1 (median = 96, n = 127), Z = −4.8, p < 0.001, r = −0.4.
These findings suggest that utilizing the adaptive thresholding processing steps was effective in improving the performance of the algorithms for calculating porosity, thus making hypothesis H1 valid. Overall, the results underscore the importance of the adaptive thresholding processing steps in enhancing the accuracy and reliability of porosity calculations. The superiority of both ML-1 and MT-1 over ST highlights the potential of advanced algorithms and the validity of incorporating adaptive thresholding processing steps in porosity analysis.
4.2. Assessing the Impact of a Higher Threshold in ML-2 and MT-2 on Porosity Calculation: Comparison of ML-1 vs. ML-2 and MT-1 vs. MT-2 Algorithms
Accurately determining the cover factor of digital knitted fabric images presents its own set of challenges. One significant hurdle is the presence of stray yarns or fibers, posing difficulties in their distinction and introducing noise that can distort image analysis. These irregularities have the potential to impact cover factor precision, as the algorithm might misinterpret these stray elements. Additionally, variations in lighting conditions can cast shadows or shading, disrupting the perceived darkness or lightness of certain areas and significantly affecting the thresholding process. Recognizing these challenges, we pinpointed the selection of an appropriate threshold as a pivotal step in overcoming these issues. To tackle this, a larger threshold was integrated into the ML-1 and MT-1 algorithms, enhancing the accuracy of cover factor calculations.
As stated in
Section 2, algorithm versions indicated with “−2” were created to further refine the porosity calculation by transforming pixels with pseudo-grayscale values from 1 to 6 and categorizing them as black, while those with a value of 7 or 8 were set to white. By categorizing pixels with specific pseudo-grayscale values as black or white, we aimed to better differentiate between the regions representing porous and non-porous areas in the image. This simplification of the pixel values could help create a clearer boundary between porosity and non-porosity, thereby improving the accuracy of the porosity calculation by not including stray yarns that are present in the porosity holes due to their structure. In addressing these considerations and implementing necessary measures, our goal was to minimize the margin of error in determining the cover factor from digital yarn images.
In this section, we present the results of the statistical analysis of cover factor calculation algorithms: ML-1 vs. ML-2, and MT-1 vs. MT-2. The aim was to assess the validity of hypothesis H2. We test whether ML-2 and MT-2 will recognize the underlying knitted fabric structure and will obtain better results than their counterparts ML-1 and MT-1. Visual comparison is presented in
Figure 5.
To determine whether there were significant differences between the paired samples, the non-parametric Wilcoxon signed-rank test was employed [
20,
22]. The null hypothesis assumed no difference between the first and second version of each ML or MT model, while the alternative hypothesis suggested a significant difference between them.
Results of the two-tailed Wilcoxon signed-rank test indicated that there is a significant large difference between ML-1 (median = 96.4, n = 127) and ML-2 (median = 92.4, n = 127), Z = −9.8, p < 0.001, r = −0.9 at α = 0.05. Results also indicate that there is a significant large difference between MT-1 (median = 96, n = 127) and MT-2 (median = 89.5, n = 127), Z = −9.8, p < 0.001, r = −0.9, at α = 0.05.
The comparison between ML2 and MT2 and the results of the Wilcoxon signed-rank test indicated that there is a significant large difference between ML-2 (median = 92.4, n = 127) and MT-2 (median = 89.5, n = 127), Z = −7.3, p < 0.001, r = −0.7, with significance level 0.95.
Additionally, since the ML-1 [%] group had higher values than the ML-2 [%] group, we performed a one-tailed Wilcoxon signed rank. The null hypothesis that the variable ML-1 [%] has a smaller or equal value compared to the variable ML-2 [%] was tested using a one-tailed t-test for paired samples. The result was statistically significant, W = 0, p ≤ 0.001. The null hypothesis was rejected.
Lastly, the MT-1 [%] group had higher values than the MT-2 [%] group. The null hypothesis that the variable MT-1 [%] has a smaller or equal value compared to the variable MT-2 [%] was tested using a one-tailed t-test for paired samples. The result was statistically significant, at α = 0.05, W = 0, p ≤ 0.001. The null hypothesis is thus rejected, and hypothesis H2 has been confirmed.
When comparing the performance of two algorithms for porosity prediction, it is generally better to have a smaller porosity value, i.e., higher cover factor. A smaller porosity value indicates that there is less empty space and more solid fabric, which is often desired in various applications. However, despite the conventional preference for smaller porosity values, our research introduces a nuanced perspective. We believe that ML-2 and MT-2, despite yielding lower cover factor values (indicative of higher porosity) than ML-1 and MT-1, are anticipated to perform more effectively in capturing the true essence of fabric structure and to provide a more accurate representation of the actual fabric porosity, e.g., avoiding capturing stray yarns.
4.3. Analysis of Algorithmic Sensitivity to Cover Factor Calculations for Different Knitted Fabric Types
Fabrics designed for different purposes (football clothing—F, swimwear—S, and casual wear—I) inherently possess distinct structural features. These differences manifest in terms of cover factor and porosity, and algorithms capture these variations differently. Understanding the variations in cover factor across different fabric series is crucial for application-specific design, moisture management, and performance optimization. For example, certain sports demand specific fabric properties: swimwear benefits from quick-drying fabrics with high porosity while football clothing may require a balance between breathability and stretchability.
The primary objective of this study is to determine how sensitive each of the developed algorithms is to the specific fabric structure, by systematically comparing the cover factor values among distinct fabric series (
Figure 7). By doing so, we will assess H3 that assumes MT-1 algorithm, that uses Otzu adaptive thresholding method, will be the most sensitive algorithm in recognizing different fabric structures.
Since F, S, and I are three distinct knitted fabrics series, the cover factor value should also be statistically significantly different, and a sufficiently sensitive algorithm should be able to distinguish the groups. Due to the distinct distribution for ML-2 and MT-2 observed in
Figure 7, the hypothesis will be tested on the ML-1, MT-1, and ST algorithms.
To confirm this assumption, a non-parametric Kruskal–Wallis test was employed to assess the statistical difference of three fabric groups, F, S, and I, based on the cover factor results obtained by ML-1, MT-1, and ST [
20,
23]. Null hypothesis of the Kruskal–Wallis test is there is no difference between the three categories of the independent variable in terms of the dependent variable. The alternative hypothesis is there is a difference between the three categories of the independent variable in terms of the dependent variable.
For ML-1, the Kruskal–Wallis H test indicated that there is a significant difference in the dependent variable between the different groups, χ2(2) = 29.82, p < 0.001, with a mean rank score of 73.31 for F, 47.27 for S, 94.92 for I. The post-hoc Dunn’s test using a Bonferroni corrected at α = 0.017 indicated that the mean ranks of the following pairs are significantly different: F-S and S-I.
For MT-1, the Kruskal–Wallis H test indicated that there is a significant difference in the dependent variable between the different groups, χ2(2) = 30.16, p < 0.001, with a mean rank score of 71.82 for F, 47.71 for S, and 96.9 for I. The post-hoc Dunn’s test using a Bonferroni corrected α = 0.017 indicated that the mean ranks of the following pairs are significantly different: F-S, F-I and S-I.
For ST, the Kruskal–Wallis H test indicated that there is a significant difference in the dependent variable between the different groups, χ2(2) = 37.8, p < 0.001, with a mean rank score of 76.29 for F, 44.6 for S, 96.47 for I. The post-hoc Dunn’s test using a Bonferroni corrected α = 0.017 indicated that the mean ranks of the following pairs are significantly different: F-S and S-I.
The results of this study indicate that only the MT-1 algorithm can distinct the nuanced differences among knitted samples by recognizing series F, S, and I as statistically significantly different series, while ML-1 and ST recognize F-S and S-I as statistically significantly different series, therefore confirming H3.
Additional conclusions of this study are: (i) different algorithms interpret or quantify porosity in unique ways since they emphasize different aspects of the fabric structure, leading to variations in porosity calculations, (ii) some algorithms might be more sensitive to certain types of fabric structures or variations in porosity, and (iii) the yarn structure has an influence on the porosity levels observed in the fabric.
4.4. Comparison of Fixed Threshold vs. Adaptive Threshold Methods and Selection of Hyperparameter T
The choice of the threshold value T can significantly impact the performance of the algorithms. Using fixed threshold value for image segmentation has its benefits and drawbacks. One benefit of using a fixed threshold value, such as T = 200 in ST algorithm, is the simplicity it brings to the implementation. By choosing a specific threshold, the need for complex adaptive thresholding techniques is eliminated. This simplification makes the algorithms easier to understand and implement, reducing the complexity of the overall process.
Another advantage is the stability and reproducibility it offers in the results. When the same fixed threshold value is used across different datasets or experiments, the algorithms can produce consistent outcomes. This consistency facilitates easier comparison and analysis of the results, as researchers can rely on the stability of the threshold value.
However, there are also drawbacks to using fixed threshold values. One major drawback is the lack of adaptability. Fixed thresholds may not be optimal for all images or datasets. Different images can possess varying characteristics, such as differences in lighting, contrast, or noise levels. These variations can significantly affect the effectiveness of a fixed threshold. Consequently, a single threshold value may not be suitable for all situations, potentially leading to suboptimal segmentation results.
Furthermore, using a fixed threshold can make the algorithm sensitive to image variations. If the image quality changes or the characteristics of the objects being segmented vary, the chosen fixed threshold value may no longer be appropriate. This sensitivity to image variations can result in either over-segmentation (where objects are split into smaller regions) or under-segmentation (where objects are merged together), ultimately compromising the accuracy of the algorithm’s segmentation results.
We have chosen the value of T = 200 based on empirical observations and experimentation. In
Table 8, the results of the analysis of the samples using the simple threshold algorithm with threshold values other than 200 are listed for samples S4, S5, S7, and S9. In the case of sample S4, the contrast was not corrected and the threshold was set to T = 140. As for sample S5, the contrast was corrected but the threshold was set to T = 240. In the case of sample S7, the contrast was corrected and the threshold was set to T = 245. It is worth noting that photos 1 to 5 were taken before contrast enhancement, while photos 6 to 10 were taken after contrast enhancement, resulting in significant differences between these two subgroups. For the photos in sample S9, the contrast was corrected and the threshold was set to T = 240. The algorithm’s performance with different threshold values for specific samples was subsequently investigated, and the results of the obtained cover factors using ST algorithm are presented in
Table 8.
In the case of sample S4, a lower threshold value of T = 140 was experimented with, due to the uncorrected contrast in the photographs of sample S4. By reducing the threshold, an attempt was made to compensate for the lower contrast and potentially improve the segmentation results. For sample S5, although the contrast was corrected, the threshold was increased to T = 240. The higher threshold was chosen based on the specific image characteristics of sample S5, which required a higher threshold to accurately distinguish between foreground and background regions. Similarly, for sample S7, the contrast was corrected, and the threshold was set to T = 245. The threshold value was chosen based on the image characteristics of sample S7, requiring a higher threshold due to the specific properties of the objects in the image. In contrast, for sample S9, with corrected contrast, the threshold value of T = 240 was reverted to. Threshold T = 240 was found suitable for achieving satisfactory segmentation results for this sample.
After evaluating the algorithm’s performance on a representative set of images, it was determined that T = 200 yielded satisfactory results in terms of segmentation accuracy, computational efficiency, and ease of implementation.
However, we recognized the potential limitations of a fixed threshold and addressed that by developing algorithms that employ an adaptive thresholding technique (the Otsu method) to further expand on the ST algorithm. In this context, the simple threshold algorithm with T = 200 serves as a baseline for comparative purposes. By comparing the performance of the adaptive thresholding version (using Otsu’s method) to the fixed threshold version, the effectiveness of the adaptive approach can be assessed and it can be determined whether it provides superior segmentation results.
4.5. Error Analysis and Comparative Performance Evaluation of Machine Learning Models
This section presents an in-depth error analysis of the computational models presented in
Section 3.2. Since the primary focus is on understanding the correlation between various models and the actual porosity values of the knitted fabrics, the following metrics have been observed: the correlation coefficient across all models in
Table 7, mean absolute error (MAE), root mean square error (RMSE), relative absolute error (RAE), and root relative squared error (RRSE) in
Table 9.
Error analysis for algorithm MT-1 is presented in
Table 9 because it has been proven to be the most sensitive in
Section 4.3. Error analysis, however, has been performed on all 5 algorithms and they all support the conclusion in this section.
To determine the significance of differences between the predictive capabilities of the algorithms, a paired
t-test was employed in Weka, with significance α = 0.05. The random tree model served as a base model for statistical comparison shown in
Table 9. The asterisk sign (
*) in the superscript indicates the base model obtains statistically higher result than the model it is compared to. Similarly, the (
v) sign in the superscript indicates the base model obtains statistically lower result than the model it is compared to.
Mean absolute error (MAE) represents the average absolute difference between predicted and actual values. Lower MAE values indicate better model performance. Random tree, random forest, and support vector machine have low MAE, suggesting better accuracy.
Root mean square error (RMSE) provides a measure of the average magnitude of errors. Lower values are desirable. Random tree, random forest, support vector machine, and K* show lower RMSE, indicating better predictive performance.
Similar to MAE and RMSE, lower values are better for both relative metrics. Random tree, random forest, k-nearest neighbor classifier, and K* exhibit lower relative errors.
In conclusion, random tree, random forest, and support vector machine models exhibit strong performance across multiple metrics with non-significantly different results, hence confirming hypothesis H4.
5. Conclusions
In this research we introduced and explored five algorithms—ST, MT-1, MT-2, ML-1, and ML-2—to study cover factor and porosity in knitted fabrics, with focus on knitted fabrics for sportswear, swimwear, and casual wear. We have also created computational models based on machine learning algorithms for cover factor prediction based on knitted fabric structural parameters.
The common steps for all the developed algorithms include grayscale conversion, contrast enhancement, thresholding, pixel counting, and cover factor calculation. The key difference between them is threshold selection. The single threshold algorithm (ST) relies on a fixed threshold, offering simplicity in its approach. In contrast, the multiple linear threshold algorithms (ML-1 and ML-2) and multiple threshold algorithms with the Otzu method (MT-1 and MT-2) introduce additional threshold ranges to account for variations in color, texture, and complexity in the pseudo-grayscale image conversion step. In ML algorithms, the grayscale range is divided linearly to perform pseudo-grayscale transformations with empirically chosen thresholds, while in the MT algorithms the Otsu method is used for threshold calculation, optimizing porous and non-porous region separation.
In algorithmic comparison, ML-1 consistently exhibits the highest average cover factor values. Comparing fixed (ST) and adaptive threshold (ML and MT) algorithms highlighted the advantages of the simplicity and stability of a fixed threshold. Yet, exploring alternative adaptive algorithms like Otsu’s method suggests room for further refinement, acknowledging the limitations of fixed thresholds in adapting to diverse image characteristics. Our investigation into the impact of adaptive thresholding (ML-1 and MT-1) validated our hypothesis (H1) that these algorithms outperform the fixed threshold algorithm (ST). This emphasizes the pivotal role of adaptive steps in beefing up the accuracy and reliability of porosity calculations.
Tackling challenges related to stray yarns and lighting variations, the use of a higher threshold in ML-2 and MT-2 demonstrated superior recognition of fabric structure, supporting H2. Despite these algorithms yielding lower cover factors, they proved more effective in capturing the true essence of fabric porosity by minimizing errors linked to stray elements.
Our sensitivity analysis across different fabric types (F, S, and I) affirmed H3, with MT-1 showing sensitivity and recognizing distinct fabric series as statistically significant. Sensitivity to fabric variations makes MT-1 a valuable tool for considering specific design aspects in textile manufacturing.
Lastly, computational regression models based on machine learning have been developed that are able to predict cover factor based on knitted fabric parameters with high accuracy. Random tree, random forest, and SMOreg models exhibit strong performance across multiple statistical metrics.