How to create mean.ppm for custom caffe models?

Hi @ChrisDing

• Hardware Platform (Jetson / GPU)
Jetson TX2
• DeepStream Version
DS 5.1
• JetPack Version (valid for Jetson only)
4.5.1
• TensorRT Version
7.1

I have the mean.binaryproto for my caffe model already. How can I create a mean.ppm file to load the model as a secondary model along with the tlt pretrained facedetectIR model as primary?

Hi @rohitnairkp ,
You can find PPM format in PPM Format Specification and sample file in /opt/nvidia/deepstream/deepstream-5.1/samples/models/Secondary_CarColor/mean.ppm, so you need to convert mean.binaryproto to mean.ppm.
I’m not sure about the format of mean.binaryproto, but you can read and write the mean value into PMM file following ppm fromat requirement.

To deploy it with DeepStream, you just need to configure “mean-file=” Property of gst-nvinfer, for exmaple,
/opt/nvidia/deepstream/deepstream-5.1/sources/apps/sample_apps/deepstream-perf-demo/perf_demo_sgie1_config.txt

[property]
gpu-id=0
net-scale-factor=1
model-file=…/…/…/…/samples/models/Secondary_CarColor/resnet18.caffemodel
proto-file=…/…/…/…/samples/models/Secondary_CarColor/resnet18.prototxt
model-engine-file=…/…/…/…/samples/models/Secondary_CarColor/resnet18.caffemodel_b16_gpu0_int8.engine
mean-file=…/…/…/…/samples/models/Secondary_CarColor/mean.ppm
labelfile-path=…/…/…/…/samples/models/Secondary_CarColor/labels.txt
int8-calib-file=…/…/…/…/samples/models/Secondary_CarColor/cal_trt.bin
force-implicit-batch-dim=1

@mchi

Is this mean.ppm file mandatory for running the custom caffe model?

if the model you trained includes the mean file, then, yes, it’s needed, otherwise, the inference accuracy will be affected.

@mchi Yes. I already have the mean.binaryproto file that was generated during the caffe model training. Is there any way I can generate a similar mean.ppm from the exisiting mean file?

Sorry! As I said above, I’m not sure about the format of mean.binaryproto, but you can read the data from mean.binaryproto and write the mean value into PMM file following ppm fromat requirement.

PPM is a standard format, if mean.binaryproto is also, I guess there is a tool or code to do the transfer, you could search it from ethernet,

Thanks!