When deploying Deep Neural Networks (DNNs), developers often convert models from one deep learning framework to another (e.g., TensorFlow to PyTorch). However, this process is error-prone and can impact target model accuracy. To identify the extent of such impact, we perform and briefly present a differential analysis against three DNNs used for image recognition (MobileNetV2, ResNet101, and InceptionV3), converted across four well-known deep learning frameworks (PyTorch, Keras, TensorFlow (TF), and TFLite), which revealed numerous model crashes and output label discrepancies of up to 100%. To mitigate such errors, we present a novel approach towards fault localization and repair of buggy deep learning framework conversions, focusing on pre-trained image recognition models. Our technique consists of four primary stages of analysis: 1) conversion tools, 2) model parameters, 3) model hyperparameters, and 4) graph representation. In addition, we propose a number of strategies towards fault repair of the faults detected. We implement our technique on top of Apache TVM deep learning compiler, and we test it by conducting a preliminary fault localization analysis for the conversion of InceptionV3, from TF to TFLite. Our approach detected that the tf2onnx tool used in the conversion process introduced precision errors to model weights for convolutional layers in particular, which negatively affected the model accuracy. We then repaired the target model by replacing the affected weights with those from source model.
翻译:在部署深度神经网络(DNN)时,开发人员常需将模型从一个深度学习框架转换至另一个(例如从TensorFlow转换为PyTorch)。然而,该过程易出错,且可能影响目标模型的精度。为识别此类影响的程度,我们对用于图像识别的三个DNN模型(MobileNetV2、ResNet101和InceptionV3)在四个知名深度学习框架(PyTorch、Keras、TensorFlow (TF) 和 TFLite)间的转换进行了差分分析并简要呈现结果,发现了大量模型崩溃问题及高达100%的输出标签差异。为缓解此类错误,我们提出了一种针对有缺陷的深度学习框架转换进行故障定位与修复的新方法,重点聚焦于预训练图像识别模型。我们的技术包含四个主要分析阶段:1)转换工具,2)模型参数,3)模型超参数,以及4)图表示。此外,我们还提出了若干针对检测到故障的修复策略。我们基于Apache TVM深度学习编译器实现了该技术,并通过将InceptionV3从TF转换至TFLite的过程进行初步故障定位分析来加以测试。我们的方法检测到,转换过程中使用的tf2onnx工具特别对卷积层的模型权重引入了精度误差,从而对模型精度产生了负面影响。随后,我们通过用源模型的受影响权重替换目标模型中的对应权重,修复了目标模型。