I have trained a custom YOLOv5 model for custom object detection. Then exported the trained model to TFlite format. I want to draw bounding box around detected object. To do that, the Location Tensor (see image) should be of shape 4 i.e. return 4 float values as coordinates (as mentioned in Tensorflow docs) but my model’s location tensor is [1, 25200, 6] => 6 float values.
This is making my model incompatible for integration in Android studio.
How to modify my model so that Output Tensor (aka Location Tensor in this case) returns only 4 values ?
Output tensors must be the 4 outputs of a DetectionPostProcess op, i.e:
Locations tensor (kTfLiteFloat32) tensor of size [1 x num_results x 4], the inner array representing bounding boxes in the form [top, left, right, bottom].