pibooth-background-changer
Plugin pour pibooth permettant de supprimer automatiquement le fond des photos et de le remplacer par un fond personnalisé.
Fonctionnalités
- Suppression automatique du fond par IA (utilise rembg)
- Choix parmi plusieurs fonds personnalisés
- Navigation entre les fonds avec les boutons tactiles ou les flèches gauche/droite
- Option "Sans fond" pour garder la photo originale
- Activation/désactivation à la volée
- Bandeau d'information avec miniature du fond sélectionné
- Auto-masquage du bandeau après quelques secondes
- Détection automatique du GPU (NVIDIA CUDA, Intel OpenVINO, AMD ROCm, Apple CoreML)
- Sélection automatique du modèle optimal selon la plateforme
Installation
Prérequis
- Python 3.7+
- pibooth 2.0+
Installation standard
pip install pibooth-background-changer
Installation avec support GPU
# NVIDIA GPU (CUDA)
pip install pibooth-background-changer[gpu-nvidia]
# Intel GPU (OpenVINO)
pip install pibooth-background-changer[gpu-intel]
# AMD GPU (DirectML - Windows)
pip install pibooth-background-changer[gpu-amd-windows]
# AMD GPU (ROCm - Linux)
pip install pibooth-background-changer[gpu-amd-linux]
# Apple Silicon (CoreML)
pip install pibooth-background-changer[gpu-apple]
Installation depuis les sources
git clone https://github.com/ceeeeb/pibooth-background-changer.git
cd pibooth-background-changer
pip install -e .
Configuration
Ajoutez vos images de fond dans le dossier configuré (par défaut ~/.config/pibooth/backgrounds/).
Options de configuration
Dans ~/.config/pibooth/pibooth.cfg :
[BACKGROUND_CHANGER]
# Chemin vers le dossier contenant les images de fond
backgrounds_path = ~/.config/pibooth/backgrounds
# Activer le remplacement de fond au démarrage
enabled = True
# Modèle IA pour la suppression de fond
# Options: auto, silueta, u2netp, u2net, u2net_human_seg, isnet-general-use
# "auto" sélectionne automatiquement le meilleur modèle pour votre plateforme
model = auto
# Traiter les captures individuelles (True) ou seulement l'image finale (False)
process_captures = True
Modèles disponibles
| Modèle | Taille | Vitesse | Qualité | Recommandé pour |
|---|---|---|---|---|
silueta |
4 MB | Très rapide | Bonne | Raspberry Pi |
u2netp |
4 MB | Rapide | Bonne | CPU lent |
u2net_human_seg |
176 MB | Moyen | Très bonne | Portraits |
u2net |
176 MB | Moyen | Excellente | Desktop |
isnet-general-use |
178 MB | Lent | Excellente | GPU puissant |
Détection automatique
Avec model = auto, le plugin sélectionne automatiquement :
- Raspberry Pi :
silueta(rapide, léger) - Desktop/GPU :
isnet-general-use(meilleure qualité)
Accélération GPU supportée
| GPU | Provider ONNX | Installation |
|---|---|---|
| NVIDIA | CUDA / TensorRT | onnxruntime-gpu |
| Intel | OpenVINO | onnxruntime-openvino |
| AMD (Windows) | DirectML | onnxruntime-directml |
| AMD (Linux) | ROCm | onnxruntime-rocm |
| Apple Silicon | CoreML | onnxruntime-coreml |
Raspberry Pi
Limitations du VideoCore VI
Le GPU VideoCore VI du Raspberry Pi 4/5 n'est pas directement supporté par ONNX Runtime. Le plugin utilise donc le CPU avec un modèle optimisé (silueta).
Optimisations pour Raspberry Pi
- Modèle léger : Le mode
autosélectionnesilueta(~4 MB) - Résolution réduite : Traitement à 640x480 par défaut
- RAM : Minimum 2 GB recommandé
Configuration recommandée pour Raspberry Pi
[CAMERA]
resolution = (640, 480)
[BACKGROUND_CHANGER]
model = silueta
enabled = True
Temps de traitement estimés (Raspberry Pi 4)
| Modèle | Résolution | Temps |
|---|---|---|
| silueta | 640x480 | ~3-5 sec |
| u2netp | 640x480 | ~5-8 sec |
| u2net | 640x480 | ~15-20 sec |
Utilisation
- Lancez pibooth normalement
- En mode attente, utilisez les boutons tactiles ou les flèches GAUCHE/DROITE pour changer de fond
- Le bandeau affiche le fond sélectionné avec une miniature
- Le fond sera automatiquement appliqué aux photos prises
Contrôles
- Bouton
<ou Flèche GAUCHE : Fond précédent - Bouton
>ou Flèche DROITE : Fond suivant - "Sans fond" : Option par défaut pour garder la photo originale
Formats d'images supportés
- JPEG (.jpg, .jpeg)
- PNG (.png)
- BMP (.bmp)
- GIF (.gif)
- WebP (.webp)
Dépannage
Le plugin ne se charge pas
Vérifiez que rembg est installé :
pip install rembg
Traitement trop lent
- Utilisez le modèle
silueta:
model = silueta
- Réduisez la résolution de la caméra :
[CAMERA]
resolution = (640, 480)
- Installez le support GPU si disponible
Erreur de mémoire sur Raspberry Pi
model = silueta
Vérifier l'accélération GPU
Les logs affichent le provider utilisé :
Available ONNX providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']
Using CUDA (NVIDIA GPU) acceleration
Licence
MIT License
Crédits
- pibooth - Framework photobooth
- rembg - Suppression de fond par IA
- ONNX Runtime - Inférence optimisée
Metadata
Release files for pibooth-background-changer 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pibooth_background_changer-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for pibooth_background_changer-1.1.0-py3-none-any.whl |
Release files / pibooth_background_changer-1.1.0-py3-none-any.whl
| Download URL | pibooth_background_changer-1.1.0-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efb5cd7b6160d5bbc476a240c025f2ae45bb82d564220c2d904540f9e94b5cd1
|
|
BLAKE2b-256 checksum How to use checksums |
2cab1681b3cd11af25b17b562c63623cc04c84dbcf0868f0739ca4671da529fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for pibooth-background-changer 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.