Transfer learning on edge is challenging due to on-device limited resources. Existing work addresses this issue by training a subset of parameters or adding model patches. Developed with inference in mind, Inverted Residual Blocks (IRBs) split a convolutional layer into depthwise and pointwise convolutions, leading to more stacking layers, e.g., convolution, normalization, and activation layers. Though they are efficient for inference, IRBs require that additional activation maps are stored in memory for training weights for convolution layers and scales for normalization layers. As a result, their high memory cost prohibits training IRBs on resource-limited edge devices, and making them unsuitable in the context of transfer learning. To address this issue, we present MobileTL, a memory and computationally efficient on-device transfer learning method for models built with IRBs. MobileTL trains the shifts for internal normalization layers to avoid storing activation maps for the backward pass. Also, MobileTL approximates the backward computation of the activation layer (e.g., Hard-Swish and ReLU6) as a signed function which enables storing a binary mask instead of activation maps for the backward pass. MobileTL fine-tunes a few top blocks (close to output) rather than propagating the gradient through the whole network to reduce the computation cost. Our method reduces memory usage by 46% and 53% for MobileNetV2 and V3 IRBs, respectively. For MobileNetV3, we observe a 36% reduction in floating-point operations (FLOPs) when fine-tuning 5 blocks, while only incurring a 0.6% accuracy reduction on CIFAR10. Extensive experiments on multiple datasets demonstrate that our method is Pareto-optimal (best accuracy under given hardware constraints) compared to prior work in transfer learning for edge devices.
翻译:在设备边缘进行迁移学习是一项具有挑战性的任务,原因在于设备上的资源有限。现有的工作通过训练一部分参数或添加模型补丁来解决这个问题。 反向残差块(IRBs)是为推断而开发的,它们将卷积层分为深度卷积和点卷积,从而导致更多的堆叠层,例如卷积、归一化和激活层。虽然它们对于推断是有效的,但IRBs需要存储附加的激活映射,用于训练卷积层的权重和归一化层的尺度。 因此,它们的高存储成本妨碍了在资源有限的边缘设备上训练IRBs,并且使得它们在迁移学习的背景下不适用。 为了解决这个问题,我们提出了MobileTL,它是一种内存和计算资源高效的基于设备内部的迁移学习方法,适用于使用IRBs构建的模型。 MobileTL训练内部归一化层的偏移量,以避免存储反向传递的激活映射。此外,MobileTL将激活层的反向计算(例如,Hard-Swish和ReLU6)近似为有符号函数,从而使反向传递时只需存储二进制掩码而非激活映射。MobileTL只需微调靠近输出端的几个顶部块(close to output),而不是通过整个网络传递梯度来减少计算成本。我们的方法将MobileNetV2和V3 IRBs的内存使用量分别减少46%和53%。对于MobileNetV3,当微调5个块时,我们观察到浮点运算(FLOPs)减少了36%,同时在CIFAR10上只承担0.6%的精度降低。对多个数据集进行的广泛实验表明,与边缘设备迁移学习先前的工作相比,我们的方法是帕累托最优的(给定硬件约束下的最佳精度)。