How to extract stride number and box norm from a tlt (or trt) saved model?

Hi everyone,
I trained a tlt model and then converted it to trt.
In inference part I used a custom python script from one of the topics here and the trt model (I attached the codetlt.py (8.6 KB) ). In the inference part of the code it has two parameters for inference:

  1. box_norm in computing grid cells
  2. stride number
    the box_norm value is 35.0 and stride_number value is 16.
    I want to know how to set these values for each model?
    Can we extract these values from a trt or tlt model?

See DetectNet_v2 — Transfer Learning Toolkit 3.0 documentation

DetectNet_v2 generates 2 tensors, cov and bbox . The image is divided into 16x16 grid cells.

And DetectNet_v2 — Transfer Learning Toolkit 3.0 documentation

objective_set: {
cov {}
bbox {
scale: 35.0
offset: 0.5
}
}

1 Like

Thanks alot @Morganh
Thanks for the documentation, but Can we pass this task to the the code that handle these parameters automatically by extracting from the model?

because my inference code is not use only for detectnetv2, it should be able to work with every given model

These two parameters are only compatible with detectnet_v2 network.

1 Like

Thans @Morganh, yes I saw the document which is for detectnetv2.
So you mean we can’t retrieve them from the saved model in the code?
so the only way is to set them manually for each model, am I right?

Yes, we cannot retrieve them from the model.
I cannot understand why you mention " set them manually for each model". You already wrote them in your python code, right?

1 Like

thank you @Morganh. yes I did this but I had hope that we could extract them from the model.

Mostly end user are using these two parameters in postprocessing only.
For example, postprocess code which is exposed in C++ in /opt/nvidia/deepstream/deepstream/sources/libs/nvdsinfer_customparser/nvdsinfer_custombboxparser.cpp .

1 Like