Method for compressing an AI-based object detection model for deployment on resource-limited devices
Disclosed herein is a method for efficiently reducing the computational footprint of any AI-based object detection model, so as to enable its real-time deployment on computing resource-limited (i.e., low-power, embedded) devices. The disclosed method provides a step-by-step framework using an optimized combination of compression techniques to effectively compress any given AI-based object detection model.
1 . A method for compressing an AI-based object detector comprising:
creating a training dataset of images with labelled images from one or more object classes of interest, the images having an initial size;
choosing an object detection model having a backbone component and a detection branch;
replacing the backbone component of the chosen object detection model with a smaller model;
reducing the size of the images in the training dataset;
training the object detection model on the reduced-size training dataset;
pruning the object detection model using a pruning algorithm;
quantizing the object detection model; and
deploying the object detection model;
wherein the object detection model with the smaller model backbone component is first trained on a diverse dataset of images containing many object classes, including both object classes of interest and object classes not of interest, to establish a base set of weights and subsequently trained on the training dataset of reduced size images containing labelled objects from the one or more object classes of interest.
2 . The method of claim 1 wherein the smaller model used to replace the backbone of the chosen object detection model is MobileNetv2 or EfficientNet.
3 . The method of claim 1 wherein the initial size of the images in the training dataset is 240×240 and further wherein the images are reduced to a 180×180 resolution.
4 . The method of claim 1 wherein the size of the images in the training dataset is reduced by at least 30%.
5 . The method of claim 1 wherein the pruning algorithm used to prune the object detection model is Network Slimming.
6 . The method of claim 1 wherein quantizing the object detection model comprises replacing float32 precision weights with float16 weights, int8 weights or a combination of float16 and int8 weights.
7 . A system comprising:
a processor;
memory, storing software that, when executed by the processor, performs the method of claim 1 .
8 . The method of claim 1 wherein objects in the object classes of interest are labelled in the reduced-size training dataset by placement of the objects in a bounding box.