Giter Club home page Giter Club logo

image-classification's Introduction

TensorFlow Keras Pandas scikit-learn

A CNN Approach to Classifying Concrete Crack with MobileNetV2

There are several common forms of concrete cracks, including hairline cracks that typically appear in concrete foundations as the concrete dries, shrinkage cracks that arise when the concrete dries, and settlement cracks that occur as part of the concrete moves. When the earth beneath the slab is not compacted adequately, concrete might sink, and structural flaws can appear as a result of poor construction. If not quickly detected and corrected, concrete fractures can jeopardize a building's stability and safety. As such building a model which can accurately predict the cracks as they happen is crucial.

Transfer learning is used in the creation of this project to speed up the training phase by utilizing a pretrained model called the MobileNetV2.

Steps Taken

Step 1 - Data loading

The image dataset obtained from Çağlar Fırat Özgenel is loaded into the project and split between training and validation at a ratio of 80:20 using Keras.

Step 2 - Data inspection

A few images from the train dataset are displayed to make sure that the images are loaded properly.


Sample image of the data in the train dataset.

Step 3 - Data preparation

The validation dataset is split again into a validation and test dataset. All three datasets are then converted into Prefetch Dataset. An image augmentation layer is then defined with random flip, random rotation, and random zoom function. The image augmentation layer is then tested by applying it to an image and displaying the image after it had been augmented.


Image augmented by the image augmentation layer.

Step 4 - Model development

MobileNetV2 is used as the base model for the project. The preprocess input for the MobileNetV2 is used as the normalization layer precede by the image augmentation layer that was created in the previous step. A classifier with a GlobalAveragePooling2D, a Dropout layer, and a Dense layer is made to classify the output obtained from the base model. Three callback functions are used during the model training namely, TensorBoard, EarlyStopping, ReduceLROnPlateau, and ModelCheckpoint. The training process of the model is monitored through TensorBoard.


Accuracy changed during model training with the pink line as training and the green line as validation.

Step 5 - Model evaluation

The model is evaluated with a classification report and the detailed results of the prediction made by the model are shown in the Results section below.

Step 6 - Model saving

The model is saved into an h5 file to be loaded for deployment.

Results

The classification report created with the prediction made by the model can be seen below. The model scored 96% and 97% in F1-score and 97% in accuracy.



Classification report for the prediction made by the model.

Usage steps

To run the python file, you need to download the dataset from here and extract it into a new folder named dataset in the project path.
The path of the dataset folder should be <PROJECT_PATH>/dataset/Concrete Crack Images for Classification/

Model Architecture



Acknowledgement

A huge thanks to Çağlar Fırat Özgenel for sharing the dataset used for this project!
Thanks to the team who develop and publish the MobileNetV2 model used in this project.

image-classification's People

Contributors

syahmizainudin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.