2.2.7. Raised Foundation Classification

2.2.7.1. What is Raised Foundation Classification

The code in this package enables to see if a building is elevated on piles piers or posts (PPP).

For classification, the path of a folder holding the images has to be supplied. The result will be a comma separated value file in that folder, listing the filenames, classification (1: elevated, 0: not elevated), and the confidence of the prediction.

2.2.7.2. Use the module

A pretrained model is shipped with BRAILS. So you can use it directly without training your own model.

The first time you initialize this model, it will download the model from the internet to your local computer.

The images used in the example can be downloaded from here.

# import the module
from brails.modules import FoundationHeightClassifier

# initialize a roof classifier
model = FoundationHeightClassifier()

# define the paths of images in a list
from glob import glob
imgs = glob('image_examples/Foundation/*/*.jpg')

# use the model to predict
predictions = model.predict(imgs)

The predictions look like this:

Image :  a.jpg     Class : 1 (52.5%)
Image :  b.jpg     Class : 1 (56.36%)
Image :  c.jpg     Class : 0 (83.4%)
Image :  d.jpg     Class : 0 (63.43%)
Results written in file tmp/FoundationElevation.csv

The images used in this example are:

../../../_images/a.jpg

Fig. 2.2.10 Elevated

../../../_images/b.jpg

Fig. 2.2.11 Elevated

../../../_images/c.jpg

Fig. 2.2.12 Not Elevated

../../../_images/d.jpg

Fig. 2.2.13 Not Elevated

This module is currently under active development and testing. Currently, for the data set used, classification reaches an F1-score of 72% on a random test set that holds 20% of the data. Further optional code to improve the quality and speed of the classification is available. More details about the training, modification, improvement of this module can be found here.

Note

The classifier takes an image as the input and will always produce a prediction. Since the classifier is trained to classify only a specific category of images, its prediction is meaningful only if the input image belongs to the category the model is trained for.