27 lines
2.1 KiB
Plaintext
27 lines
2.1 KiB
Plaintext
The folder to edit: /media/suman/Backup_of_extra_/Sasi/Flowers_images/Templates
|
|
(this is config.TEMPLATE_IMAGES_DIR — currently template1.png, template2.png, template4.png, template5.png, template6.png)
|
|
|
|
Add a new template
|
|
Copy the new photo into that folder (.png, .jpg, .jpeg, .bmp, or .webp all work). Give it a clean name — that filename (without extension) becomes its display name in the gallery and in match results, e.g. template7.png → shown as "Template7".
|
|
Restart the server (see below).
|
|
Remove a template
|
|
Delete its file from that folder.
|
|
Also delete its matching cached file at /media/suman/Backup_of_extra_/Sasi/featureTransform/cache/templates_nobg/<name>.png (harmless if you skip it — it's just an orphaned cache file wasting a little disk space — but tidy to remove).
|
|
Restart the server.
|
|
Replace a template's photo but keep the same filename
|
|
This is the one case that needs an extra step: the background-removal cache is keyed by filename only, not the image content. If you overwrite template4.png with a different photo but don't touch the cache, the app will keep using the old cutout and old matching features.
|
|
|
|
Overwrite the file in the Templates folder.
|
|
Delete the stale cache file: rm /media/suman/Backup_of_extra_/Sasi/featureTransform/cache/templates_nobg/template4.png
|
|
Restart the server.
|
|
(Simplest blanket rule if you're changing several templates at once: just wipe the whole cache folder — rm -f /media/suman/Backup_of_extra_/Sasi/featureTransform/cache/templates_nobg/* — and let it rebuild on next startup.)
|
|
|
|
Why a restart is required
|
|
The homepage gallery re-scans the folder on every page load, so it'd show new files immediately — but the actual matching pipeline (SIFT/ORB keypoints, SuperPoint features, LoFTR tensors, per-template masks) is precomputed once at server startup and held in memory for speed. Adding/removing files on disk doesn't touch that in-memory set until the process restarts and reruns bootstrap().
|
|
|
|
To restart:
|
|
|
|
|
|
pkill -f "python3 app.py" # or: kill <pid> from `ps aux | grep app.py`
|
|
cd /media/suman/Backup_of_extra_/Sasi/featureTransform
|
|
python3 app.py |