I have fine tuned the classification_tf2 network from tao toolkit. I can generate the trt engine normally and when I evaluate it the results are satisfcatory. However, when I use the model in deepstream the results differ to the ones i got running inference in tao deploy . I am aware the engine must be generated according to the GPU, that is why i generate a new engine in deepstream.
This is my config files in deepstream 6.3:
The deepstream app:
[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5
[tiled-display]
enable=1
rows=1
columns=1
width=640
height=360
gpu-id=0
nvbuf-memory-type=0
[source0]
enable=1
type=3
uri=file:///root/top/Downloads/vid10_36.mkv
num-sources=1
gpu-id=0
cudadec-memtype=0
[sink0]
enable=1
type=2
sync=0
source-id=0
gpu-id=0
nvbuf-memory-type=0
[osd]
enable=1
gpu-id=0
border-width=1
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0
nvbuf-memory-type=0
[streammux]
gpu-id=0
live-source=0
batch-size=1
batched-push-timeout=40000
width=2688
height=1520
enable-padding=1
nvbuf-memory-type=0
[primary-gie]
enable=1
gpu-id=0
batch-size=1
bbox-border-color0=1;0;0;1
bbox-border-color1=0;1;1;1
bbox-border-color2=0;0;1;1
bbox-border-color3=0;1;0;1
interval=0
gie-unique-id=1
nvbuf-memory-type=0
config-file=config.txt
#The config file:
[property]
gpu-id=0
net-scale-factor=0.017507
offsets=123.675;116.280;103.53
model-color-format=0
batch-size= 1
onnx-file=/root/top/experiments_final3/efficientnet-b0_013.onnx
labelfile-path=/root/top/experiments_final3/labels.txt
model-engine-file=/root/top/experiments_final3/efficientnet-b0_013.onnx_b1_gpu0_int8.engine
int8-calib-file=/root/top/experiments_final3/cal.bin
infer-dims=3;256;256
uff-input-blob-name=input_1
output-blob-names=Identity:0
process-mode=1
network-mode=1
network-type=1
num-detected-classes=3
interval=0
gie-unique-id=1
classifier-async-mode=1
classifier-threshold=0.2
##The training spec file:
dataset:
train_dataset_path: “/home/data/train”
val_dataset_path: “/home/data/val”
preprocess_mode: ‘torch’
num_classes: 3
augmentation:
enable_center_crop: False
enable_random_crop: False
disable_horizontal_flip: True
enable_color_augmentation: False
mixup_alpha: 0
train:
qat: False
checkpoint: ‘’
batch_size_per_gpu: 32
num_epochs: 200
optim_config:
optimizer: ‘sgd’
lr_config:
scheduler: ‘cosine’
learning_rate: 0.0005
soft_start: 0.05
reg_config:
type: ‘L2’
scope: [‘conv2d’, ‘dense’]
weight_decay: 0.00005
results_dir: ‘/home/experiments_final_3/train’
model:
backbone: ‘efficientnet-b0’
input_width: 256
input_height: 256
input_channels: 3
evaluate:
dataset_path: “/home/data/test”
checkpoint: “/home/experiments_final_3/train/efficientnet-b0_010.tlt”
top_k: 1
batch_size: 16
n_workers: 8
results_dir: ‘/home/machukamendosk/experiments_final_3/evaluation’
export:
checkpoint: “/home/experiments_final_3/train/efficientnet-b0_013.tlt”
onnx_file: ‘/home/experiments_final_3/export/efficientnet-b0_013.onnx’
results_dir: ‘/home/experiments_final_3/export’
inference:
checkpoint: ‘’
trt_engine: ‘/home/experiments_final_3/export/efficientnet-b0_013.int8.engine’
image_dir: ‘/home/data/inference1’
classmap: ‘/home/experiments_final_3/train/classmap.json’
results_dir: ‘/home/experiments_final_3/inference1’
gen_trt_engine:
onnx_file: ‘/home/experiments_final_3/export/efficientnet-b0_013.onnx’
trt_engine: ‘/home/experiments_final_3/export/efficientnet-b0_013.int8.engine’
results_dir: ‘/home/experiments_final_3/export’
tensorrt:
data_type: “int8”
max_workspace_size: 4
max_batch_size: 16
calibration:
cal_image_dir: ‘/home/data/val’
cal_data_file: ‘/home/experiments_final_3/export/calib.tensorfile’
cal_cache_file: ‘/home/experiments_final_3/export/cal.bin’
cal_batches: 20
I see the preprocessing is pretty important. But i can not fugure it out what is wrong.
21 posts - 2 participants