How to use the fer.classes.Peltarion_Emotion_Classifier function in fer

To help you get started, we’ve selected a few fer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github justinshenk / fer / src / fer / fer.py View on Github external
self.__session = tf.Session(config=self.config, graph=self.__graph)

            # with tf.Session(graph=K.get_session().graph, config=self.config) as sess:
            self.__emotion_classifier = load_model(emotion_model, compile=compile)
            self.__emotion_classifier._make_predict_function()
            self.__emotion_target_size = self.__emotion_classifier.input_shape[1:3]

        elif "http" in emotion_model:
            self.deployment = True
            url = os.environ.get("EMOTION_API_URL")
            token = os.environ.get("EMOTION_API_TOKEN")
            assert (
                url is not None and token is not None
            ), "EMOTION_API_URL and EMOTION_API_URL must set in the environment"
            self.__emotion_classifier = Peltarion_Emotion_Classifier(url, token)
            self.__emotion_target_size = (48, 48)  # Default FER image size
        else:
            raise Exception(f"{emotion_model} is not a valid type")
        logging.debug("Emotion model: {}".format(emotion_model))

fer

Facial expression recognition from images

MIT
Latest version published 2 years ago

Package Health Score

42 / 100
Full package analysis