Giter VIP home page Giter VIP logo

concrete-crack-classification-model's Introduction

Concrete Crack Classification with Tensorflow Keras API

The dataset with all the images used in this project was downloaded from Mendeley Data:

Özgenel, Çağlar Fırat (2018), “Concrete Crack Images for Classification”, Mendeley Data, v1 http://dx.doi.org/10.17632/5y9wdsg2zt.1

Dataset: Concrete Crack Images for Classification

File: Concrete Crack Images for Classification

DOI: http://dx.doi.org/10.17632/5y9wdsg2zt.1#file-c0d86f9f-852e-4d00-bf45-9a0e24e3b932

Using the Tensorflow Keras API, a Convolutional Neural Network model was trained on the scaled down images of concrete labeled as "Positive" or "Negative" for concrete surfaces with a crack or not.

The dataset consists of 40000 concrete surface images split in 20000 labeled "Positive" and 20000 labeled "Negative". The images have been reduced in quality and are actually fragments of much higher quality images.

This repository contains 3 python files. One for the data pre-processing, managing the directories and image sizes, one for the model architecture and training proccess and another one for using an already trained model for predicting one image of your choice. This last one requires a model file that is generated by the second python file.

It uses a Convolutional Neural Network made with Tensorflow Keras API, using GPU for training. It's structured with 3 Convolutional layers, the first with 16 filters and the other two with 32 nodes, each one followed by Max Pooling and Dropout layers. Then, it has a Flatten layer followed by a Fully Connected layer with 64 nodes and finally the Output layer. The activation function used for all layers was ReLU (Rectified Linear Unit), except for the output layer where the Sigmoid function was used.

Since it's a binary classification, the loss function used is binary cross-entropy. The optimizer used is Adam and the adopted batch size 64.

How to use the files

Preparing the data - Concrete Crack Classification Data Prep.py

First, you have to run this Python script. Here, the data will be pre-processed. You'll need to have the image files from the dataset separated into two folders, one called "Positive" and the other called "Negative", with the respective image files in each one. IMPORTANT: There are strings that you'll have to manually change to the directory on your computer.

Training the model - Concrete Crack Classification Model.py

Here, you will load the data that you prepered with the first script and train the CNN model. The model here is built using tf.Keras. This script will train and save the model in a file that you can load whenever you want (the next script will be doing this). IMPORTANT: Here, you'll also have to manually input some directories to save the model and load the data saved previously.

Predicting with your own images - Concrete Crack Classifier - Trained Model.py

With this script, you will be able to test the model with your own images. The program will handle image dimensions and colors, so you can simply especify the directory and image file name for it to work. The result plot will look something like this:

Trained CNN output

concrete-crack-classification-model's People

Contributors

vbrodrigues avatar

Watchers

 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.