Throughout this experiment, I used the GPU-enabled Google Colab ipython notebook with NVIDIA TESLA.
I am trying to optimise my custom Mask-RCNN model (.h5
) using TensorRT 8.0.0.3
I successfully converted my custom model (with 4 classes) to Uff.
For running inference, I compile the given sample_uff_maskRCNN
by simply altering its config file and replacing
// Number of classification classes (including background)
-static const int NUM_CLASSES = 1 + 80; // COCO has 80 classes
+static const int NUM_CLASSES = 1 + 3; // COCO has 80 classes
// COCO Class names
static const std::vector<std::string> CLASS_NAMES = {
- "BG",
- "person",
- "bicycle",
- "car",
- "motorcycle",
- "airplane",
- "bus",
- "train",
- "truck",
- "boat",
- "traffic light",
- "fire hydrant",
- "stop sign",
- "parking meter",
- "bench",
- "bird",
- "cat",
- "dog",
- "horse",
- "sheep",
- "cow",
- "elephant",
- "bear",
- "zebra",
- "giraffe",
- "backpack",
- "umbrella",
- "handbag",
- "tie",
- "suitcase",
- "frisbee",
- "skis",
- "snowboard",
- "sports ball",
- "kite",
- "baseball bat",
- "baseball glove",
- "skateboard",
- "surfboard",
- "tennis racket",
- "bottle",
- "wine glass",
- "cup",
- "fork",
- "knife",
- "spoon",
- "bowl",
- "banana",
- "apple",
- "sandwich",
- "orange",
- "broccoli",
- "carrot",
- "hot dog",
- "pizza",
- "donut",
- "cake",
- "chair",
- "couch",
- "potted plant",
- "bed",
- "dining table",
- "toilet",
- "tv",
- "laptop",
- "mouse",
- "remote",
- "keyboard",
- "cell phone",
- "microwave",
- "oven",
- "toaster",
- "sink",
- "refrigerator",
- "book",
- "clock",
- "vase",
- "scissors",
- "teddy bear",
- "hair drier",
- "toothbrush",
+ "BG",
+ "rocket",
+ "shuttle",
+ "aliens"
};
I also replace the sample uff file with mine but with the same name.
On running I get:
&&&& RUNNING TensorRT.sample_maskrcnn [TensorRT v8001] # ./sample_uff_maskRCNN --datadir /content/TensorRT-8.0.0.3/data/faster-rcnn --fp16
[07/30/2021-06:43:29] [I] Building and running a GPU inference engine for Mask RCNN
[07/30/2021-06:43:30] [I] [TRT] [MemUsageChange] Init CUDA: CPU +0, GPU +0, now: CPU 0, GPU 254 (MiB)
sample_uff_maskRCNN: detectionLayerPlugin.cpp:254: void nvinfer1::plugin::DetectionLayer::check_valid_inputs(const Dims*, int): Assertion `inputs[0].nbDims == 4 && inputs[0].d[1] == mNbClasses * 4' failed.
As per the error, the following mentioned assertion fails. I can’t understand how to debug this.