How I Built an Arabic-First Shoplifting Detector with YOLOv8 and Qwen2-VL (on 8GB RAM)

Retail theft costs small stores 2-3% of annual revenue. Existing AI solutions (Everseen, Veesion) cost $50-200/month and don't support Arabic. I wanted to build something that runs on a single 8GB computer and works in Arabic from day one.

The Technical Challenge: Running Qwen on a Potato

The hardest part was AI verification. I wanted to use Qwen2-VL-2B to reduce false positives, but running a 2-billion parameter model on 8GB RAM with no GPU is not trivial. Here's how I did it:

  1. Quantization is non-negotiable: I used the Q4_K_M GGUF version (~1.1 GB instead of ~4.4 GB).
  2. Use llama.cpp directly, not Ollama: Ollama had issues with image inputs for this model. llama-mtmd-cli worked perfectly.
  3. The magic flag: --image-min-tokens 1024. Without it, the model would produce repetitive garbage. With it, it gives coherent answers.
  4. Timeout management: It takes ~45 seconds per check on CPU. This is acceptable because it only runs on suspicious events, not every frame.

The Architecture (Simplified)

The system uses YOLOv8 for detection, DeepSORT for tracking, and behavior rules for loitering/concealment. It converts pixel coordinates to GPS, sends Telegram alerts, and saves 6-second H.264 video clips as evidence.

The system also uses CLIP for recurring visitor detection and saves 6-second H.264 clips as evidence.

What I Learned

  • Start with the smallest model that works. I started with YOLOv8n (nano), not the largest.
  • Quantize early. Don't wait until you run out of RAM.
  • The "boring" parts matter. GPS mapping and alert formatting took as much time as the AI.
  • Arabic support is a superpower. Most global products ignore it.

Try It Yourself

The whole thing is MIT licensed. You can clone it, run it on your laptop, and test it with your own videos.

GitHub: https://github.com/youssoufahmad655-wq/Guardian-Eye

Any feedback on reducing false positives is welcome.