Skip to content
TNTGuerrillaPublic

About

A lightweight, privacy-focused alternative to Google Photos, iCloud and OneDrive that runs on your own hardware, with local AI for face, object, scene and text search.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

SortaPix: A local photo storage and management system

SortaPix is a privacy-focused media management system designed as a local alternative to Google Photos, OneDrive, iCloud, etc. It performs automatic analysis and categorization of images and videos using light-weight AI models, making it able to run on low end hardware like a mini PC or low-powered home server. The web interface allows users to upload, search, organize, and manage media files entirely offline, and can be accessed by any device on your local network.

Features:

  • Automated face, object, scene, and text analysis of photos and videos, run entirely on your own machine

  • Local facial recognition and grouping with InsightFace (buffalo_l), with tools to rename, merge, correct, and hide people

  • Object detection using YOLOE-26s with a custom vocabulary of everyday objects

  • Scene recognition (Places365) for classifying environments (e.g., beach, forest, office)

  • Description search using SigLIP 2: type something like "dog on a beach at sunset" and find matching photos even if nothing was tagged that way. Results come in two sections, exact tag matches ("Tagged") first, then description matches ("Looks like").

  • Custom tags: teach SortaPix a tag of your own from example photos, then review how it ranks your library and choose where the cutoff falls

  • Stacks: copies, bursts, and crops of the same shot are grouped under one tile, and can be unstacked or edited by hand

  • View Similar finds photos and videos that look like the one you picked

  • Optical Character Recognition (OCR) to extract and search text within images

  • Dominant color analysis

  • Timeline view with date-grouped media organization (file system date/time metadata)

  • Map view of photos that have GPS location data

  • Media scanning (automatically every hour, or manually via button)

  • Drag-and-drop uploads of single files or whole folders

  • Real-time updates via WebSockets (Allows you to see new media appear without refreshing)

  • Video thumbnail generation, and video analysis that samples one frame every 5 seconds

  • Built in media viewer with downloads

  • File management actions per image (rename, show details (metadata), delete, view similar, add to album, show in folder)

  • Metadata viewer with file properties, EXIF info, and location

  • Album and profile pages for browsing and organizing people and collections

  • Configurable media directories and description search model size via settings page

  • Toggleable light/dark theme persists between sessions/per device.

Technology Stack:

  • Backend: FastAPI (Python 3.11+), SQLite, OpenCV, PyTorch, Ultralytics, InsightFace, open_clip, Pytesseract

  • Frontend: HTML, CSS, JavaScript (vanilla), Jinja2 templates (custom), Leaflet (map)

  • AI Models: InsightFace (buffalo_l), YOLOE-26s, SigLIP 2, ResNet18 (Places365), Tesseract OCR

Directory Structure Overview

SortaPix/ # contains main files (main_web.py, main.py, config.py, requirements.txt, etc.)
├── analyzer/ # AI inference pipeline: detection, faces, embeddings, custom tags, stacks
├── backend/ # FastAPI app (api.py), scanner, search, gallery, and View Similar
├── database/ # SQLite schema and queries (db.py, stack_store.py)
├── data/
│ ├── uploads_temp/ # Temporary uploaded files
│ ├── people/ # Cropped facial thumbnails
│ ├── media/ # Contains metadata.db
│ ├── config.json # User-configurable settings
│ ├── clip_vocabulary.json # Object detector vocabulary
│ └── tag_thresholds.json # Per-tag confidence thresholds
├── static/ # CSS, JavaScript, and map assets
├── templates/ # Jinja2 HTML templates
├── tests/ # pytest suite and evaluation tools
├── tools/ # Vocabulary builder
├── utils/ # Image handling, OCR, color features, tag policy, logging
├── main_web.py # Entrypoint that starts the web server
├── main.py # Command line scanner
├── config.py # Configuration loader and defaults

Setup Instructions

These steps are written for Windows. On macOS or Linux, skip the C++ Build Tools and activate the virtual environment with source .venv/bin/activate in step 7.

1. Install Python (3.11 or newer, tested on 3.11.9)

  • Download Python from https://python.org or search for python 3.11.9. Python 3.10 no longer works: the pinned numpy needs 3.11.
  • During install, check the box that says "Add Python to PATH" and select "Disable Path Limit" on the next setup page.
  • Complete the installation.

2. Install Git and C++ Build Tools (Required)

  • Download Git from https://git-scm.com/.
  • Install it with default settings.
  • On Windows, install the Microsoft C++ Build Tools from https://visualstudio.microsoft.com/visual-cpp-build-tools/ and select the "Desktop development with C++" workload. InsightFace has no prebuilt package, so pip compiles it during step 8.
  • If that compile fails with a message like \NVIDIA was unexpected at this time, an entry in your PATH environment variable contains quote marks (some CUDA and cuDNN installers add one). Remove the quotes, split the entry into one folder per line, and open a new terminal.

3. Install Tesseract OCR (Recommended)

  • Tesseract reads the text in your photos so it can be searched. Without it, SortaPix still runs but skips text extraction.
  • On Windows, use the installer from https://github.com/UB-Mannheim/tesseract/wiki and keep the default install folder (C:\Program Files\Tesseract-OCR), which SortaPix finds automatically. If you install it somewhere else, set the path on the Settings page.

4. Install Visual Studio Code (Recommended)

5. Download the Project Files

If you have Git installed:

  • Open a terminal or command prompt.
  • Run git clone https://github.com/TNTGuerrilla/SortaPix-Public.git SortaPix
  • Then move into the folder with cd SortaPix

If you don't have Git:

  • Manually download the project as a ZIP file and extract it somewhere easy to find.

6. Create a Virtual Environment

  • Open a terminal inside the project folder (SortaPix).
  • Run python -m venv .venv

7. Activate the Virtual Environment

  • On Windows Command Prompt: .venv\Scripts\activate
  • On Windows PowerShell: .\.venv\Scripts\Activate.ps1

(The easiest way to do this inside VS Code is to open a new terminal using the Terminal tab, then selecting the New Terminal option.)

After activating, the terminal prompt should show something like (.venv).

8. Install Required Python Packages

  • With the virtual environment active, run: pip install -r requirements.txt

Installing the requirements needs Git installed and on PATH (see step 2): pip install -r requirements.txt builds the CLIP package straight from its GitHub repository, since YOLOE's text encoder depends on it.

9. Download the AI Models

Place the following model into the root directory of the project (./SortaPix):

  • yoloe-26s-seg.pt Download Link

    • If the download link doesn't work, the model is downloaded automatically on first run if you have an internet connection. See https://docs.ultralytics.com/models/yoloe/ for more info.
    • On the first start, and whenever data/clip_vocabulary.json changes, YOLOE also downloads its text encoder, MobileCLIP2 (mobileclip2_b.ts, about 250 MB), to encode the vocabulary. The result is cached in data/, so later starts do not load it. The app will not scan or analyze anything until that one-time download has succeeded.
  • Other required models will autodownload upon first start: InsightFace (buffalo_l), Places365, and the SigLIP 2 model for description search (from Hugging Face). Model weights are not covered by the SortaPix license; see Third-party models and licenses.

The data/media, data/people, and data/uploads_temp folders are created automatically on first start.

10. Launch the Application

  • In the terminal, run: python main_web.py

  • You should see output like: Uvicorn running on http://0.0.0.0:8000

11. Open the Web Interface

  • Open your web browser.
  • Visit http://localhost:8000, or http://<this computer's IP address>:8000 from another device on your network.

You should see the SortaPix homepage.

12. Configure Your Folders

  • Click "Settings" in the web interface.
  • Set up:
    • Upload Temp Folder (e.g., ./data/uploads_temp)
    • Permanent Media Directory (e.g., D:/photos)
    • Network Scan Folder (same as Permanent Media Directory)
    • Description Search model size (larger is more accurate but slower and uses more memory; it can also be turned off)

Save your settings. A change to the description search size takes effect after a restart.

13. Start Using the App

  • Manually move your media files into the Network Scan folder, or drag them onto the page to upload.
  • Click "Detect New Media" to analyze and categorize your files. New files are also picked up by an automatic scan every hour.
  • Use Search, Albums, People, Custom Tags, and Map to browse your media.
  • Use the options menu (three dots) on each photo or video to rename, view metadata, view similar, delete, etc.

Notes:

  • Every video is analyzed, whatever its size or length, sampling one frame every 5 seconds. Long videos take longer to index, but memory use does not grow with file size, since frames are read one at a time.

  • Metadata is stored in SQLite (data/media/metadata.db)

  • Real-time updates and loading are handled using WebSockets

  • All classification and organization happens within the database, leaving the actual files and folders unchanged.

Third-party models and licenses

The model weights are not part of this repository. They are downloaded separately, by you or automatically on first run, and each is covered by its own license, not by the SortaPix license. Check these before using SortaPix for anything beyond personal use.

Component Used for License
YOLOE-26 weights and the ultralytics package Object detection AGPL-3.0 (Ultralytics also sells an Enterprise license)
ultralytics/CLIP YOLOE's text encoder AGPL-3.0
MobileCLIP2 weights (mobileclip2_b.ts, downloaded by Ultralytics) Encoding the object vocabulary for YOLOE, once, then cached Apple ML Research Model license: non-commercial research only (the MobileCLIP code is MIT)
InsightFace buffalo_l model pack Face detection and recognition Non-commercial research use only (the insightface library itself is MIT)
SigLIP 2 weights (timm/ViT-*-SigLIP2*) through open_clip Description search and similar photos Apache-2.0 (open_clip is MIT)
Places365 ResNet18 weights Scene tags CC BY (the Places365 repository code is MIT)
Tesseract OCR and pytesseract Text in images Apache-2.0

Places365: B. Zhou, A. Lapedriza, A. Khosla, A. Oliva, A. Torralba. "Places: A 10 million Image Database for Scene Recognition." IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017. http://places2.csail.mit.edu

Face recognition models

The InsightFace buffalo_l pack is licensed for non-commercial research only, so SortaPix as shipped is suitable for personal use. The same applies to the MobileCLIP2 text encoder that YOLOE downloads, which Apple licenses for non-commercial research only. Replacing it with permissively licensed models is planned. The candidates are AuraFace (Apache-2.0) and OpenCV Zoo's YuNet detector (MIT) with the SFace recognizer (Apache-2.0); they will be compared against buffalo_l before a switch. Face embeddings from different recognizers are not compatible, so switching will mean re-analyzing faces.

Bundled third-party files

  • Leaflet 1.9.4 (static/leaflet.js, static/leaflet.css, static/images/) - BSD-2-Clause, (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
  • Leaflet.markercluster (static/leaflet.markercluster.js, static/MarkerCluster*.css) - MIT, (c) 2012 David Leaver
  • Cropper.js 1.6.1 (static/cropper.min.css) - MIT, (c) 2015-present Chen Fengyuan
  • Open Images V7 class list (tools/vocabulary/oidv7-class-descriptions-boxable.csv), from which the detector vocabulary is derived - (c) Google LLC, CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

Disclaimer

This project is not affiliated with, endorsed by, or associated with Google or any of its services. Any similarities in functionality or design are unintentional.

License

Copyright (C) 2025-2026 TNTGuerrilla

SortaPix is licensed under the GNU Affero General Public License v3.0. See LICENSE for the full text. If you run a modified version of SortaPix as a network service, the AGPL requires you to offer its source code to that service's users. Third-party components keep their own licenses, listed above. Contributions are welcome.

About

A lightweight, privacy-focused alternative to Google Photos, iCloud and OneDrive that runs on your own hardware, with local AI for face, object, scene and text search.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages