Fixing TensorFlow Lite Dynamic Tensor Error and Optimizing Mask R-CNN on Raspberry Pi
I'm deploying a fine-tuned Mask R-CNN model (ResNet-101) on a Raspberry Pi 4 (4GB RAM) running Raspbian OS, using TensorFlow Lite v2.6 for aerial object detection. During inference, I get the following error:
ValueError: TensorFlow Lite currently supports models with fixed-size input tensors, but the model has dynamic-sized input tensors. Expected input shape: [1, 1024, 1024, 3], but received input shape: [1, 512, 512, 3].
ValueError: TensorFlow Lite currently supports models with fixed-size input tensors, but the model has dynamic-sized input tensors. Expected input shape: [1, 1024, 1024, 3], but received input shape: [1, 512, 512, 3].
Despite resizing all input images to 1024x1024, the model still expects dynamic input shapes. Here's the code for loading and running inference:
I'm also facing significant inference delays (~10 seconds per image). I attempted post-training quantization using float16 and int8, but the performance remains suboptimal.
What strategies can I use to fix the dynamic tensor error, optimize inference speed on Raspberry Pi, and improve detection accuracy for small objects in aerial imagery?
Recent Announcements
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
E
EdgeBench
EdgeBench is a remote platform that lets developers build, test, and evaluate embedded applications on real hardware through a browser.