Skip to content

phylun/GenKDCrack

Repository files navigation

Semantic segmentation using generative knowledge distillation for crack detection

This repo is the pytorch implementation of the following paper:

The detailed paper will be updated when the publication is completed. The most highlight of this proposed method is to improve m-IoU and F1 without any additional crack image. The generated knowledge plays a role of a new crack image. This knowledge is transferred to crack detection newtork, then the accuracy is increased regrardless of newtork architecture.

This codes are inspired by Jun-Yan Zhu*, Taesung Park*, Phillip Isola, and Alexei A. Efros. "Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks", in IEEE International Conference on Computer Vision (ICCV), 2017. In particular, 'option' based implementation is heavily borrowed from their code (Link).

The full dataset is provided by Bianchi, Eric; Hebdon, Matthew (2021). Concrete Crack Conglomerate Dataset. University Libraries, Virginia Tech. Dataset. This dataset can be download at (Link). This code has been implemented to operate using sample from original data.

Please cite this paper if the code helps your research.

@article{Shim_AUTCON_2025,
  title={Semantic segmentation for crack detection via generative knowledge distillation},
  author={Shim, Seungbo},
  journal={Automation in Construction},
  volume={175},
  pages={106201},
  year={2025},
  publisher={Elsevier}
}

Prerequisite

  • CUDA 12.1
  • pytorch == 2.1.2
  • python-opencv == 4.9.0.80
  • matplotlib == 3.8.2

Installation

git clone https://github.com//phylun/GenKDCrack.git

Download dataset

Download the sample dataset via the link (Link). Unzip it into the folder dataset_sample

dataset_sample/labeled/trainConc/JPEGImages
                                /SegmentationClass
                      /valConc/JPEGImages
                              /SegmentationClass
                      /testConc/JPEGImages
                               /SegmentationClass
              /unlabeled/trainConc/JPEGImages

Pre-trained model for knowledge distillation

This code needs pre-trained weight models for teacher networks. The teacher networks are FRRNA and FRRNB whose weights can be downloaded via (Link) and (Link), respectively. Move them in the folder pretrained

Training on sample dataset

python EnsemKD_SegTrain.py --name project_name \
                           --Snet RegSeg \
                           --n_epoch 3000 \
                           --consist_weight 0.001 \
                           --gpu_ids 0

Use your own project name (e.g. KDEnsem_FRRNAB_RegSeg). Snet means segmenation model. In this code, eight models are provided such as CGNet, FDDWNet, ERFNet, DDRNet, RegSeg, PIDNet, Deeplabv3p, and LEDNet.

In case of supervised learning, use the below script

python Super_SegTrain.py --name project_name \
                         --Snet RegSeg \
                         --gpu_ids 0

Evaluate the segmentation model on sample dataset

python SegTest.py --name project_name \
                  --Snet RegSeg \
                  --gpu_ids 0

This script evaluates the accuracy for all saved models in the folder outputs/project_name with valConc. When the option of --epoch 100, then 100th saved model is called and m-IoU is assessed. Also, adding --phase test, the accuracy of m-IoU and F1 is evaluated by testConc

Changelog

  • April 08th, 2024: Updated by author

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages