Local Visage

Local Performer Recognition

A plugin for recognizing performers from their images using DeepFace. This plugin integrates seamlessly with Stash and enables automatic facial recognition by building or updating a local model trained from your existing image collection.

:magnifying_glass_tilted_left: Features

  • Rebuild Face Recognition Model
    Completely rebuild the local facial recognition model using available images per performer.

  • Update Face Recognition Model
    Incrementally updates the model if performers have fewer images than the configured target count.

  • Automatic Server Control
    Easily start or stop the recognition server as needed—automatically starts when an image is queried.

  • Identify
    Click on the new icon next to an image to trigger performer identification.

:package: Requirements

Docker Usage

Because this plugin relies on tensorflow (the AI framework used), the official Stash docker image can’t be used.
See this post for details.

A Dockerfile has been created as a replacement to use compatible dependencies.
You can find it in the plugin repository.

You have two options to use this image:

  • A working docker compose can be found in the plugin folder.
    • Only changes are the build section to use the modified Dockerfile, and a new port to expose that is the deepface server port (7860)
    • Use this command to rebuild your docker container: docker compose up -d --build --pull always
  • Build the image yourself
    • Run this to build it inside the plugin repo folder: docker build --pull -t stashapp/stash:LocalVisage -f Dockerfile .
    • Update your stash container configuration to expose a new port: docker run -p 7860:7860 ... stashapp/stash:LocalVisage ...

Once this image is built and running, you can skip the ā€œSet Python Pathā€ step below and enjoy the plugin!

[!note]
If you use a reverse proxy, you may encounter difficulties setting up the redirection to the deepface server.

URL used by the plugin is hardcoded inside the frontend.js file:

window.location.protocol + "//" + window.location.hostname + ":7860"

e.g. using https://stash.example.org will send requests to https://stash.example.org:7860.

But worse, using https://example.com/stash will use https://example.com:7860

:gear: Tasks

Task Description
Rebuild Face Recognition Model Fully rebuild the DeepFace model for all performers.
Update Face Recognition Model Add more images for performers with less than the target image count.
Start Server Start the local DeepFace server if it’s not already running.
Stop Server Gracefully stop the running recognition server.

:wrench: Settings

Setting Description
Target image count per voy Number of images to use per performer when training the model. Default is 15.

:rocket: Installation & Setup

1. Set Python Path to 3.10.11

To ensure compatibility with DeepFace and the plugin’s dependency resolution process:

  • Temporarily set the Python path in your system/environment to Python 3.10.11.

2. Rebuild the Model

Run the ā€œRebuild Face Recognition Modelā€ task. This will:

  • Set up a virtual environment
  • Install all necessary Python dependencies (DeepFace, etc.)
  • Build the recognition model

3. Restore Python Path (Optional)

Once setup is complete, you can revert your Python path to its original version. The plugin will continue working with the generated virtual environment.

:framed_picture: Usage

  1. Once the model is built, navigate to an image in your Stash UI.
  2. Click the Performer Recognition icon overlaying the image.
  3. The plugin will:
    • Automatically start the recognition server if it’s not already running
    • Query the server to identify the performer
    • Display the matched performer from the trained database
4 Likes

Thanks I commented on the issues

1 Like

Are there any good instructions for how I could install Python 3.10.11 in my Stash docker container? It looks like it’s currently running 3.12.

@Nonoty would you be interested in reviewing it?

I was able to get python3.10 into my container (Ended up just building it. If I finally get this working I can add some instructions)

However when I run Rebuild Face Recognition Model I’m now getting

2025-09-23 17:35:03Error   Plugin returned error: exit status 1
2025-09-23 17:35:03Error   [Plugin / Local Visage] subprocess.CalledProcessError: Command '['/root/.stash/plugins/community/LocalVisage/venv/bin/pip', 'install', '-r', '/root/.stash/plugins/community/LocalVisage/requirements.txt']' returned non-zero exit status 1.
2025-09-23 17:35:03Error   [Plugin / Local Visage]     raise CalledProcessError(retcode, cmd)
2025-09-23 17:35:03Error   [Plugin / Local Visage]   File "/usr/local/python3.10/lib/python3.10/subprocess.py", line 369, in check_call
2025-09-23 17:35:03Error   [Plugin / Local Visage]     subprocess.check_call([pip_exe, "install", "-r", requirements_path])
2025-09-23 17:35:03Error   [Plugin / Local Visage]   File "/root/.stash/plugins/community/LocalVisage/LocalVisage.py", line 39, in install_dependencies
2025-09-23 17:35:03Error   [Plugin / Local Visage]     install_dependencies()
2025-09-23 17:35:03Error   [Plugin / Local Visage]   File "/root/.stash/plugins/community/LocalVisage/LocalVisage.py", line 53, in <module>
2025-09-23 17:35:03Error   [Plugin / Local Visage] Traceback (most recent call last):
2025-09-23 17:35:00Error   [Plugin / Local Visage] ERROR: No matching distribution found for tensorflow==2.19.0
2025-09-23 17:35:00Error   [Plugin / Local Visage] ERROR: Could not find a version that satisfies the requirement tensorflow==2.19.0 (from versions: none)
2025-09-23 17:35:00Error   [Plugin / Local Visage] ERROR: Ignored the following versions that require a different python version: 1.16.0 Requires-Python >=3.11; 1.16.0rc1 Requires-Python >=3.11; 1.16.0rc2 Requires-Python >=3.11; 1.16.1 Requires-Python >=3.11; 1.16.2 Requires-Python >=3.11; 1.3.3 Requires-Python >=3.11; 1.6.2 Requires-Python >=3.7,<3.10; 1.6.3 Requires-Python >=3.7,<3.10; 1.7.0 Requires-Python >=3.7,<3.10; 1.7.1 Requires-Python >=3.7,<3.10; 2.3.0 Requires-Python >=3.11; 2.3.1 Requires-Python >=3.11; 2.3.2 Requires-Python >=3.11; 2.3.3 Requires-Python >=3.11; 3.5 Requires-Python >=3.11; 3.5rc0 Requires-Python >=3.11

Do you have 3.10.11 ? Like exactly this subversion.
Because what it says is it could install tensorflow for you python version and os
Could you also try deleting the venv folder and retry?

Yes.

(.venv) ~/.stash # python --version
Python 3.10.11

This venv is what my stash is pointing at for python.

I deleted the venv in LocalVisage and ran the Rebuild Face Recognition Model again.

Hitting a problem with git first

[Plugin / Local Visage]   Running command git clone --filter=blob:none --quiet https://github.com/serengil/deepface.git /tmp/pip-install-sjngovxz/

It looks like someone else was having that issue as well, but I’m not sure if they documented how they solved it.

I assume this only works for performers that are already in your local stash instance? What about new performers? I tried to use the cloud visage but that doesn’t seem to be working.

@maestra were you able to solve the issue with tensorflow install? Im running into the same thing!

I don’t understand your question. This is for local performers based on your own pictures. The cloud one is updated every now and then but I’m not the author of it .

1 Like

Same issue here with tensorflow install, seems like an update changed some requirements and now breaks dependency tree

Maybe in the requirements file replace all >= with == to see if that’s it

After some research and experiments, it seems like it comes from using the container image. I tried with a clean Python and only installing tensorflow without version requirements and it still fails.

Tensorflow builds are not compatible with alpine-based images which is the base used by the official Stash image (alpine uses musl-based symbols instead of the classic glibc-based symbols).

1 Like

I installed everything as pointed out in the readme.md. It looks like installing everything into the venv works fine, but then I am greeted with loads of errors as soon as the local images are being processed:

ERRO[2025-11-05 17:59:35] [Plugin / Local Visage] E0000 00:00:1762361975.021414  865056 cuda_dnn.cc:522] Loaded runtime CuDNN library: 9.1.0 but source was compiled with: 9.3.0.  CuDNN library needs to have matching major version and equal or higher minor version. If using a binary install, upgrade your CuDNN library.  If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration. 
WARN[2025-11-05 17:59:35] [Plugin / Local Visage] [WARN] Skipping /home/stash/src/stash/performer_db/26/480dcaa6-af41-425d-b2d9-f24f08aaa55a.jpg: Exception encountered when calling layer 'Conv2d_1a_3x3' (type Conv2D). 
ERRO[2025-11-05 17:59:35] [Plugin / Local Visage] w                  
WARN[2025-11-05 17:59:35] [Plugin / Local Visage] {{function_node __wrapped__Conv2D_device_/job:localhost/replica:0/task:0/device:GPU:0}} No DNN in stream executor. [Op:Conv2D] name: 
ERRO[2025-11-05 17:59:35] [Plugin / Local Visage] w                  
WARN[2025-11-05 17:59:35] [Plugin / Local Visage] Call arguments received by layer 'Conv2d_1a_3x3' (type Conv2D): 
WARN[2025-11-05 17:59:35] [Plugin / Local Visage] • inputs=tf.Tensor(shape=(1, 160, 160, 3), dtype=float32) 

Is there anything I might have missed? I’m running Linux 6.17.5 with a RTX 4070 with driver version 580.95.05.

The first line of your error says your using the wrong runtime version of cudn. Try updating

This took me way to long to figure out, wasted like half a day a few weeks back, compiling python and stuff, just to end up incompatible again. It’s probably easier to build a custom docker image based on a glibc-based distro with a recent ffmpeg and python.

@Nonoty the incompatibility with the docker version should probably be mentioned in the requirements

Thanks for letting me know.
I’m not using docker and didn’t find someone willing to test it before.

I’ve added what you said in the requirements so that people don’t waste time trying to make it work in docker [LocalVisage] Update requirements by Nonoty Ā· Pull Request #628 Ā· stashapp/CommunityScripts Ā· GitHub

Finding even one version that worked with all requirements was a challenge that I spent over a week tackling. I think until visage starts using something else than tensorflow we won’t be able to run it locally easily..

It works on windows at least.