FaceChannel.FaceChannelV1 Model Definition

FaceChannel.FaceChannelV1.FaceChannelV1 module

FaceChannelV1.py

Version1 of the FaceChannel model.

class FaceChannel.FaceChannelV1.FaceChannelV1.FaceChannelV1(type='Cat', loadModel=True, numberClasses=7)

Bases: object

BATCH_SIZE = 32

Batch size used by FaceChannelV1

CAT_CLASS_COLOR = [(255, 255, 255), (0, 255, 0), (0, 222, 255), (255, 0, 0), (0, 0, 255), (255, 0, 144), (0, 144, 255), (75, 75, 96)]

Color associated with each output of the pre-trained categorical model

CAT_CLASS_ORDER = ['Neutral', 'Happiness', 'Surprise', 'Sadness', 'Anger', 'Disgust', 'Fear', 'Contempt']

Order of the pre-trained categorical model’s output

DIM_CLASS_COLOR = [(0, 255, 0), (255, 0, 0)]

Color associated with each output of the pre-trained dimensional model

DIM_CLASS_ORDER = ['Arousal', 'Valence']

Order of the pre-trained dimensional model’s output

DOWNLOAD_FROM = 'https://github.com/pablovin/FaceChannel/raw/master/src/FaceChannel/FaceChannelV1/trainedNetworks.tar.xz'

URL where the model is stored

IMAGE_SIZE = (64, 64)

Image size used as input used by FaceChannelV1

buildFaceChannel()

This method returns a Keras model of the FaceChannelV1.rst feature extractor.

Returns

a Keras model of the FaceChannelV1.rst feature extractor

Return type

tensorflow model

getCategoricalModel(numberClasses)

This method returns a categorical FaceChannelV1.rst.

Returns

a dimensional FaceChannelV1.rst

Return type

tensorflow model

getDimensionalModel()

This method returns a dimensional FaceChannelV1.rst.

Returns

a dimensional FaceChannelV1.rst

Return type

tensorflow model

loadModel(modelDirectory)

This method returns a loaded FaceChannelV1.rst.

Parameters

modelDirectory – The directory where the loaded model is.

Returns

The loaded model as a tensorflow-keras model

Return type

tensorflow model

predict(images, preprocess=True)

This method returns the prediction for one or more images.

Parameters
  • images – The images as one or a list of ndarray.

  • preprocess – If the image is already pre-processed or not. a pre-processed image has a format of (64,64,1).

Returns

The prediction of the given image(s) as a ndarray

Return type

ndarray