I write a demo about INT8 with caffe. But some errors here:
python: ./parserHelper.h:99: nvinfer1::DimsCHW parserhelper::getCHW(const nvinfer1::Dims&): Assertion `d.nbDims >= 3’ failed.
How can I do to solve it ? Thank you!
The calib return data size is (nums, channels 3, image_h, image_w).
The error occur at line 11:
def build_int8_engine(deploy_file, model_file, calib, batch_size=32):
with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as network, trt.CaffeParser() as parser:
# We set the builder batch size to be the same as the calibrator’s, as we use the same batches
# during inference. Note that this is not required in general, and inference batch size is
# independent of calibration batch size.
builder.max_batch_size = batch_size
builder.max_workspace_size = GiB(1)
builder.int8_mode = True
builder.int8_calibrator = calib
# Parse Caffe model
model_tensors = parser.parse(deploy=deploy_file, model=model_file, network=network, dtype=ModelData.DTYPE)
network.mark_output(model_tensors.find(ModelData.OUTPUT_NAME))
# Build engine and do int8 calibration.
return builder.build_cuda_engine(network)
I have upload the files. It’s just a demo. Run it by ‘python VGGFace2_INT8.py’.
I want to qualitize VGGFace2 caffe model with TensorRT for NVDLA. The calibarator file (vggface2_calibration.cache) is all what I need.
What’s more, the images folder only has 3 pics, it’s a try. I don’t think this occur the problem. But I’m not sure.
I run it with cuda10.2, cudnn7, TensorRT7, python3.5 and Ubuntu16.04.
And I get error:
I‘m not sure whether the files upload successfully. If not, please tell me. By the way, the caffe model is transformed from a pytorch model. In order to suit tensorRT, I delete the para ‘ceil_model = false’ in every pooling layer. And I modify the max_pool3 layer’s stride from 3 to 4, for keeping the compatibility of feature map in ‘cat17’ layer.
Hi @Supine,
I have not received your model.
Maybe you can try uploading it over drive and share the link .
Also request you to provide the below set of information
o Linux distro and version
o GPU type
o Nvidia driver version
o CUDA version
o CUDNN version
o Python version [if using python]
o Tensorflow and PyTorch version
o TensorRT version
It’s just a demo. Run it by ‘python VGGFace2_INT8.py’.
I want to qualitize VGGFace2 caffe model with TensorRT for NVDLA. The calibarator file (vggface2_calibration.cache) is all what I need.
What’s more, the images folder only has 3 pics, it’s a try. I don’t think this occur the problem. But I’m not sure.
I run it with cuda10.2, cudnn7, TensorRT7, python3.5 and Ubuntu16.04.
The caffe model is transformed from a pytorch modelfacenet. In order to suit tensorRT, I delete the para ‘ceil_model = false’ in every pooling layer. And I modify the max_pool3 layer’s stride from 3 to 4, for keeping the compatibility of feature map in ‘cat17’ layer. It will not effect the params.
I have ran my code with ResNet-50, it worked. But not work on my model.
The error is python: ./parserHelper.h:99: nvinfer1::DimsCHW parserhelper::getCHW(const nvinfer1::Dims&): Assertion `d.nbDims >= 3’ failed.
I’m wondering why it is, thank you very much.
o Linux distro and version: Ubuntu 16.04
o GPU type: GTX Titan X
o Nvidia driver version: 450.57
o CUDA version: 10.2
o CUDNN version: 7
o Python version [if using python]: python 3.5
o Tensorflow and PyTorch version: Pytorch 1.6
o TensorRT version: 7.0.0.11
The Reshape layer transform n×c×h×w into n×c, but it isn’t what InnerProduct layer what in caffe.
If I delete the Reshape layer, the other error occurs:
TypeError: mark_output(): incompatible function arguments. The following argument types are supported:
1. (self: tensorrt.tensorrt.INetworkDefinition, tensor: tensorrt.tensorrt.ITensor) → None
Invoked with: <tensorrt.tensorrt.INetworkDefinition object at 0x7f410c1035a8>, None
I don’t know what it’s, can you help me? Thank you.