package

Submodules

app module

timbr wood classification flask app

app.index()[source]

flask index.html endpoint

app.predict(fullpath=None)[source]

predicts the material type of provided image

Parameters:fullpath (str) – fullpath of image file
Returns:dict of results
Return type:dict
app.save_histogram(source, destination, colorspace='rgb')[source]

saves rgb or hsv hostograms of source image to destination

Parameters:
  • source (str) – fullpath of source image
  • destination (str) – fullpath of destination image
  • opt (colorspace) – colorspace of histogram acceptable values: ‘rgb’, ‘hsv’ default: ‘rgb’
Returns:

None

Return type:

None

model module

contains the TextureClassifier class used for predicting the material type of a supplied texture

class model.TextureClassifier(db_path, model_name)[source]

Bases: object

classification_report(info)[source]

process each image in info and compile a classification report for all of them

Parameters:info (DataFrame) – info object which lists images to be processed
Returns:classification report
Return type:DataFrame
get_data(fullpath)[source]

processes image file

Parameters:fullpath (str) – fullpath to image file
Returns:data
Return type:DataFrame
get_results(pred)[source]

converts predictions into results

Parameters:pred (numpy.array) – output of self._model.predict(data)
Returns:list – results
Return type:of dicts
info

compiled information about data in db_path/images and db_path/descriptions.json

Returns:info object
Return type:DataFrame
predict(filepath)[source]

predict the material type of provided image file

Parameters:fullpath (str) – fullpath to image file
Returns:list – results
Return type:of dicts
set_model(filename)[source]

sets TextureClassifier’s internal model to given .pkl model

Returns:None
Return type:None