Skip to content

Commit 65019ca

Browse files
Merge pull request #105 from sumanaga/asc-doc-changes
Asc doc changes
2 parents 1641027 + 3c356e4 commit 65019ca

1 file changed

Lines changed: 192 additions & 48 deletions

File tree

docs_src/use-cases/loss-prevention/getting_started.md

Lines changed: 192 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Getting Started
22

3+
## 📋 Prerequisites
4+
5+
- Ubuntu 24.04 or newer (Linux recommended), Desktop edition (or Server edition with GUI installed).
6+
- [Docker](https://docs.docker.com/engine/install/)
7+
- [Make](https://www.gnu.org/software/make/) (`sudo apt install make`)
8+
- **Python 3** (`sudo apt install python3`) - required for video download and validation scripts
9+
- Intel hardware (CPU, iGPU, dGPU, NPU)
10+
- Intel drivers:
11+
- [Intel GPU drivers](https://dgpu-docs.intel.com/driver/client/overview.html)
12+
- [NPU](https://dlstreamer.github.io/dev_guide/advanced_install/advanced_install_guide_prerequisites.html#prerequisite-2-install-intel-npu-drivers)
13+
- Sufficient disk space for models, videos, and results
14+
15+
316
### **NOTE:**
417

518
By default the application runs by pulling the pre-built images. If you want to build the images locally and then run the application, set the flag:
@@ -11,50 +24,52 @@ usage: make <command> REGISTRY=false (applicable for all commands like benchmark
1124
Example: make run-lp REGISTRY=false
1225
```
1326

14-
(If this is the first time, it will take some time to download videos, models, docker images and build images)
27+
By default the application runs in Headless mode. If you want to run in Visual Mode run the application, by setting the flag:
1528

16-
## Step by step instructions:
29+
```bash
30+
RENDER_MODE=1
1731

18-
1. Download the models using download_models/downloadModels.sh
32+
usage: make <command> RENDER_MODE=1 (applicable for all commands like benchmar,benchmark-stream-density..)
33+
Example: make run-lp RENDER_MODE=1
34+
```
1935

20-
```bash
21-
make download-models
22-
```
36+
(If this is the first time, it will take some time to download videos, models, docker images and build images)
2337

24-
2. Update github submodules
38+
## Step by step instructions:
2539

26-
```bash
27-
make update-submodules
40+
1. Clone the repo with the below command
2841
```
29-
30-
3. Download sample videos used by the performance tools
31-
32-
```bash
33-
make download-sample-videos
42+
git clone -b <release-or-tag> --single-branch https://github.com/intel-retail/loss-prevention
43+
```
44+
>Replace <release-or-tag> with the version you want to clone (for example, **v4.0.0**).
45+
```
46+
git clone -b v4.0.0 --single-branch https://github.com/intel-retail/loss-prevention
3447
```
3548
36-
4. Run the LP application
49+
2. To run loss prevention from pre-built images,follow the below steps:
3750
3851
```bash
52+
#Download the models using download_models/downloadModels.sh
53+
make download-models
54+
#Update github submodules
55+
make update-submodules
56+
#Download sample videos used by the performance tools
57+
make download-sample-videos
58+
#Run the LP application
3959
make run-render-mode
4060
```
4161
4262
**NOTE:- User can directly run single make command that internally called all above command and run the Loss Prevention application.**
4363
44-
- Run Loss Prevention appliaction with single command.
64+
- Run Loss Prevention appliaction with single command.
4565
4666
```bash
47-
make run-lp
67+
make run-lp RENDER_MODE=1
4868
```
4969
50-
- Running Loss Prevention application with ENV variables:
51-
```bash
52-
CAMERA_STREAM=camera_to_workload_full.json WORKLOAD_DIST=workload_to_pipeline_cpu.json make run-lp
53-
```
54-
`CAMERA_STREAM=camera_to_workload_full.json`: runs all 6 workloads. <br>
55-
`WORKLOAD_DIST=workload_to_pipeline_cpu.json`: all workloads run on CPU. <br>
70+
By default, Loss Prevention 6 default workloads are executed. Refer to the [Pre-Configured Workloads](#pre-configured-workloads) section for more details.
5671
57-
5. To build the images locally step by step:
72+
3. To build the images locally step by step:
5873
- Follow the following steps:
5974
```bash
6075
make download-models REGISTRY=false
@@ -66,30 +81,9 @@ Example: make run-lp REGISTRY=false
6681
- The above series of commands can be executed using only one command:
6782
6883
```bash
69-
make run-lp REGISTRY=false
84+
make run-lp REGISTRY=false RENDER_MODE=1
7085
```
71-
72-
6. View the Dynamically Generated GStreamer Pipeline.
73-
>*Since the GStreamer pipeline is generated dynamically based on the provided configuration(camera_to_workload and workload_to_pipeline json), the pipeline.sh file gets updated every time the user runs make run-lp or make benchmark. This ensures that the pipeline reflects the latest changes.*
74-
```sh
75-
76-
src/pipelines/pipeline.sh
77-
78-
```
79-
80-
7. Verify Docker containers
81-
82-
```bash
83-
docker ps --all
84-
```
85-
Result:
86-
```bash
87-
NAMES STATUS IMAGE
88-
src-pipeline-runner-1 Up 17 seconds (healthy) pipeline-runner:lp
89-
model-downloader Exited(0) 17 seconds model-downloader:lp
90-
```
91-
92-
8. Verify Results
86+
4. Verify Results
9387
9488
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.
9589
@@ -192,8 +186,10 @@ Example: make run-lp REGISTRY=false
192186
}
193187
194188
```
189+
> [!NOTE]
190+
> If unable to see results folder or files, please refer to the [Troubleshooting](#troubleshooting) section for more details.
195191
196-
9. Stop the containers:
192+
5. Stop the containers:
197193

198194
When pre-built images are pulled-
199195

@@ -207,4 +203,152 @@ Example: make run-lp REGISTRY=false
207203
make down-lp REGISTRY=false
208204
```
209205

206+
## Pre-configured Workloads
207+
The preconfigured workload supports multiple hardware configurations out of the box. Use the `CAMERA_STREAM` and `WORKLOAD_DIST` variables to customize which cameras and hardware (CPU, GPU, NPU) are used by your pipeline.
208+
209+
**How To Use:**
210+
- Specify the appropriate files as environment variables when running or benchmarking:
211+
```sh
212+
CAMERA_STREAM=<camera_stream> WORKLOAD_DIST=<workload_dist> make run-lp
213+
```
214+
Or for benchmarking:
215+
```sh
216+
CAMERA_STREAM=<camera_stream> WORKLOAD_DIST=<workload_dist> make benchmark
217+
```
218+
### Loss Prevention
219+
220+
| Description | CAMERA_STREAM | WORKLOAD_DIST |
221+
|-------------------------|-------------------------------|--------------------------------------|
222+
| CPU (Default) | camera_to_workload.json | workload_to_pipeline.json |
223+
| GPU | camera_to_workload.json | workload_to_pipeline_gpu.json |
224+
| NPU + GPU | camera_to_workload.json | workload_to_pipeline_gpu-npu.json |
225+
| Heterogeneous | camera_to_workload.json | workload_to_pipeline_hetero.json |
226+
227+
> [!NOTE]
228+
> The following sub-workloads are automatically included and enabled in the configuration:
229+
>
230+
> `items_in_basket`
231+
`hidden_items`
232+
`fake_scan_detection`
233+
`multi_product_identification`
234+
`product_switching`
235+
`sweet_heartening`
236+
237+
### Automated Self Check Out
238+
239+
| Description | CAMERA_STREAM | WORKLOAD_DIST |
240+
|------------------------------------------------|-------------------------------|--------------------------------------|
241+
| Object Detection (GPU) | camera_to_workload_asc_object_detection.json | workload_to_pipeline_asc_object_detection_gpu.json |
242+
| Object Detection (NPU) | camera_to_workload_asc_object_detection.json | workload_to_pipeline_asc_object_detection_npu.json |
243+
| Object Detection & Classification (GPU) | camera_to_workload_asc_object_detection_classification.json | workload_to_pipeline_asc_object_detection_classification_gpu.json |
244+
| Object Detection & Classification (NPU) | camera_to_workload_asc_object_detection_classification.json | workload_to_pipeline_asc_object_detection_classification_npu.json |
245+
| Age Prediction & Face Detection (GPU) | camera_to_workload_asc_age_verification.json | workload_to_pipeline_asc_age_verification_gpu.json |
246+
| Age Prediction & Face Detection (NPU) | camera_to_workload_asc_age_verification.json | workload_to_pipeline_asc_age_verification_npu.json |
247+
| Heterogenous | camera_to_workload_asc_hetero.json | workload_to_pipeline_hetero.json |
248+
249+
250+
251+
### User Defined Workloads
252+
The application is highly configurable via JSON files in the `configs/` directory
253+
254+
**To try a new camera or workload:**
255+
256+
1. Create new camera to workload mapping in `configs/camera_to_workload_custom.json` to add your camera and assign workloads.
257+
- **camera_to_workload_custom.json**: Maps each camera to one or more workloads.
258+
- To add or remove a camera, edit the `lane_config.cameras` array in the file.
259+
- Each camera entry can specify its video source, region of interest, and assigned workloads.
260+
Example:
261+
```json
262+
{
263+
"lane_config": {
264+
"cameras": [
265+
{
266+
"camera_id": "cam1",
267+
"streamUri": "rtsp://rtsp-streamer:8554/video-stream-name",
268+
"workloads": ["items_in_basket", "multi_product_identification"],
269+
"region_of_interest": {"x": 100, "y": 100, "x2": 800, "y2": 600}
270+
}
271+
]
272+
}
273+
}
274+
```
275+
If adding new videos, place your video files in the directory **performance-tools/sample-media/** and update the `streamUri` path.
276+
[!Note]
277+
>#### Connecting External RTSP Cameras:
278+
To use real RTSP cameras instead of the built-in server:
279+
280+
```json
281+
{
282+
"camera_id": "external_cam1",
283+
"streamUri": "rtsp://192.168.1.100:554/stream1",
284+
"workloads": ["items_in_basket"]
285+
}
286+
```
287+
2. Create new `configs/workload_to_pipeline_custom.json` to define pipeline for your workload.
288+
- **workload_to_pipeline_custom.json**: Maps each workload name to a pipeline definition (sequence of GStreamer elements and models).
289+
Example:
290+
291+
```json
292+
{
293+
"workload_pipeline_map": {
294+
"custom_workload_1": [
295+
{"type": "gvadetect", "model": "yolo11n", "precision": "INT8", "device": "CPU"},
296+
{"type": "gvaclassify", "model": "efficientnet-v2-b0", "precision": "INT8", "device": "CPU"}
297+
],
298+
"custom_workload_2": [
299+
{"type": "gvadetect", "model": "yolo11n", "precision": "INT16", "device": "NPU"},
300+
{"type": "gvaclassify", "model": "efficientnet-v2-b0", "precision": "INT16", "device": "NPU"}
301+
],
302+
"custom_workload_3": [
303+
{"type": "gvadetect", "model": "yolo11n", "precision": "INT8", "device": "GPU"},
304+
{"type": "gvaclassify", "model": "efficientnet-v2-b0", "precision": "INT8", "device": "GPU"}
305+
]
306+
}
307+
}
308+
```
309+
3. Run validate configs command, to verify configuration files
310+
```sh
311+
make validate-all-configs
312+
```
313+
4. Re-run the pipeline as described above.
314+
315+
> [!NOTE]
316+
> Since the GStreamer pipeline is generated dynamically based on the provided configuration(camera_to_workload and workload_to_pipeline json),
317+
> the pipeline.sh file gets updated every time the user runs make run-lp or make benchmark. This ensures that the pipeline reflects the latest changes.
318+
```sh
319+
src/pipelines/pipeline.sh
320+
```
321+
322+
323+
## Troubleshooting
324+
325+
+ If results folder is empty, check Docker logs for errors:
326+
+ List the docker containers
327+
```sh
328+
docker ps -a
329+
```
330+
+ Verify Docker containers if it is running or no errors in container logs
331+
332+
```bash
333+
docker ps --all
334+
```
335+
Result:
336+
```bash
337+
NAMES STATUS IMAGE
338+
src-pipeline-runner-1 Up 17 seconds (healthy) pipeline-runner:lp
339+
model-downloader Exited(0) 17 seconds model-downloader:lp
340+
```
341+
342+
+ Check each container logs
343+
```sh
344+
docker logs <container_id>
345+
```
346+
+ If the file content in `<loss-prevention-workspace>/results/pipeline_stream*.log` is empty, check GStreamer output file for errors:
347+
+ `<oss-prevention-workspace>/results/gst-launch_*.log`
348+
349+
+ RTSP :
350+
- **Connection timeout**: Check `RTSP_STREAM_HOST` and `RTSP_STREAM_PORT` environment variables
351+
- **Stream not found**: Verify video file exists in `performance-tools/sample-media/`
352+
- **Black frames**: Ensure video codec is H.264 (most compatible)
353+
- **Check RTSP server logs**: `docker logs rtsp-streamer`
210354
## [Proceed to Advanced Settings](advanced.md)

0 commit comments

Comments
 (0)