I am working on inferencing using trained tensorflow SSD_mobilenetV2 models (from Tensorflow/models/research/object_detection), following the example given by sampleUffSSD (TensorRT-18.104.22.168). The conversion from the frozen graph to UFF file is successful, however, when running ./sample_uff_ssd, erros occur:
ERROR: UFFParser: Parser error: BoxPredictor_0/Reshape: Reshape: -1 dimension specified more than 1 time
In the frozen graph from ssd_inception_v2_coco_2018_01_28, which works well with sampleUffSSD, BoxPredictor_0/Reshape:0 has a shape of (?, 1083, 1, 4).
In the forzen graph from the ssd_mobilenetV2 model built by tensorflow object detection API, however, BoxPredictor_0/Reshape:0 has another shape of (?, ?, 1, 4). In the code [https://github.com/tensorflow/models/blob/03612984e9f7565fed185977d251bbc23665396e/research/object_detection/predictors/heads/box_head.py#L183], four shape parameter is given by [batch_size, -1, 1, self._box_code_size] (box_encodings = tf.reshape(box_encodings,[batch_size, -1, 1, self._box_code_size]). So it seems to me that, batch_size is also recognized as “-1” by the UFF converter, so the input shape of the reshape operation becomes [-1, -1, 1, self._box_code_size], which leads to the error: Reshape: -1 dimension specified more than 1 time
The possible solution I can think about is that, when building the graph, a value instead of “-1” (e.g. 1083 for BoxPredictor_0) should be used. This however, required extra work to be integrated into the object detection API, and we might need to do the same for classPredictor reshape operation in different scales.
Could someone please help with this?