**4. Python-based ML-material classification model**

In this section of the chapter, a small exercise has been performed to detect construction materials via ML algorithm for the preview of the readers to the practical application of ML in material classifications for construction progress monitoring. The exercise has been executed by using the resources available as open-source on the internet. The simple ANN model has been adopted, developed by Adrian Rosebrock [25] using Python under Keras and TensorFlow environment [26]. Moreover, the construction materials datasets for the images have been collected from the opensource GitHub repository for concrete blocks, asphalt, wood, and bricks [27]. The selected model performed the classification of construction materials in two phases. In the first phase, the model has been trained with the help of collected datasets, and in the same phase, validation of the model has been performed. The adopted ANNbased model splits 75% data for training purpose and the remaining 25% data for validation/testing. In the training phase of the model, the images of each construction item have been placed in the separate folders labelled as the name or ID of that particular construction material. The model analyses the colour, texture and geometrical aspects of images under each construction material ID and trains its memory for each construction material separately against the given name or ID. The same model validates or tests itself on the assigned images, to verify the model effectiveness for the predictions. If the model fails to give an effective validation run, either model needs to be trained more or model structure needs to be reviewed. In the second phase, the model has been applied to predict and identify construction materials on randomly selected images from the internet. The predictive model uses the memory of the trained model to predict construction item on the input image. Moreover, for improving the training model, the number of ANN hidden layers and epochs per run can be increased in the model, which enhances the output results for accuracy and decreases the data loss [28]. Therefore, to observe the effects of varying epochs per run on the predictive model, the performance of the model has been tested on two different scenarios of epochs per run, i.e., 150 and 300.

#### **4.1 Model training and testing**

The training of the ANN model was performed on the images datasets of each construction material, i.e., concrete blocks, asphalt, wood, and bricks, with each

*Material Classification via Machine Learning Techniques: Construction Projects Progress… DOI: http://dx.doi.org/10.5772/intechopen.96354*

dataset comprised of 50 images. As the model has been designed to train on 75% of the provided data; therefore, for each construction item, the model was trained on 38 images. The remaining 12 images were used by the model for validation or testing. Two different models were trained on varying epochs per run, i.e., 150 and 300. The first model, with 150 epochs per run, attained the accuracy of 56% as shown in **Figure 3**, where its graphical representation for the attainment of model accuracy and loss can be seen in **Figure 4**. It can be seen that 'Asphalt' in this model got '0' (zero) value for precision and F1 score. The maximum precision and F1 score have been attained for wood (precision = 0.75, F1 score = 0.80). Whereas, the lowest precision and F1 score have been achieved by concrete block (precision = 0.35, F1 score = 0.56).

In the second model, the epochs per run for the model was set to 300, and 64% model accuracy was attained. The attained model accuracy, data loss along with precision, recall and F1 score can be seen in **Figure 5**, where the graphical representation of the training data for the attainment of model accuracy and loss for 300 epochs can be seen in **Figure 6**. The accuracy and F1 score of the second model,


#### **Figure 3.**

technical summary of collected studies for their main features, achieved outcomes,

**4. Python-based ML-material classification model**

different scenarios of epochs per run, i.e., 150 and 300.

The training of the ANN model was performed on the images datasets of each construction material, i.e., concrete blocks, asphalt, wood, and bricks, with each

**4.1 Model training and testing**

**194**

In this section of the chapter, a small exercise has been performed to detect construction materials via ML algorithm for the preview of the readers to the practical application of ML in material classifications for construction progress monitoring. The exercise has been executed by using the resources available as open-source on the internet. The simple ANN model has been adopted, developed by Adrian Rosebrock [25] using Python under Keras and TensorFlow environment [26]. Moreover, the construction materials datasets for the images have been collected from the opensource GitHub repository for concrete blocks, asphalt, wood, and bricks [27]. The selected model performed the classification of construction materials in two phases. In the first phase, the model has been trained with the help of collected datasets, and in the same phase, validation of the model has been performed. The adopted ANNbased model splits 75% data for training purpose and the remaining 25% data for validation/testing. In the training phase of the model, the images of each construction item have been placed in the separate folders labelled as the name or ID of that particular construction material. The model analyses the colour, texture and geometrical aspects of images under each construction material ID and trains its memory for each construction material separately against the given name or ID. The same model validates or tests itself on the assigned images, to verify the model effectiveness for the predictions. If the model fails to give an effective validation run, either model needs to be trained more or model structure needs to be reviewed. In the second phase, the model has been applied to predict and identify construction materials on randomly selected images from the internet. The predictive model uses the memory of the trained model to predict construction item on the input image. Moreover, for improving the training model, the number of ANN hidden layers and epochs per run can be increased in the model, which enhances the output results for accuracy and decreases the data loss [28]. Therefore, to observe the effects of varying epochs per run on the predictive model, the performance of the model has been tested on two

The general workflow of ML material classification model, via images, is shown in **Figure 2**. In the training process, the model is usually trained with the help of datasets of construction material images. The segmentation process is performed on the collected images, as segmentation increases the performance output of the model as compared to non-segmented images [24]. GMM technique can also be utilised for image segmentation. The feature extraction is performed on the segmented images for their colour, texture, compactness, contrast. Researchers mostly have adopted HSV, RGB (red, green and blue), Image patch (IP), 48-dimensional form (LM), and 18-dimensional rotationally invariant form (rLM) for features extraction and found better results with LM + HSV combination [9]. Depending upon the type of model, clustering process can be adopted, and on this data any ML classifier can be applied for model training. While testing the model for any random material image, the segmentation and feature extraction processes are performed, which are further identified with the help trained ML model for final material recognition output.

and observed limitation if any.

*Deep Learning Applications*

*Training/testing model output for 150 epochs per run.*

**Figure 4.** *Graphical representation of model accuracy and loss for 150 epochs per run.*


#### **Figure 5.**

*Training/testing model output for 300 epochs per run.*

models (150 epochs and 300 epochs) along with the model prediction probability

**Input image Model prediction for 150 epochs**

> probability = 36.13% (inaccurate)

*Material Classification via Machine Learning Techniques: Construction Projects Progress…*

probability = 63.63% (accurate)

probability = 36.20% (accurate)

probability = 47.52% (inaccurate)

**Model prediction for 300**

probability = 42.40% (accurate)

probability = 93.08% (accurate)

probability = 31.08% (accurate)

Concrete Block probability = 43.70% (accurate)

Asphalt

**epochs**

Brick

Wood

It can be illustrated from the results that ANN model performance has been enhanced and increased by increasing epochs per runs. Model predictions for the construction materials against the training model with 150 epochs were mostly inaccurate, which can be seen in 'Brick' and 'Asphalt'. Whereas, for the same input images, the model predictions were accurate and reliable with more prediction probability against the trained model with 300 epochs. Thus, the outcome of the predictive model is dependent on the structure of the trained ANN model.

The emergence of automation and IoT, in the construction sector, have regained the interest of professional and research community towards ML techniques. The ML technologies are now being adopted in many construction processes and one of which is construction progress monitoring. The theme of this chapter was designed to overview the application of material classification via ML techniques and their implication in the construction automated progress monitoring. For the achievement of this study objective, a small structured review was performed to collect relevant studies from WoS and Scopus. Overall, 14 studies were found relevant, where the majority of studies were performed for the multi-classification of construction materials using digital images. Moreover, the classification of material has also been performed based on proprioceptive force data. ANN and SVM models have been found most effective ML techniques for classification, and these techniques have also been integrated with BIM for effective construction processes control. For the better understanding of the readers to the practical implementation of ML techniques, a small experiment for multi-classification of construction materials (brick, asphalt, concrete block, and wood) using Python has also been included in this chapter. A simple ANN-based model was trained on the dataset of the

percentage.

*Summary of predictive model.*

**Table 5.**

**Construction material**

Brick Wood

*DOI: http://dx.doi.org/10.5772/intechopen.96354*

Wood Wood

Asphalt Wood

Concrete Block Concrete Block

**5. Conclusions**

**197**

#### **Figure 6.**

*Graphical representation of model accuracy and loss for 300 epochs per run.*

with the increased epochs, was better than the first model, which validates the enhanced performance of the ANN on increasing the epochs per run.

It can be seen that maximum precision and F1 score have been attained for wood (precision = 0.93, F1 score = 0.93), and brick (precision = 0.88, F1 score = 0.78. Whereas, the lowest precision has been achieved by concrete block (precision = 0.35) and F1 score by asphalt (F1 score = 0.42).

#### **4.2 Predictive model**

The output of the predictive model is much dependent on the training of the model. For the testing of the predictive model, random images were collected from the internet for each. i.e., concrete block, asphalt, wood and brick. The selected predictive model utilised the memory output of the trained model and predicted the material along with its probability. The model predictions were observed for both trained models, i.e., 150 epochs and 300 epochs. **Table 5** shows the summary and comparison of the predictive model against the input images for both trained

*Material Classification via Machine Learning Techniques: Construction Projects Progress… DOI: http://dx.doi.org/10.5772/intechopen.96354*


**Table 5.** *Summary of predictive model.*

models (150 epochs and 300 epochs) along with the model prediction probability percentage.

It can be illustrated from the results that ANN model performance has been enhanced and increased by increasing epochs per runs. Model predictions for the construction materials against the training model with 150 epochs were mostly inaccurate, which can be seen in 'Brick' and 'Asphalt'. Whereas, for the same input images, the model predictions were accurate and reliable with more prediction probability against the trained model with 300 epochs. Thus, the outcome of the predictive model is dependent on the structure of the trained ANN model.
