问题描述
导出训练有素的模型后,BatchNorm层仍然存在。我读过某个地方,出于推断原因应将其删除,原因有二:
- 网络输出可能错误
- 整个network 的加速
好吧,我对1.表示怀疑,但是第二个事实听起来合乎逻辑,所以我的问题是: 然后如何过滤掉图层?
环境:来自Tensorflow GitHub的模型,并在Tensorflow 1.15.3上进行了培训。
使用过的出口:
python deeplab/export_model.py \
--num_classes=2 --model_variant="mobilenet_v3_large_seg" \
--dataset="123" \
--checkpoint_path=training \
--crop_size=384 \
--crop_size=384 \
--export_path=graph.pb
节选网络图:
(<tf.Tensor 'MobilenetV3/MobilenetV3/input:0' shape=(1,768,3) dtype=float32>,)
(<tf.Tensor 'MobilenetV3/Conv/weights:0' shape=(3,3,16) dtype=float32>,)
(<tf.Tensor 'MobilenetV3/Conv/weights/read:0' shape=(3,)
(<tf.Tensor 'MobilenetV3/Conv/Conv2D:0' shape=(1,384,)
(<tf.Tensor 'MobilenetV3/Conv/BatchNorm/gamma:0' shape=(16,) dtype=float32>,)
(<tf.Tensor 'MobilenetV3/Conv/BatchNorm/gamma/read:0' shape=(16,)
(<tf.Tensor 'MobilenetV3/Conv/BatchNorm/beta:0' shape=(16,)
(<tf.Tensor 'MobilenetV3/Conv/BatchNorm/beta/read:0' shape=(16,)
(<tf.Tensor 'MobilenetV3/Conv/BatchNorm/moving_mean:0' shape=(16,)
(<tf.Tensor 'MobilenetV3/Conv/BatchNorm/moving_mean/read:0' shape=(16,)
(<tf.Tensor 'MobilenetV3/Conv/BatchNorm/moving_variance:0' shape=(16,)
(<tf.Tensor 'MobilenetV3/Conv/BatchNorm/moving_variance/read:0' shape=(16,)
(<tf.Tensor 'MobilenetV3/Conv/BatchNorm/FusedBatchNormV3:0' shape=(1,<tf.Tensor 'MobilenetV3/Conv/BatchNorm/FusedBatchNormV3:1' shape=(16,<tf.Tensor 'MobilenetV3/Conv/BatchNorm/FusedBatchNormV3:2' shape=(16,<tf.Tensor 'MobilenetV3/Conv/BatchNorm/FusedBatchNormV3:3' shape=(16,<tf.Tensor 'MobilenetV3/Conv/BatchNorm/FusedBatchNormV3:4' shape=(16,<tf.Tensor 'MobilenetV3/Conv/BatchNorm/FusedBatchNormV3:5' shape=<unknown> dtype=float32>)
(<tf.Tensor 'MobilenetV3/Conv/hard_swish/add/y:0' shape=() dtype=float32>,)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)