UPDATE(5/20/2019): That took longer than expected. I've finished porting over to PyTorch in the pytorch
branch. I still have to obtain some decent results. Would require some hyperparameter tuning. Feel free to train your own models, shouldn't take longer than a couple of hours on CPU.
UPDATE(3/23/2019): Currently porting this to PyTorch as I'm out of touch with TensorFlow. Should be done in a week.
This repository contains the code for crack detection in concrete surfaces. It is a TensorFlow implementation of the paper by by Young-Jin Cha and Wooram Choi - "Deep Learning-Based Crack Damage Detection Using Convolutional Neural Networks".
The model acheived 85% accuracy on the validation set. A few results are shown below -
MATLAB was used to prepare the data. Regions of Interest were sliced into smaller 128 x 128 pixel images and used for training -
Dependencies required-
- TensorFlow
- OpenCV
- Dataset -The data set can be downloaded from this link
The dataset.py file creates the training dataset class to be fed into the Convolutional Neural Network. This class automatically determines the number of classes by the number of folders in 'in_dir' (number of folders=number of classes)
NOTE: This script utilizes an already saved cache file. The cache file contains the filenames of the data. If the cache file doesn't exist, a new one created. If the data has been altered with, please delete the old cache file and run the script again. This applies for both Running.py
and Train_CD.py
. This was my first ever Deep Learning project hence, the naive approach. I'll streamline this once I get some time, or gladly accept a pull request!
The directory structure is assumed to be the following- (For example considering 3 classes)
- in_dir/class1/ - Contains all the training images for class 1
- test/ - Contains all the validation images for class 1
- test/ - Contains all the validation images for class 1
- in_dir/class2/ - Contains all the training images for class 2
- test/ - Contains all the validation images for class 2
- test/ - Contains all the validation images for class 2
- in_dir/class3/ - Contains all the training images for class 3
- test/ - Contains all the validation images for class 3
- test/ - Contains all the validation images for class 3
To train the network run the command with the following arguments:
python Train_CD.py
Argument | Details | Default |
---|---|---|
--in_dir |
path to in_dir folder | cracky |
--iter |
number of iterations to run the model for | 1500 |
--save_folder |
Directory to save checkpoint | CURRENT_DIR |
After model has been trained, meta_files are saved into 'save_folder'. To test the model, run the command with the following arguments:
python Running.py
Argument | Details | Default |
---|---|---|
--in_dir |
directory containing unlabeled test data | cracky_test |
--meta_file |
MetaFile path | None (Will throw error if not given) |
--CP_dir |
dir contatining checkpoint | None (Will throw error if not given) |
--save_dir |
dir to save output images | CURRENT_DIR |
- Streamline data loading; remove cache file system
- Combine training and testing scripts into one