Giter Club home page Giter Club logo

strs-metric's Introduction

Spot-Then-Recognize Score (STRS) Metric for Micro-Expression

Overview

This repository contains a Python script designed to calculate the metrics based on given prediction and ground-truth data. The metrics include:

  • F1-score for Spotting Task.
  • F1-score for Analysis Task.
  • Spot-then-Recognize Score (STRS): This is the product of the F1-scores from Spotting Task and Analysis Task.

Installation

pip install -r requirements.txt

Usage

python main.py

Brief Example

import pandas as pd
from strs_metric import Evaluator

pred_df = pd.DataFrame(
    columns=["subject", "video", "onset", "offset", "emotion"],
    data=[
        [1, "EP02_01f", 10, 70, "happiness"],
        [1, "EP03_02", 100, 170, "others"],
        [1, "EP04_02", 0, 70, "others"],
        [2, "EP01_11f", 20, 90, "happiness"],
        [2, "EP02_04f", 70, 140, "happiness"],
    ]
)

gt_df = pd.DataFrame(
    columns=["subject", "video", "onset", "offset", "emotion"],
    data=[
        [1, "EP02_01f", 45, 85, "happiness"],
        [1, "EP03_02", 130, 160, "others"],
        [1, "EP04_02", 20, 75, "others"],
        [2, "EP01_11f", 45, 95, "repression"],
        [2, "EP02_04f", 30, 140, "repression"],
    ]
)

evaluator = Evaluator()
res = evaluator.evaluate_STRS(pred_df, gt_df)
print("STRS:", round(res["STRS"], 4)) # STRS: 0.2

Reference Paper

@article{liong2023spot,
  title={Spot-then-recognize: A micro-expression analysis network for seamless evaluation of long videos},
  author={Liong, Gen-Bing and See, John and Chan, Chee-Seng},
  journal={Signal Processing: Image Communication},
  volume={110},
  pages={116875},
  year={2023},
  publisher={Elsevier}
}

strs-metric's People

Contributors

genbing99 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.