Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slouch Tracker — on-device webcam posture detection for Windows. Upright posture is detected as good; a slouched, head-forward posture is detected as slouching.

Latest release License: MIT Platform: Windows 10/11 Tauri 2 Rust 1.88+ Svelte 5

Slouch Tracker watches your webcam and warns you when you start slouching. Everything runs on your own computer: no cloud services, no accounts, no telemetry. The only time it ever touches the network is a one-time ~245 MB download of its pose model on first launch (see About the installer); after that it works fully offline.

See it working

Privacy mode with the live skeleton avatar. Detection keeps running while the camera feed stays obscured:

Good posture Bad posture
Good posture detected: upright skeleton avatar over the obscured camera feed Bad posture detected: slouched skeleton avatar over the obscured camera feed

Getting started

You need: Windows 10 or 11 (x64), a webcam, and a DirectX 12-capable GPU (if yours isn't, the app tells you clearly at startup).

Camera placement: put the camera to the side of you, at eye level or slightly above. A side view makes slouching obvious to the pose model; overhead angles weaken it.

Download and install the latest release from the GitHub Releases page.

Windows SmartScreen will show a blue "Windows protected your PC" warning, because the build is unsigned. This is expected: click More info, then Run anyway.

On first launch the app downloads its pose model (~245 MB) once, then never needs the network again. Installing on a machine without internet? See Fully offline installation.

Using it

The app is a single window: your camera view with a status badge, plus a slide-in panel with Settings, Collect, and Training tabs.

Teach it your posture. Sit well and press G a few times; slouch and press B; step away and press A. A couple dozen frames of each is plenty to start. Then open the Training tab and press Train — your personal model deploys immediately, and from then on the app beeps when you hold a bad posture.

Key Action
G Capture a good posture frame
B Capture a bad posture frame
A Capture an away frame
C Clear sampled frames
U Undo last dataset change

The same captures work while the app is in the background via the global hotkeys Ctrl+Win+G / Ctrl+Win+B / Ctrl+Win+A, with a confirmation beep. The app keeps tracking from the system tray when you close the window, and it tells you when your model would benefit from retraining as your dataset grows.

Features

  • Your own personal detector: trained on your body, your chair, and your camera angle, not someone else's dataset.
  • Privacy mode: the camera image is obscured both on screen and in anything saved to disk, while detection keeps running.
  • Runs quietly in the tray, can start with Windows, and typically uses 1 to 2% CPU.
  • Global capture hotkeys that work while the app is unfocused.
  • Alerts only after posture stays bad for a delay you control.
  • Your dataset is portable: export and import it as a .slouchpack file.

Privacy

  • Everything runs locally: detection, feature extraction, and training happen on your own machine, with no telemetry. The only network use, ever, is the one-time pose-model download on first launch, and even that is avoidable by pre-placing the model (see Fully offline installation).
  • Your data stays on disk: frames, keypoints, feature vectors, thumbnails, settings, and trained models live in a local SQLite database under your user app-data directory.

Under the hood

Detection pipeline: webcam frames go to RTMDet-nano person detection on CPU, then NLF-L pose estimation on DirectML producing 17 keypoints plus 3D depth, then your own in-app-trained classifier decides good, bad, or away — about 1 frame per second, entirely on this machine.

RTMDet-nano finds the person on the CPU; NLF-L then estimates 17 keypoints plus 3D depth on the GPU through the DirectML execution provider, both running on native ONNX Runtime (the Rust ort crate). A classifier you train in-app on your own labeled frames makes the final call: good, bad, or away. Detection runs at ~1 fps in every window mode; the preview renders at ~30 fps while the window is focused.

The training side is registry-driven: six classifier types (mlp, knn, svm, kmeans_prototype, gaussian_nb, kmeans_logistic) with auto-generated parameter controls, 12 selectable feature types (RTMDet features, NLF-L 3D-depth features, geometric and keypoint features), normalization (z_score/layer/none), dimensionality reduction (pca/random_projection/none), and optional k-fold cross-validation with reported metrics.

Slouch Tracker is a Tauri 2 app: a Rust backend workspace (the app crate plus slouch-domain, slouch-ml, slouch-vision, slouch-store) with a deliberately thin Svelte 5 UI. The camera is owned natively (nokhwa, MJPEG) and previewed in the webview through a custom slouchcam:// URI scheme; the frontend talks to Rust through generated Specta bindings, with three raw-byte MessagePack commands reserved for bulk image data. See specs.md for the full architecture.

Installation details

About the installer

  • The installer is small. It bundles the person-detection model (RTMDet-nano, ~4 MB) and the native ONNX Runtime, but not the pose model. The first time you launch Slouch Tracker, it downloads the pose model (nlf_l_crop_fp16.onnx, ~245 MB) once from the project's GitHub Releases, verifies it against a pinned SHA-256, and caches it in your app-data directory. This one-time download is the only network access the app ever makes.
  • WebView2 runtime, at install time, on some systems: any system that already has the Microsoft WebView2 runtime (all of Windows 11 and virtually all of Windows 10) installs offline. On the rare stripped-down system without it, such as Windows 10 LTSC/IoT or a deliberately debloated install, the setup program downloads the small WebView2 runtime from Microsoft once. This is a Windows component fetched by the installer, separate from the pose-model download the app does on first launch.
  • Per-user install: installs for the current user, so no administrator prompt is required.
  • Your data survives uninstall. By default the uninstaller leaves your dataset, trained models, and settings on disk. Deleting them is opt-in: tick the delete application data checkbox in the uninstaller only if you want a full wipe.
  • Each release includes a SHA256SUMS.txt with the installer's hash if you want to verify your download.

Fully offline installation

If a machine will never have internet access, place the pose model manually before first launch. The app detects it and never attempts the download:

  1. On any connected machine, download the pose model from https://github.com/SSS135/slouch_tracker/releases/download/models-v1/nlf_l_crop_fp16.onnx.
  2. Verify its SHA-256; the printed hash must equal 33bd300cd5a65681a5d671debd82a63f842c7420443cd9bb7424ca7aef82cca8:
    Get-FileHash '.\nlf_l_crop_fp16.onnx' -Algorithm SHA256
  3. Copy the file into your app-data models folder (create the models folder if it does not exist): %APPDATA%\com.slouchtracker.main\models\nlf_l_crop_fp16.onnx. %APPDATA% expands to C:\Users\<YourName>\AppData\Roaming, so the full path is C:\Users\<YourName>\AppData\Roaming\com.slouchtracker.main\models\nlf_l_crop_fp16.onnx.
  4. Install and launch Slouch Tracker. It checks this path before any network request:
    • If the file is present and the hash matches, the app starts normally and makes no network requests at all.
    • If the file is present but corrupt (hash mismatch), the app reports that the pose model is invalid and offers to re-download it; replace it with a correct copy to stay fully offline.

Build from source

Prerequisites

  • Windows 10/11 (x64)
  • Git LFS, required. The RTMDet detection model (rtmdet-nano.onnx, ~4 MB) and the app icons are stored via Git LFS; cloning without Git LFS installed produces pointer files instead of the real assets, and the build will be broken. The larger NLF-L pose model (~245 MB) is not in the repository. Dev builds obtain it the same way end users do (first-run download), or you can place it manually; see the note under Steps.
  • Rust 1.88+ (with the x86_64-pc-windows-msvc toolchain)
  • Node.js 20+
  • Visual Studio 2022 with the Desktop development with C++ workload (any edition; Community works)
  • WebView2 runtime (preinstalled on Windows 11; on Windows 10 install the Evergreen runtime from Microsoft)

Steps

# 1. Install Git LFS once per machine
git lfs install

# 2. Clone (LFS assets are fetched automatically)
git clone https://github.com/SSS135/slouch_tracker.git
cd slouch_tracker

# 3. Install frontend dependencies
npm install

# 4a. Run in development
npm run tauri:dev

# 4b. Or build the Windows NSIS installer
npm run tauri:build:win

Cargo must run inside a Visual Studio 2022 x64 developer environment (vcvars64). npm run tauri:* handles this when launched from a developer shell; for raw cargo commands, first run: call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat".

Pose model for dev builds: development and release builds do not bundle the NLF-L pose model. On first launch the app downloads it automatically, or you can pre-place nlf_l_crop_fp16.onnx (SHA-256 33bd300cd5a65681a5d671debd82a63f842c7420443cd9bb7424ca7aef82cca8) at either src-tauri\resources\models\nlf_l_crop_fp16.onnx or the app-data path %APPDATA%\com.slouchtracker.main\models\nlf_l_crop_fp16.onnx. See Fully offline installation.

Development

# Frontend tests (Vitest)
npm run test:svelte
npm run test:svelte -- <pattern>      # single file / pattern

# Type checking and linting
npm run check:svelte
npm run check:svelte:plumbing
npm run lint:svelte

# Rust tests (must run inside a VS 2022 x64 dev environment / vcvars64)
node scripts/run-gate.mjs             # wraps fmt / clippy / test with vcvars64
# or directly:
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" && cargo test --manifest-path src-tauri/Cargo.toml --workspace

# End-to-end
npm run test:e2e:web                  # Playwright against the mock-Tauri browser harness
npm run tauri:build:dev:win && npm run test:e2e:native   # WebdriverIO against the devbuild binary

After changing any Rust command signature, DTO, or event, regenerate and verify the TypeScript bindings:

npm run bindings:generate
npm run bindings:check

License

Slouch Tracker is released under the MIT License.

Binary licensing note: the MIT license covers the source code. The installer bundles only MIT, Apache-2.0, and CC0-1.0 components, including the Apache-2.0 RTMDet detector and a CC0-1.0 3D avatar model by Quaternius (see THIRD-PARTY-NOTICES.md). The NLF-L pose model is downloaded on first launch from the project's Releases, hosted with the permission of its author, István Sárándi. Because the pose-model weights are non-commercial, the Slouch Tracker application is for non-commercial scientific research, non-commercial education, or non-commercial artistic use cases only.

Third-party components and their licenses are listed in THIRD-PARTY-NOTICES.md.

Acknowledgments

About

Watches your webcam and warns you when you start slouching. You train it on your own posture in a couple of minutes, and everything stays on your computer. Windows only.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages