-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
185 lines (149 loc) · 6.22 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# Copyright © 2024 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
.PHONY: build build-realsense run down
.PHONY: build-telegraf run-telegraf run-portainer clean-all clean-results clean-telegraf clean-models down-portainer
.PHONY: download-models clean-test run-demo run-headless download-yolov8s logs
.PHONY: clean-benchmark-results
MKDOCS_IMAGE ?= asc-mkdocs
PIPELINE_COUNT ?= 1
TARGET_FPS ?= 14.95
CONTAINER_NAMES ?= gst0
DOCKER_COMPOSE ?= docker-compose.yml
RESULTS_DIR ?= $(PWD)/results
RETAIL_USE_CASE_ROOT ?= $(PWD)
BENCHMARK_DURATION ?= 45
DENSITY_INCREMENT ?= 1
download-models: download-yolov8s
./download_models/downloadModels.sh
download-yolov8s:
@if [ ! -d "$(PWD)/models/object_detection/yolov8s/" ]; then \
echo "The yolov8s folder doesn't exist. Creating it and downloading the model..."; \
mkdir -p $(PWD)/models/object_detection/yolov8s/; \
docker run --user 1000:1000 -e HTTPS_PROXY=${HTTPS_PROXY} -e HTTP_PROXY=${HTTPS_PROXY} --rm \
-e YOLO_DEBUG=1 \
-v $(PWD)/models/object_detection/yolov8s:/models \
ultralytics/ultralytics:8.2.101-cpu \
bash -c "cd /models && yolo export model=yolov8s.pt format=openvino"; \
mv $(PWD)/models/object_detection/yolov8s/yolov8s_openvino_model $(PWD)/models/object_detection/yolov8s/FP32; \
else \
echo "yolov8s already exists."; \
fi
download-sample-videos:
cd performance-tools/benchmark-scripts && ./download_sample_videos.sh
clean-models:
@find ./models/ -mindepth 1 -maxdepth 1 -type d -exec sudo rm -r {} \;
run-smoke-tests: | download-models update-submodules download-sample-videos
@echo "Running smoke tests for OVMS profiles"
@./smoke_test.sh > smoke_tests_output.log
@echo "results of smoke tests recorded in the file smoke_tests_output.log"
@grep "Failed" ./smoke_tests_output.log || true
@grep "===" ./smoke_tests_output.log || true
update-submodules:
@git submodule update --init --recursive
@git submodule update --remote --merge
build:
docker build --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} --target build-default -t dlstreamer:dev -f src/Dockerfile src/
docker build --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} -t loss-prevention:dev -f src/app/Dockerfile src/app
build-realsense:
docker build --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} --target build-realsense -t dlstreamer:realsense -f src/Dockerfile src/
build-pipeline-server: | download-models update-submodules download-sample-videos
docker build --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} -t dlstreamer:pipeline-server -f src/pipeline-server/Dockerfile.pipeline-server src/pipeline-server
run:
docker compose -f src/$(DOCKER_COMPOSE) up -d
run-render-mode:
xhost +local:docker
RENDER_MODE=1 docker compose -f src/$(DOCKER_COMPOSE) up -d
down:
docker compose -f src/$(DOCKER_COMPOSE) down
run-demo: | download-models update-submodules download-sample-videos
@echo "Building Loss Prevention app"
$(MAKE) build
@echo Running Loss Prevention pipeline
$(MAKE) run-render-mode
run-headless: | download-models update-submodules download-sample-videos
@echo "Building Loss Prevention app"
$(MAKE) build
@echo Running Loss Prevention pipeline
$(MAKE) run
run-pipeline-server: | build-pipeline-server
RETAIL_USE_CASE_ROOT=$(RETAIL_USE_CASE_ROOT) docker compose -f src/pipeline-server/docker-compose.pipeline-server.yml up -d
down-pipeline-server:
docker compose -f src/pipeline-server/docker-compose.pipeline-server.yml down
build-benchmark:
cd performance-tools && $(MAKE) build-benchmark-docker
benchmark: build-benchmark download-models
cd performance-tools/benchmark-scripts && python benchmark.py --compose_file ../../src/$(DOCKER_COMPOSE) \
--pipeline $(PIPELINE_COUNT) --duration $(BENCHMARK_DURATION) --results_dir $(RESULTS_DIR)
# consolidate to show the summary csv
@cd performance-tools/benchmark-scripts && ROOT_DIRECTORY=$(RESULTS_DIR) $(MAKE) --no-print-directory consolidate && \
echo "Loss Prevention benchmark results are saved in $(RESULTS_DIR)/summary.csv file" && \
echo "====== Loss prevention benchmark results summary: " && cat $(RESULTS_DIR)/summary.csv
benchmark-stream-density: build-benchmark download-models
# example commands:
# 1. for single container pipeline stream density
# ```console
# make PIPELINE_SCRIPT=yolov8s_roi.sh benchmark-stream-density
# ```
# 2. for multiple container pipelines stream density:
# ```console
# make DOCKER_COMPOSE=docker-compose-2-clients.yml BENCHMARK_DURATION=90 TARGET_FPS="10.95 2.95" CONTAINER_NAMES="gst1 gst2" \
# benchmark-stream-density
# ```
#
cd performance-tools/benchmark-scripts && python benchmark.py --compose_file ../../src/$(DOCKER_COMPOSE) \
--target_fps $(TARGET_FPS) --container_names $(CONTAINER_NAMES) \
--density_increment $(DENSITY_INCREMENT) --results_dir $(RESULTS_DIR)
clean-benchmark-results:
cd performance-tools/benchmark-scripts && rm -rf $(RESULTS_DIR)/* || true
build-telegraf:
cd telegraf && $(MAKE) build
run-telegraf:
cd telegraf && $(MAKE) run
clean-telegraf:
./clean-containers.sh influxdb2
./clean-containers.sh telegraf
run-portainer:
docker compose -p portainer -f docker-compose-portainer.yml up -d
down-portainer:
docker compose -p portainer -f docker-compose-portainer.yml down
clean-results:
rm -rf results/*
clean-all:
docker rm -f $(docker ps -aq)
docs: clean-docs
mkdocs build
mkdocs serve -a localhost:8008
docs-builder-image:
docker build \
-f Dockerfile.docs \
-t $(MKDOCS_IMAGE) \
.
build-docs: docs-builder-image
docker run --rm \
-u $(shell id -u):$(shell id -g) \
-v $(PWD):/docs \
-w /docs \
$(MKDOCS_IMAGE) \
build
serve-docs: docs-builder-image
docker run --rm \
-it \
-u $(shell id -u):$(shell id -g) \
-p 8008:8000 \
-v $(PWD):/docs \
-w /docs \
$(MKDOCS_IMAGE)
clean-docs:
rm -rf docs/
helm-package:
helm package helm/ -u -d .deploy
helm package helm/
helm repo index .
helm repo index --url https://github.com/intel-retail/loss-prevention .
logs:
@CONTAINER_ID=$(shell docker ps --filter "name=loss-prevention" --format "{{.ID}}") && \
if [ -n "$$CONTAINER_ID" ]; then \
docker logs -f $$CONTAINER_ID; \
else \
echo "No running container found with name containing 'loss-prevention'"; \
fi