/sevimon

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

Русский | English

Table of contents

Introduction

Running in Docker in Linux

Running in macOS

Running binary versions on Windows 10 and later

Install and run universal interpreted versions of programs

Project files license

Acknowledgements

Introduction

Sevimon is a set of open source programs written in Python. It allows facial muscle tension to be monitored through a video camera, which can be used to eliminate overstretching, indirectly influence mood and, with long-term use, prevent the appearance of facial wrinkles.

The basic sevimon program works as follows: first a face is detected on the image from the video camera, then a certain evaluation of the facial expression is given for each of the eight emotions (anger, contempt, disgust, fear, joy, no emotion, sadness, surprise). If necessary, the sevicfg setup program allows you to select one of several video cameras installed in the system.

The values obtained are stored in the logbook in text format for later analysis by the sevistat program. In addition, for each emotion in the settings file, the upper and lower limits of the values can be set and a reminder is given when these are crossed. The settings file, whose name is displayed on start-up, can be changed in any text editor, or you can use the sevicfg graphical utility to configure it. The default setting is to give a warning when anger and surprise are detected, which corresponds to a frown on the eyebrows and a wrinkled forehead.

The models are downloaded the first time you start, after which an internet connection is not required.

Running in Docker in Linux

Prepared a Docker image with the program, all its dependencies and models, which runs without access to the network.

The sevimon program is run as follows:

mkdir -p ~/.local/state/sevimon/log/
mkdir -p ~/.config/sevimon/
echo > ~/.config/sevimon/sevimon.cfg
xhost +"local:docker@"
docker run -it --rm --privileged \
    --net=none \
    -e DISPLAY=$DISPLAY \
    -e LANG=$LANG \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -v $HOME/.Xauthority:/root/.Xauthority \
    -v $HOME/.config/sevimon/sevimon.cfg:/root/.config/sevimon/sevimon.cfg \
    -v $HOME/.local/state/sevimon/log:/root/.local/state/sevimon/log \
    -v /dev/video0:/dev/video0 \
    ioctl2/sevimon:latest sevimon
xhost -"local:docker@"

The sevistat program is started with a command:

xhost +"local:docker@"
docker run -it --rm --privileged \
    --net=none \
    -e DISPLAY=$DISPLAY \
    -e LANG=$LANG \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -v $HOME/.Xauthority:/root/.Xauthority \
    -v $HOME/.config/sevimon/sevimon.cfg:/root/.config/sevimon/sevimon.cfg \
    -v $HOME/.local/state/sevimon/log:/root/.local/state/sevimon/log \
    ioctl2/sevimon:latest sevistat
xhost -"local:docker@"

The sevicfg program is started as follows:

xhost +"local:docker@"
docker run -it --rm --privileged \
    --net=none \
    -e DISPLAY=$DISPLAY \
    -e LANG=$LANG \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -v $HOME/.Xauthority:/root/.Xauthority \
    -v $HOME/.config/sevimon/sevimon.cfg:/root/.config/sevimon/sevimon.cfg \
    -v $HOME/.local/state/sevimon/log:/root/.local/state/sevimon/log \
    ioctl2/sevimon:latest sevicfg
xhost -"local:docker@"

Running in macOS

To run on macOS, python with the python-tk package must be installed. Python for macOS from the official website already includes the python-tk. The following is one way to install via the brew package manager from the beginning. Run these commands in the terminal:

# Download and install the brew package manager and follow the recommended configuration steps
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install python and python-tk
brew install python@3.12
brew install python-tk@3.12

# Install sevimon package
pip3.12 install sevimon --break-system-packages

# Run the utilities from the terminal as follows
# Grant camera access permission if requested
/usr/local/bin/sevimon
/usr/local/bin/sevicfg
/usr/local/bin/sevistat

Programs may require you to provide terminal access to the camera and file system to store settings and logs.

Running binary versions on Windows 10 and later

Prepared binary program builds with all its dependencies for Windows (x86_64). Models are automatically downloaded the first time you run it.

Install and run universal interpreted versions of programs

Preparatory steps for Linux/UNIX

Install the python and python-pip packages from the distribution.

Preparatory steps for Windows

Install package python along with built-in pip.

In case of lack of DLL at startup, install MS Visual C.

Run Powershell by typing Win+X and selecting to run as a normal user.

Installation and startup

Install the project with all dependencies:

python3 -m pip install sevimon

Warnings may appear during the process asking to add the executable path to the environment variables - this should be done.

Use the sevimon command to start the main program. The first run downloads the models and creates a text configuration file. You can run the program sevicfg to configure it. Use the command sevistat to display statistics. It must have been accumulated for at least 2 hours beforehand.

Project files licence

AGPL v3 or newer.

Acknowledgements

The Centerface project is used to search for faces in an image. The HSEmotion project is used for emotion detection.