py-feat / svm_emo

huggingface.co
Total runs: 0
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: September 02 2024
image-feature-extraction

Introduction of svm_emo

Model Details of svm_emo

svm_emo

Model Description

svm_emo combines histogram of oriented gradient feature extraction with a linear support vector machine to predict emotional face expressions from single frame images.

Model Details
  • Model Type : Support Vector Machine (SVM)
  • Framework : sklearn
Model Sources
Citation

If you use the svm_emo model in your research or application, please cite the following paper:

Cheong, J.H., Jolly, E., Xie, T. et al. Py-Feat: Python Facial Expression Analysis Toolbox. Affec Sci 4, 781–796 (2023). https://doi.org/10.1007/s42761-023-00191-4

@article{cheong2023py,
  title={Py-feat: Python facial expression analysis toolbox},
  author={Cheong, Jin Hyun and Jolly, Eshin and Xie, Tiankang and Byrne, Sophie and Kenney, Matthew and Chang, Luke J},
  journal={Affective Science},
  volume={4},
  number={4},
  pages={781--796},
  year={2023},
  publisher={Springer}
}
Example Useage
import numpy as np
from skops.io import dump, load, get_untrusted_types
from huggingface_hub import hf_hub_download

class EmoSVMClassifier:
    def __init__(self, **kwargs) -> None:
        self.weights_loaded = False
        
    def load_weights(self, scaler_full=None, pca_model_full=None, classifiers=None):

        self.scaler_full = scaler_full
        self.pca_model_full = pca_model_full
        self.classifiers = classifiers
        self.weights_loaded = True

    def pca_transform(self, frame, scaler, pca_model, landmarks):
        if not self.weights_loaded:
            raise ValueError('Need to load weights before running pca_transform')
        else:
            transformed_frame = pca_model.transform(scaler.transform(frame))
            return np.concatenate((transformed_frame, landmarks), axis=1)      

    def detect_emo(self, frame, landmarks, **kwargs):
        """
        Note that here frame is represented by hogs
        """
        if not self.weights_loaded:
            raise ValueError('Need to load weights before running detect_au')
        else:
            landmarks = np.concatenate(landmarks)
            landmarks = landmarks.reshape(-1, landmarks.shape[1] * landmarks.shape[2])

            pca_transformed_full = self.pca_transform(frame, self.scaler_full, self.pca_model_full, landmarks)
            emo_columns = ["anger", "disgust", "fear", "happ", "sad", "sur", "neutral"]
    
            pred_emo = []
            for keys in emo_columns:
                emo_pred = self.classifiers[keys].predict(pca_transformed_full)
                pred_emo.append(emo_pred)
    
            pred_emos = np.array(pred_emo).T
            return pred_emos            

# Load model and weights
emotion_model = EmoSVMClassifier()
model_path = hf_hub_download(repo_id="py-feat/svm_emo", filename="svm_emo_classifier.skops")
unknown_types = get_untrusted_types(file=model_path)
loaded_model = load(model_path, trusted=unknown_types)
emotion_model.load_weights(scaler_full=loaded_model.scaler_full, 
                           pca_model_full=loaded_model.pca_model_full, 
                           classifiers=loaded_model.classifiers)

# Test model
frame = "path/to/your/test_image.jpg"  # Replace with your loaded image
landmarks = np.array([...])  # Replace with your landmarks data
pred = emotion_model.detect_emo(frame, landmarks)
print(pred)

Runs of py-feat svm_emo on huggingface.co

0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About svm_emo huggingface.co Model

More svm_emo license Visit here:

https://choosealicense.com/licenses/mit

svm_emo huggingface.co

svm_emo huggingface.co is an AI model on huggingface.co that provides svm_emo's model effect (), which can be used instantly with this py-feat svm_emo model. huggingface.co supports a free trial of the svm_emo model, and also provides paid use of the svm_emo. Support call svm_emo model through api, including Node.js, Python, http.

py-feat svm_emo online free

svm_emo huggingface.co is an online trial and call api platform, which integrates svm_emo's modeling effects, including api services, and provides a free online trial of svm_emo, you can try svm_emo online for free by clicking the link below.

py-feat svm_emo online free url in huggingface.co:

https://huggingface.co/py-feat/svm_emo

svm_emo install

svm_emo is an open source model from GitHub that offers a free installation service, and any user can find svm_emo on GitHub to install. At the same time, huggingface.co provides the effect of svm_emo install, users can directly use svm_emo installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

svm_emo install url in huggingface.co:

https://huggingface.co/py-feat/svm_emo

Url of svm_emo

svm_emo huggingface.co Url

Provider of svm_emo huggingface.co

py-feat
ORGANIZATIONS

Other API from py-feat

huggingface.co

Total runs: 6.5K
Run Growth: -667
Growth Rate: -10.34%
Updated:September 02 2024
huggingface.co

Total runs: 3.4K
Run Growth: -632
Growth Rate: -18.38%
Updated:September 02 2024
huggingface.co

Total runs: 34
Run Growth: -2
Growth Rate: -6.25%
Updated:September 02 2024
huggingface.co

Total runs: 33
Run Growth: -6
Growth Rate: -18.75%
Updated:September 02 2024
huggingface.co

Total runs: 1
Run Growth: 0
Growth Rate: 0.00%
Updated:September 02 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:August 01 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:May 07 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:July 30 2024
huggingface.co

Total runs: 0
Run Growth: 2
Growth Rate: 100.00%
Updated:September 02 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:May 02 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:September 02 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:August 01 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:May 02 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:June 27 2026
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:May 07 2026