Skip to content

Commit d154053

Browse files
committed
Added json output
Signed-off-by: Brandon Tuttle <[email protected]>
1 parent 17b53f9 commit d154053

File tree

20 files changed

+291
-175
lines changed

20 files changed

+291
-175
lines changed

.env

+19-15
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
SUBNET=172.25.4.0/24
2-
TRITON_SERVER_IP=172.25.4.42
3-
TRITON_CLIENT_IP=172.25.4.45
4-
REDIS_DB_IP=172.25.4.47
5-
REDIS_OM_URL=redis://172.25.4.47:6379/0
6-
REDIS_INSIGHT_IP=172.25.4.49
1+
SUBNET="172.25.4.0/24"
2+
TRITON_SERVER_IP="172.25.4.42"
3+
TRITON_CLIENT_IP="172.25.4.45"
4+
REDIS_DB_IP="172.25.4.47"
5+
REDIS_OM_URL="redis://172.25.4.47:6379/0"
6+
REDIS_INSIGHT_IP="172.25.4.49"
77

8-
MAJOR_UPDATE_VERSION=23.02
9-
REDIS_DB_IMAGE=redislabs/redisearch:2.6.3
10-
DEBIAN_FRONTEND=noninteractive
11-
PROTOBUF_URL=https://github.com/protocolbuffers/protobuf/releases/download/v21.6/protoc-21.6-linux-x86_64.zip
8+
TAO_VERSION="v5.1.0_8.6.3.1_x86"
9+
MAJOR_UPDATE_VERSION="23.11"
10+
REDIS_DB_IMAGE="redislabs/redisearch:2.6.3"
11+
DEBIAN_FRONTEND="noninteractive"
12+
PROTOBUF_URL="https://github.com/protocolbuffers/protobuf/releases/download/v21.6/protoc-21.6-linux-x86_64.zip"
1213

13-
TRT_LIB_PATH=/usr/lib/x86_64-linux-gnu
14-
TRT_INC_PATH=/usr/include/x86_64-linux-gnu
15-
CUDA_MODULE_LOADING=LAZY
14+
TRT_LIB_PATH="/usr/lib/x86_64-linux-gnu"
15+
TRT_INC_PATH="/usr/include/x86_64-linux-gnu"
16+
CUDA_MODULE_LOADING="LAZY"
1617

17-
CONTAINER_IMAGE_FOLDER=/volume1/brandon/pictures
18+
CONTAINER_IMAGE_FOLDER="/volume1/brandon/pictures"
1819
MODEL_VERSION="1"
1920
TRITON_SERVER_URL="172.25.4.42:8001"
20-
HOST_IMAGE_FOLDER=/volume1/brandon/pictures
21+
HOST_IMAGE_FOLDER="/volume1/homes/brandon/Photos/PhotoLibrary"
2122
FACE_ALIGN_MODEL_NAME="facealign"
2223
FACE_DETECT_MODEL_NAME="facenet_ensemble"
2324
FPENET_MODEL_NAME="fpenet_ensemble"
2425
JUPYTER_ENABLE_LAB="yes"
26+
27+
FACENET_MODEL_PATH="/volume1/brandon/models/facenet_vpruned_quantized_v2.0.1"
28+
FPENET_MODEL_PATH="/volume1/brandon/models/fpenet_vdeployable_v3.0"

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ ignore.py
1414
*.rdb
1515
*.whl
1616
*.log
17-
coco/instances.json
17+
coco/instances.json
18+
workspace/symetrical_batches.json

.pre-commit-config.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
repos:
2+
- repo: https://github.com/pycqa/isort
3+
rev: 5.12.0
4+
hooks:
5+
- id: isort
6+
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
7+
rev: v1.1.13
8+
hooks:
9+
- id: remove-crlf
10+
files: (?!.*third_party)^.*$ | (?!.*book)^.*$
11+
- repo: https://github.com/pre-commit/mirrors-yapf
12+
rev: v0.32.0
13+
hooks:
14+
- id: yapf
15+
- repo: https://github.com/pre-commit/pre-commit-hooks
16+
rev: v4.1.0
17+
hooks:
18+
- id: check-added-large-files
19+
args: ['--maxkb=750']
20+
- id: check-merge-conflict
21+
- id: check-symlinks
22+
- id: detect-private-key
23+
files: (?!.*third_party)^.*$ | (?!.*book)^.*$
24+
- id: end-of-file-fixer
25+
- id: check-yaml
26+
- id: sort-simple-yaml
27+
- id: trailing-whitespace
28+
- repo: https://github.com/PyCQA/autoflake
29+
rev: v1.6.1
30+
hooks:
31+
- id: autoflake
32+
args:
33+
[
34+
"--in-place",
35+
"--remove-all-unused-imports",
36+
"--remove-unused-variables",
37+
]

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ docker compose build
168168
### Run Model Conversion
169169

170170
```sh
171-
docker compose run triton-model-builder
171+
docker compose up triton-model-builder
172172
```
173173

174174
### Start Services

docker-compose.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ services:
1111
args:
1212
- TRITON_VERSION=${MAJOR_UPDATE_VERSION}
1313
- PROTOBUF_URL=${PROTOBUF_URL}
14+
- TAO_VERSION=${TAO_VERSION}
1415
context: docker/triton-server
1516
image: triton-server-image
16-
shm_size: 64g
1717
ulimits:
1818
memlock: -1
1919
stack: 1073741824
@@ -24,9 +24,15 @@ services:
2424
volumes:
2525
- type: bind
2626
source: docker/triton-server/facenet_model
27-
target: /tmp/facenet_model
27+
target: /tmp/dali/facenet_model
2828
- type: bind
2929
source: docker/triton-server/fpenet_model
30+
target: /tmp/dali/fpenet_model
31+
- type: bind
32+
source: ${FACENET_MODEL_PATH}
33+
target: /tmp/facenet_model
34+
- type: bind
35+
source: ${FPENET_MODEL_PATH}
3036
target: /tmp/fpenet_model
3137
- type: bind
3238
source: docker/triton-server/tlt-converter.sh
@@ -37,7 +43,6 @@ services:
3743

3844
triton-server:
3945
image: triton-server-image
40-
shm_size: 64g
4146
ulimits:
4247
memlock: -1
4348
stack: 67108864
@@ -76,7 +81,6 @@ services:
7681
- PROTOBUF_URL=${PROTOBUF_URL}
7782
context: docker/triton-client
7883
image: triton-client
79-
shm_size: 64g
8084
ulimits:
8185
memlock: -1
8286
stack: 67108864

docker/triton-server/Dockerfile

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ FROM ${BASE_IMAGE} as builder
66
ENV DEBIAN_FRONTEND=noninteractive
77

88
# Python dependencies.
9+
# https://docs.nvidia.com/deeplearning/dali/user-guide/docs/installation.html#nvidia-dali
910
COPY requirements.txt .
1011
RUN pip install -r requirements.txt \
1112
&& pip install --extra-index-url \
@@ -20,14 +21,15 @@ RUN wget ${PROTOBUF_URL} -O proto.zip \
2021
&& mv bin/protoc /usr/local/bin
2122

2223
# Download and install TAO Toolkit converter: https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tao/resources/tao-converter
23-
RUN wget --content-disposition https://api.ngc.nvidia.com/v2/resources/nvidia/tao/tao-converter/versions/v4.0.0_trt8.5.1.7_x86/zip \
24-
-O tao-converter_v4.0.0_trt8.5.1.7_x86.zip \
25-
&& unzip tao-converter_v4.0.0_trt8.5.1.7_x86.zip \
24+
ARG TAO_VERSION=v5.1.0_8.6.3.1_x86
25+
RUN wget --content-disposition https://api.ngc.nvidia.com/v2/resources/nvidia/tao/tao-converter/versions/${TAO_VERSION}/zip \
26+
-O tao-converter_${TAO_VERSION}.zip \
27+
&& unzip tao-converter_${TAO_VERSION}.zip \
2628
&& mv tao-converter /opt \
2729
&& chmod +x /opt/tao-converter
2830

2931
ENV TRT_LIB_PATH=/usr/lib/x86_64-linux-gnu
3032
ENV TRT_INC_PATH=/usr/include/x86_64-linux-gnu
3133
ENV PATH=/opt/tao-converter:$PATH
3234

33-
WORKDIR /opt/tritonserver
35+
WORKDIR /opt/tritonserver

docker/triton-server/facenet_model/serialize_dali.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ def __init__(self):
1717
self.one_over_255 = 1 / 255.0
1818

1919
def load_images(self):
20-
self.image_tensor = fn.decoders.image(
21-
self.raw_image_tensor, output_type=types.GRAY, device="mixed"
22-
)
20+
self.image_tensor = fn.decoders.image(self.raw_image_tensor,
21+
output_type=types.GRAY,
22+
device="mixed")
2323

2424
def color_space_conversion(self):
25-
self.image_tensor = fn.color_space_conversion(
26-
self.image_tensor, image_type=types.GRAY, output_type=types.RGB
27-
)
25+
self.image_tensor = fn.color_space_conversion(self.image_tensor,
26+
image_type=types.GRAY,
27+
output_type=types.RGB)
2828

2929
def resize_images(self):
3030
self.image_tensor = fn.resize(
@@ -37,7 +37,7 @@ def resize_images(self):
3737
def transpose_images(self):
3838
self.image_tensor = fn.transpose(self.image_tensor, perm=[2, 0, 1])
3939

40-
@pipeline_def(batch_size=1, num_threads=64)
40+
@pipeline_def(batch_size=32, num_threads=64)
4141
def facenet_reshape(self):
4242
self.load_images()
4343
self.color_space_conversion()

docker/triton-server/fpenet_model/serialize_dali.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def resize_slice_bbox(self):
4040
def transpose_images(self):
4141
self.image_tensor = fn.transpose(self.image_tensor, perm=[2, 0, 1])
4242

43-
@pipeline_def(batch_size=1, num_threads=64)
43+
@pipeline_def(batch_size=32, num_threads=64)
4444
def fpenet_transform(self):
4545
self.load_images()
4646
self.slice_bbox()

docker/triton-server/tlt-converter.sh

+15-18
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/bin/bash
2-
MIN_BATCH=1
3-
OPT_BATCH=1
4-
MAX_BATCH=1
2+
MIN_BATCH=8
3+
OPT_BATCH=16
4+
MAX_BATCH=32
55

6-
echo "Preparing FaceNet Models"
7-
echo "----------------------------------------------------------------------------------------------------------------"
6+
echo "[INFO] Preparing FaceNet Models"
87
echo "[INFO] Serializing FaceNet DALI model"
9-
python3 /tmp/facenet_model/serialize_dali.py
8+
python3 /tmp/dali/facenet_model/serialize_dali.py
109
echo "[INFO] FaceNet DALI model serialization complete"
1110

1211
# https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tao/models/facenet/version
@@ -17,10 +16,10 @@ echo "[INFO] FaceNet DALI model serialization complete"
1716
# -d 3,416,736 \
1817
# -i nchw \
1918
# -e /models/facenet/1/model.trt \
20-
# -c /tmp/facenet_model/facenet_vpruned_quantized_v2.0.1/int8_calibration.txt \
21-
# /tmp/facenet_model/facenet_vpruned_quantized_v2.0.1/model.etlt
19+
# -c /tmp/facenet_model/int8_calibration.txt \
20+
# /tmp/facenet_model/model.etlt
2221

23-
## FP32 Calibration
22+
## Calibration
2423
/opt/tao-converter \
2524
-k nvidia_tlt \
2625
-d 3,416,736 \
@@ -29,18 +28,16 @@ echo "[INFO] FaceNet DALI model serialization complete"
2928
-b ${MIN_BATCH} \
3029
-m ${MAX_BATCH} \
3130
-p input_1,${MIN_BATCH}x3x416x736,${OPT_BATCH}x3x416x736,${MAX_BATCH}x3x416x736 \
32-
/tmp/facenet_model/facenet_vdeployable_v1.0/model.etlt
31+
/tmp/facenet_model/model.etlt
3332

3433

3534
protoc -I=/models/facenet_postprocess/1/postprocessing \
3635
--python_out=/models/facenet_postprocess/1/postprocessing \
3736
/models/facenet_postprocess/1/postprocessing/postprocessor_config.proto
3837
echo "[INFO] Completed FaceNet Models prep"
39-
echo
40-
echo "Preparing FPENet Model"
41-
echo "----------------------------------------------------------------------------------------------------------------"
38+
echo "[INFO] Preparing FPENet Model"
4239
echo "[INFO] Serializing FPENet DALI model"
43-
python3 /tmp/fpenet_model/serialize_dali.py
40+
python3 /tmp/dali/fpenet_model/serialize_dali.py
4441
echo "[INFO] FPENet DALI model serialization complete"
4542

4643
# https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tao/models/fpenet/version
@@ -53,15 +50,15 @@ echo "[INFO] FPENet DALI model serialization complete"
5350
# -i nchw \
5451
# -e /models/fpenet/1/model.trt \
5552
# -p input_face_images,${MIN_BATCH}x1x80x80,${OPT_BATCH}x1x80x80,${MAX_BATCH}x1x80x80 \
56-
# -c /tmp/fpenet_model/fpenet_vdeployable_v3.0/int8_calibration.txt \
57-
# /tmp/fpenet_model/fpenet_vdeployable_v3.0/model.etlt
53+
# -c /tmp/fpenet_model/int8_calibration.txt \
54+
# /tmp/fpenet_model/model.etlt
5855

59-
## FP32 Calibration
56+
## Calibration
6057
/opt/tao-converter \
6158
-k nvidia_tlt \
6259
-o conv_keypoints_m80 \
6360
-d 1,80,80 \
6461
-i nchw \
6562
-e /models/fpenet/1/model.trt \
6663
-p input_face_images,${MIN_BATCH}x1x80x80,${OPT_BATCH}x1x80x80,${MAX_BATCH}x1x80x80 \
67-
/tmp/fpenet_model/fpenet_vdeployable_v3.0/model.etlt
64+
/tmp/fpenet_model/model.etlt

triton-models/facenet/config.pbtxt

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
name: "facenet"
22
platform: "tensorrt_plan"
33
default_model_filename: "model.trt"
4-
max_batch_size: 1
4+
max_batch_size: 32
5+
dynamic_batching {
6+
preferred_batch_size: [ 8, 16, 32 ]
7+
max_queue_delay_microseconds: 100
8+
}
59

610
instance_group [
711
{
8-
count: 4
12+
count: 2
913
kind: KIND_GPU
1014
}
1115
]
@@ -46,9 +50,9 @@ parameters {
4650
}
4751
}
4852

49-
parameters {
53+
parameters {
5054
key: "license"
5155
value: {
5256
string_value: "License to use this model is covered by the Model EULA. By downloading the unpruned or pruned version of the model, you accept the terms and conditions of these licenses. https://developer.nvidia.com/deep-learning-models-license-agreement"
5357
}
54-
}
58+
}

triton-models/facenet_ensemble/config.pbtxt

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: "facenet_ensemble"
22
platform: "ensemble"
3-
max_batch_size: 1
4-
3+
max_batch_size: 32
54

65
input [
76
{
@@ -90,4 +89,4 @@ output [
9089
}
9190
}
9291
]
93-
}
92+
}

triton-models/facenet_postprocess/1/postprocessing/postprocessor_config_pb2.py

+5-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

triton-models/facenet_postprocess/config.pbtxt

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
name: "facenet_postprocess"
22
backend: "python"
33
default_model_filename: "model.py"
4-
max_batch_size: 1
4+
max_batch_size: 32
5+
dynamic_batching {
6+
preferred_batch_size: [ 8, 16, 32 ]
7+
max_queue_delay_microseconds: 100
8+
}
59

610
instance_group [
711
{
8-
count: 4
9-
kind: KIND_CPU
12+
count: 2
13+
kind: KIND_GPU
1014
}
1115
]
12-
16+
1317
input [
1418
{
1519
name: "output_bbox/BiasAdd"
@@ -39,4 +43,4 @@ output [
3943
data_type: TYPE_FP32,
4044
dims: [ -1, 1 ]
4145
}
42-
]
46+
]

0 commit comments

Comments
 (0)