This GitHub Repository was produced to share material relevant to the Journal paper "Automatic crack classification and segmentation on masonry surfaces using c
This GitHub Repository was produced to share material relevant to the Journal paper "Automatic crack classification and segmentation on masonry surfaces using c
This GitHub Repository was produced to share material relevant to the Journal paper Automatic crack classification and segmentation on masonry surfaces using convolutional neural networks and transfer learning by D. Dais, İ. E. Bal, E. Smyrou, and V. Sarhosis published in Automation in Construction.
While in the paper models were trained both for patch classification and pixel segmentation, in the herein repository only the codes for crack segmentation are made available for the time being. Extra material regarding the patch classification will be added in the future.
A sub-set of the masonry dataset used in the paper is made available as well in the dataset folder.
Ιndicative examples of photos from our masonry dataset can be found in the folder dataset_sample.
The paper can be downloaded from the following links:
In case you use or find interesting our work please cite the following Journal publication:
D. Dais, İ.E. Bal, E. Smyrou, V. Sarhosis, Automatic crack classification and segmentation on masonry surfaces using convolutional neural networks and transfer learning, Automation in Construction. 125 (2021), pp. 103606. https://doi.org/10.1016/j.autcon.2021.103606.
@article{Dais2021,
author = {Dais, Dimitris and Bal, İhsan Engin and Smyrou, Eleni and Sarhosis, Vasilis},
doi = {10.1016/j.autcon.2021.103606},
journal = {Automation in Construction},
pages = {103606},
title = {{Automatic crack classification and segmentation on masonry surfaces using convolutional neural networks and transfer learning}},
url = {https://linkinghub.elsevier.com/retrieve/pii/S0926580521000571},
volume = {125},
year = {2021}
} Author and Moderator of the Repository: Dimitris Dais
For further information please follow me in the below links
LinkedIn: https://www.linkedin.com/in/dimitris-dais/
Email: [email protected]
ResearchGate: https://www.researchgate.net/profile/Dimitris_Dais2
Research Group Page: https://www.linkedin.com/company/earthquake-resistant-structures-promising-groningen
YouTube Channel: https://www.youtube.com/channel/UCuSdAarhISVQzV2GhxaErsg
Your feedback is welcome. Feel free to reach out to explore any options for collaboration.
Crack detection for masonry surfaces
Table of Contents
Publication - Brief Preview
| --- Image patch classification for crack detection
| --- Crack segmentation on pixel level
How to download and run the code
Configuration file
Build data
Train
Evaluate
Acknowledgements
References
The aim of this study is to examine deep learning techniques for crack detection on images from masonry walls. A dataset with photos from masonry structures is produced containing complex backgrounds and various crack types and sizes. Different deep learning networks are considered and by leveraging the effect of transfer learning crack detection on masonry surfaces is performed on patch level with 95.3% accuracy and on pixel level with 79.6% F1 score. This is the first implementation of deep learning for pixel-level crack segmentation on masonry surfaces.
Different state of the art CNNs pretrained on ImageNet are examined herein for their efficacy to classify images from masonry surfaces on patch level as crack or non-crack.
U-net, a deep Fully Convolutional Network (FCN), and Feature Pyramid Networks (FPN), a generic pyramid representation, are considered herein and combined with different pretrained CNNs performing as the backbone of the encoder part of the network. Moreover, other networks found in the literature and performed well in crack segmentation are examined as well.
| Schematic representation of the encoder-decoder architecture of Fully Convolutional Networks.. |
| Schematic representation of Feature Pyramid Network. |
| Illustration of the architecture of U-net as implemented in the herein study. |
| The original image, the ground truth and the prediction with U-net-MobileNet. |
Simply download the code and copy it your desired folder path.
In order to use the code you need to define the Configuration file (config_class.py) suitably.
There are three modes:
To use the Build data mode you need to run the build_data.py file while the Train and Evaluate modes are implemented with the train_evaluate.py file. See the documentation below for extra info.
In the Configuration file (config_class.py) you can define the parameters that will be used when running the code.
See below some examples of different parameters that can be defined:
# Define the mode that will be used when running the code
self.mode = 'evaluate' # 'train', 'evaluate' or 'build_data'
# Info that will be used as prefix of any output files
self.info = 'crack_detection'
# Dimensions of the images that will be fed to the network
self.IMAGE_DIMS = (224 , 224 , 3)
# Batch size
self.BS = 4
# Number of epochs to train the model
self.epochs = 10
# Initial learning rate
self.INIT_LR = 0.0005When the Train mode is used, define which network to be used. The options are:
…In order to use the Deeplabv3 network copy model.py to the networks folder.
In order to use the DeepCrack network copy edeepcrack_cls.py and indices_pooling.py to the networks folder.
In order to use the Segmentation Models use the pip install method as shown in in the corresponding GitHub repository.
| Networks folder. |
Is it possible to select among the following Loss Functions:
# Define Loss Function
# 'Focal_Loss'
# 'WCE': Weighted Cross-Entropy
# 'BCE': Binary Cross-Entropy
# 'F1_score_Loss'
# 'F1_score_Loss_dil': Background pixels predicted as cracks (FP) are considered as
# TP if they are a few pixels apart from the annotated cracks
# Refer to the Journal paper for extra clarification
self.args['loss'] = 'WCE'Under the folder dataset there are two sub-folders with the images and the corresponding masks.
Execute the build_data.py to split the dataset into train and validation set and create HDF5 files that can be easily accessed when in Train and Evaluate modes. The output folder will be created and the output files will be stored in the hdf5 sub-folder.
It is noted that the output folder will be created automatically after executing the code.
Use the Build data mode by suitably setting the **[config_class.py](https://github.com/dimitrisdais/crack_detection_CNN_masonry/blo
No open issues yet, or sync has not completed.