r/NextCloud • u/Ixiondt • 21h ago
Photo sweep: clean up a Nextcloud photo library with a local vision model
I had 37,000 photos in Nextcloud, full of screenshots, memes, forwarded WhatsApp copies and pocket shots. Duplicate finders that go by filename or file hash missed most of the copies, because a forward of a photo is a different file. So I built this.
It runs a vision model on your own GPU through Ollama and sorts everything into screenshots, memes, documents, junk, blurry and clutter. It also finds duplicates by what the picture shows, in two tiers: true copies, which you can clear in one go (each group always keeps its best version), and burst shots, which you pick by hand. Deletes go through Nextcloud's own API into Deleted files, so everything is restorable for the retention period. Nothing leaves your network.
Honest limits: Docker needs file access to the photo folder: Nextcloud on the same box, a network mount of its data folder, or a desktop-client sync. The app password is only used for deleting, into Deleted files. It also needs a GPU somewhere on your network for the model; mine ran about 3 seconds a picture, so the first pass on a big library takes a day or two. It works on a CPU, just much slower. The labels are a model's opinion, so it's built around reviewing before deleting.
Docker compose, AGPL-3.0: https://github.com/ixiondt/photosweep
I built it with heavy help from an AI coding assistant, and I run it on my own library. Feedback welcome, especially from anyone without a GPU: a duplicates-only mode that needs no model is the next thing I'd build if people want it.
Edit Thanks to feedback, I added a cloud API feature. This is if you don't care much about privacy and just need to get the sweep done.