Skip to content

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weakly supervised surface crack localization using Pytorch

This approach uses a traditional CNN for crack classification and Grad-CAM for crack localization. The whole procedure can be found in this Medium article.

Requirements

  • Pytorch (>=1.9)
  • torchvision (>=0.4)
  • cv2
  • pil
  • matplotlib

We will create class activation maps to highlight the crack location. To create class activation map using the grad-cam method you need to install the package simply by typing:
pip install grad-cam

Getting started

At first clone this repository and install the required dependencies.
To train the network:

python train.py

An example inference command:

python inference.py

To generate grad-cam visual explanation (heat maps) run the following:

python xai.py

Customizing dataset

The procedure for using your own dataset is very simple. Just prepare the dataset in the same way shown inside the directory folder data/. You can also increase the number of classes as you need. All you need to change the final layer of the architecture.

Sample classification Results

Visualization Demo

Sample grad-cam visualization / Crack localization

Visualization grad-cam

About

Surface crack classification and grad-cam visualization

Topics

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages