Binary image classifier for buildings/roads with cracks or not.
Trained on https://data.mendeley.com/datasets/5y9wdsg2zt/2
Simple CNN classifier based on this tutorial https://www.youtube.com/watch?v=jztwpsIzEGc
The project contains
- train.py -> Run to train against the Crack dataset (which is also checked in this repo)
- is_crack.py -> Accepts an image of a building/road and verifies if there is a crack in that image.
- Install python 3 https://www.python.org/downloads/
- Install piphttps://pip.pypa.io/en/stable/installation/
- Run in command line
pip install tensorflow tensorflow-gpu opencv-python matplotlib argparse
While I have already pre trained a model and checked it into the models directory, you can run train.py again to create a new model (in case you want to add or subtract training data pictures). Note this is a very slow operation without significant GPU power (it took me 40 mins to train this entire data set on an Apple M1 Pro 10 core 32 gig ram machine : https://support.apple.com/kb/SP858?locale=en_US)
Run the is_crack.py like this
python3 is_crack.py --image_path="./Crack/Positive/00010.jpg"
1/1 [==============================] - 0s 40ms/step
The picture has a crack in it
python3 is_crack.py --image_path="./Crack/Negative/00010.jpg"
1/1 [==============================] - 0s 40ms/step
The picture has no crack in it
The input --image_path is the fully qualified file path where your input image should reside. The output has two lines, one for the time taken for classification and the other output on whether there is a crack or not.