Skip to content

causeri3/selfusion-pi

Repository files navigation

Selfusion

Repository for an art installation

(made for Fusion / Bornhack 2025)


Bornhackers: Check out http://151.216.66.159:8000/docs


Takes automated selfies, generates more pictures from that, and plays a bouncing gif.


Online Mode Example

sdxl-turbo_online-mode.mov

Offline Mode Examples

Waiting Screens

Screenshot 2025-07-03 at 08 17 57 Screenshot 2025-07-03 at 08 43 01

Using:


Settings / Args

See all arguments:

  • with uv uv run selfusion.py --help
  • standard python selfusion.py --help

Most interesting settings you will find in selfusion_utils.args, such as:

  • gif delay
  • waiting time
  • loading bar time
  • come closer screen or not
  • face size threshold
  • yolo settings (confidence, IoU)
  • diffuser settings (strength, inference steps, prompt ...)

Another bit that's might be fun: Adding more style pictures — they are picked randomly.
You can find them in neural_style_transfer.style_images.


Hardware

  • Raspberry Pi 5 (16GB)

Software

Dependencies

SDXLTurbo API

It's meant to work with sdxlturbo-api hosted on some machine (runs well with mps on my Mac or cuda on a cloud VM with GPU - if you want you can test just the sdxlturbo code straight on Colab with T4, was super easy).

Anyway, it still has offline functionality. If it cannot get results from the Stable diffusion API, it generates pictures with neural style transfer on the local machine / the pi.

Linux

sudo apt-get install libgtk2.0-dev pkg-config

Python

The raspberry had python 3.11 preinstalled

pip install -r requirements.txt

Gets it running.

Or even better if you use uv, run in the directory of this repo:

uv venv --python 3.11
uv pip install -r requirements.txt

Note: Some of the code in this repo was used for experimentation (such as the stable-diffusion folder or yolo_onnx_openvino.py, they need more dependencies, so most directories have their own requirements files)


Run

  • with uv uv run selfusion.py

  • standard python selfusion.py

Systemd

I run it as systemd service:

[Unit]
Description=Fusion Raspberry Process
After=graphical-session.target

[Service]
Type=simple
WorkingDirectory=/home/pi/src/raspberry-pi
ExecStart=/home/pi/src/selfusion_venv/bin/python /home/pi/src/selfusion/selfusion.py
Restart=on-failure
RestartSec=5
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/pi/.Xauthority

[Install]
WantedBy=default.target

that file goes under: ~/.config/systemd/user/fusion.service

run service

systemctl --user daemon-reload
systemctl --user enable fusion.service
systemctl --user start fusion.service

This project is licensed under AGPL v3+

Releases

No releases published

Packages

No packages published

Languages