# Get Started ## Prerequisites - Ubuntu 24.04 or newer (Linux recommended), Desktop edition (or Server edition with GUI installed). - [Docker](https://docs.docker.com/engine/install/) - [Make](https://www.gnu.org/software/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: - [Intel GPU drivers](https://dgpu-docs.intel.com/driver/client/overview.html) - [NPU](https://docs.openedgeplatform.intel.com/dev/edge-ai-libraries/dlstreamer/dev_guide/advanced_install/advanced_install_guide_prerequisites.html#prerequisite-2-install-intel-npu-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):** ```bash # 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):** ```bash # 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:** ```bash # 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 ``` > **Note:** > > **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](./get-started/advanced.md#complete-workload-configuration-matrix) in Advanced Settings. ## Step by step instructions 1. Clone the repo with the below command ``` git clone -b --single-branch https://github.com/intel-retail/loss-prevention ``` > Replace with 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 ``` 2. **Run Loss Prevention (Recommended for First Time)** **Simple Setup with Visual Output:** ```bash # RENDER_MODE=1 shows live video with detection boxes (recommended for first run) make run-lp RENDER_MODE=1 ``` **Alternative Options:** ```bash # Headless mode - no visual output (for servers or automated testing) make run-lp ``` **What 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 3. **Run Automated Self-Checkout Workloads** **Object Detection (Identifies scanned products):** ```bash # 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=1 ``` **Age Verification (For age-restricted products):** ```bash # 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=1 ``` **Combined Detection & Classification:** ```bash # 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 ``` > **Note:** > > **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](./get-started/advanced.md#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 4. 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\_