Getting Started
📋 Prerequisites
- Ubuntu 24.04 or newer (Linux recommended), Desktop edition (or Server edition with GUI installed).
- Docker
- Make (
sudo apt install make) - Python 3 (
sudo apt install python3) - required for video download and validation scripts - Intel hardware (CPU, iGPU, dGPU, NPU)
- Intel drivers:
- Sufficient disk space for models, videos, and results
Note
First-time setup downloads AI models, sample videos, and Docker images - this may take 5-15 minutes depending on your internet connection.
Choose Your Workload Type
🛡️ Loss Prevention
Purpose: Detect theft, suspicious behavior, and inventory shrinkage
Use When: You want to monitor customer interactions and prevent loss
Includes: Hidden items detection, fake scan detection, product switching alerts
🛒 Automated Self-Checkout
Purpose: Validate customer scanning and detect checkout fraud
Use When: You want to ensure proper product scanning at self-checkout stations
Options: Object detection, age verification, product classification
🧠 Enhanced Loss Prevention with LVLM
Purpose: Advanced item recognition using Large Vision Language Models
Use When: You need higher accuracy for complex items or edge cases
Includes: Agent-based LVLM invocation, traditional CV fallback, improved item identification
Quick Configuration Reference
🛡️ Loss Prevention Hardware Options
| Configuration | Command | Best For |
|---|---|---|
| CPU (Default) | make run-lp RENDER_MODE=1 |
Basic setups, testing |
| GPU | make run-lp WORKLOAD_DIST=workload_to_pipeline_gpu.json RENDER_MODE=1 |
Performance, real-time processing |
| NPU + GPU | make run-lp WORKLOAD_DIST=workload_to_pipeline_gpu-npu.json RENDER_MODE=1 |
Latest Intel hardware |
| Heterogeneous | make run-lp WORKLOAD_DIST=workload_to_pipeline_hetero.json RENDER_MODE=1 |
Mixed workloads across hardware |
| VLM | make run-lp STREAM_LOOP=false CAMERA_STREAM=camera_to_workload_vlm.json WORKLOAD_DIST=workload_to_pipeline_vlm.json RENDER_MODE=1 |
Advanced AI-powered detection |
Included Detection Types: Hidden items, fake scanning, product switching, multi-product ID, sweet-heartening
🛒 Automated Self-Checkout Quick Commands
Object Detection (Identify scanned products):
# GPU (recommended)
make run-lp CAMERA_STREAM=camera_to_workload_asc_object_detection.json WORKLOAD_DIST=workload_to_pipeline_asc_object_detection_gpu.json RENDER_MODE=1
# CPU alternative
make run-lp CAMERA_STREAM=camera_to_workload_asc_object_detection.json WORKLOAD_DIST=workload_to_pipeline_asc_object_detection_cpu.json RENDER_MODE=1
Age Verification (Age-restricted products):
# GPU (recommended)
make run-lp CAMERA_STREAM=camera_to_workload_asc_age_verification.json WORKLOAD_DIST=workload_to_pipeline_asc_age_verification_gpu.json RENDER_MODE=1
Combined Detection & Classification:
# GPU (recommended)
make run-lp CAMERA_STREAM=camera_to_workload_asc_object_detection_classification.json WORKLOAD_DIST=workload_to_pipeline_asc_object_detection_classification_gpu.json RENDER_MODE=1
Tip
Hardware Selection: Replace _gpu with _cpu or _npu in any command above based on your available hardware.
Complete Reference: For the full configuration matrix with all hardware combinations and detailed specifications, see Complete Workload Configuration Matrix in Advanced Settings.
Step by step instructions:
-
Clone the repo with the below command
>Replacegit clone -b <release-or-tag> --single-branch https://github.com/intel-retail/loss-preventionwith the version you want to clone (for example, v4.0.0). git clone -b v4.0.0 --single-branch https://github.com/intel-retail/loss-prevention -
Run Loss Prevention (Recommended for First Time)
Simple Setup with Visual Output:
# RENDER_MODE=1 shows live video with detection boxes (recommended for first run) make run-lp RENDER_MODE=1Alternative Options:
# Headless mode - no visual output (for servers or automated testing) make run-lpWhat This Does: - Downloads AI models (YOLOv5, EfficientNet) - Downloads sample videos for testing
- Starts the loss prevention pipeline - Enables 6 detection types: hidden items, fake scanning, product switching, etc. - Visual mode shows real-time detection boxes and alerts -
Run Automated Self-Checkout Workloads
Object Detection (Identifies scanned products):
# GPU accelerated - recommended for performance CAMERA_STREAM=camera_to_workload_asc_object_detection.json WORKLOAD_DIST=workload_to_pipeline_asc_object_detection_gpu.json make run-lp RENDER_MODE=1 # CPU version - for systems without GPU CAMERA_STREAM=camera_to_workload_asc_object_detection.json WORKLOAD_DIST=workload_to_pipeline_asc_object_detection_cpu.json make run-lp RENDER_MODE=1Age Verification (For age-restricted products):
# Detects customer age for alcohol/tobacco purchases CAMERA_STREAM=camera_to_workload_asc_age_verification.json WORKLOAD_DIST=workload_to_pipeline_asc_age_verification_gpu.json make run-lp RENDER_MODE=1Combined Detection & Classification:
# Both identifies AND categorizes products CAMERA_STREAM=camera_to_workload_asc_object_detection_classification.json WORKLOAD_DIST=workload_to_pipeline_asc_object_detection_classification_gpu.json make run-lp RENDER_MODE=1
Tip
Display Options: Add RENDER_MODE=1 to any command above to see live video with detection boxes. Remove it for headless operation (servers/automation).
Choose Your Hardware: Replace _gpu with _cpu or _npu based on your available hardware. See Automated Self-Checkout Configurations for all options.
What You'll See When Working
🛡️ Loss Prevention Results
- Visual: Red bounding boxes around suspicious activities
- Alerts: Console notifications for hidden items, fake scanning, product switching
- Logs: Detection confidence scores and behavior analysis
🛒 Automated Self-Checkout Results
- Object Detection: Green boxes around identified products with labels
- Age Verification: Face detection boxes with estimated age ranges
- Classification: Product categories and scanning validation status
Expected Performance
- Startup Time: 2-5 minutes (first run includes downloads)
- Processing: Real-time video analysis at 15-30 FPS
-
Results: JSON files appear in
results/folder within seconds -
Verify Results
After starting Loss Prevention you will begin to see result files being written into the results/ directory. Here are example outputs from the 3 log files.
gst-launch_
pipeline
r
Note
If unable to see results folder or files, please refer to the Troubleshooting section for more details.
-
Stop the containers:
When pre-built images are pulled-
make down-lpWhen images are built locally-
make down-lp REGISTRY=false
Troubleshooting
-
If results folder is empty, check Docker logs for errors:
- List the docker containers
docker ps -a - Verify Docker containers if it is running or no errors in container logs
Result:docker ps --allNAMES STATUS IMAGE src-pipeline-runner-1 Up 17 seconds (healthy) pipeline-runner:lp model-downloader Exited(0) 17 seconds model-downloader:lp- Check each container logs
docker logs <container_id> - If the file content in
<loss-prevention-workspace>/results/pipeline_stream*.logis empty, check GStreamer output file for errors: <loss-prevention-workspace>/results/gst-launch_*.log
- List the docker containers
-
RTSP :
- Connection timeout: Check
RTSP_STREAM_HOSTandRTSP_STREAM_PORTenvironment variables - Stream not found: Verify video file exists in
performance-tools/sample-media/ - Black frames: Ensure video codec is H.264 (most compatible)
- Check RTSP server logs:
docker logs rtsp-streamer