tensorflow,object,detection,在model zoom,新下载的模型,WARNING:root:Variable [resnet_v1_50/block1/unit_3/bottleneck_v1/conv3/BatchNorm/gamma] is not available in checkpoint
现象:
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/BatchNorm/beta] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/BatchNorm/beta/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/BatchNorm/gamma] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/BatchNorm/gamma/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/BatchNorm/moving_mean] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/BatchNorm/moving_variance] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/weights] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/weights/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv2/BatchNorm/beta] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv2/BatchNorm/beta/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv2/BatchNorm/gamma] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv2/BatchNorm/gamma/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv2/BatchNorm/moving_mean] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv2/BatchNorm/moving_variance] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv2/weights] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv2/weights/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv3/BatchNorm/beta] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv3/BatchNorm/beta/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv3/BatchNorm/gamma] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv3/BatchNorm/gamma/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv3/BatchNorm/moving_mean] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv3/BatchNorm/moving_variance] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv3/weights] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv3/weights/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/shortcut/BatchNorm/beta] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/shortcut/BatchNorm/beta/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/shortcut/BatchNorm/gamma] is not available in checkpoint
这个报的warning是你要的变量在 checkpoint里面找不到!!!!!!!!!!!
那checkpoint里面是什么?????????????那就去看咯:
然后就吧checkpoint的信息打印出来:
import tensorflow as tf
from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file
latest_ckp = tf.train.latest_checkpoint('./') # checkpoint 所在的路径是当前文件夹(./),如果是其他,请改过来
print_tensors_in_checkpoint_file(latest_ckp, all_tensors=True, tensor_name='')
然后发现:
tensor_name: FeatureExtractor/resnet_v1_50/block4/unit_2/bottleneck_v1/conv3/BatchNorm/beta
[-1.2371869 -1.3236059 -1.2312554 ... -1.3017322 -1.2117504 -1.4911506]
tensor_name: FeatureExtractor/resnet_v1_50/block4/unit_2/bottleneck_v1/conv3/BatchNorm/gamma
[1.4568403 1.4048293 1.0624585 ... 1.1037463 1.0324904 1.0967498]
tensor_name: FeatureExtractor/resnet_v1_50/block4/unit_2/bottleneck_v1/conv3/BatchNorm/moving_mean
[-0.08689928 0.00798311 -0.02823892 ... -0.04347016 -0.07710622
-0.04719209]
tensor_name: FeatureExtractor/resnet_v1_50/block4/unit_2/bottleneck_v1/conv3/BatchNorm/moving_variance
[0.00452107 0.00487971 0.00305854 ... 0.00261809 0.00344088 0.00306313]
tensor_name: FeatureExtractor/resnet_v1_50/block4/unit_2/bottleneck_v1/conv3/weights
[[[[ 1.2295754e-03 -9.4967345e-03 -6.6470391e-05 ... -9.7579239e-03
1.1851139e-02 -1.0630138e-02]
[-4.5038795e-04 -3.9205588e-03 -6.4933673e-03 ... 9.1390898e-03
-1.1232623e-02 -9.8358802e-03]
[ 1.3918030e-02 -7.1829297e-03 3.0942420e-03 ... -6.6203251e-03
原来是少了FeatureExtractor,这时候就去找restore var 的code
var_name = (
re.split('^' + self._extract_features_scope + '/',
var_name)[-1])
他把这个给干掉了,所以:_extract_features_scope就是:FeatureExtractor
发现
问题是,tensorflow object detection 在model zoom新下载的模型命名方式改变了,如果使用旧的代码加载新的模型就会出现这个问题,解决方案是research/object_detection/meta_architectures/ssd_meta_arch.py
var_name = (
re.split('^' + self._extract_features_scope + '/',
var_name)[-1])
改为:
var_name = (
re.split('^' + '/',
var_name)[-1])
同样的其他模型也是这样。
但是,后面还是出现:
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/BatchNorm/beta/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/BatchNorm/gamma/Momentum] is not available in checkpoint
WARNING:root:Variable [resnet_v1_50/block1/unit_1/bottleneck_v1/conv1/weights/Momentum] is not available in checkpoint
仔细看,你会发现,这只是Momentum造成的,是优化器中的参数,不是模型参数,Momentum是动量的意思,优化器使用这个是为了
避免收敛到局部极值。這個不影響的。如果不想報錯可以:
if fine_tune_checkpoint_type == 'classification':
var_name = (
re.split('^' + '/',
var_name)[-1])
# var_name = (
# re.split('^' + self._extract_features_scope + '/',
# var_name)[-1])
if 'Momentum' in var_name:
continue
variables_to_restore[var_name] = variable
加一個:
if 'Momentum' in var_name:
continue
如果是Moment 變量就不加載。
不过,如果对这套代码不了解的,建议update最新的代码。
tensorflow,object,detection,在model zoom,新下载的模型,WARNING:root:Variable [resnet_v1_50/block1/unit_3/bottleneck_v1/conv3/BatchNorm/gamma] is not available in checkpoint的更多相关文章
- TensorFlow Object Detection API中的Faster R-CNN /SSD模型参数调整
关于TensorFlow Object Detection API配置,可以参考之前的文章https://becominghuman.ai/tensorflow-object-detection-ap ...
- [Tensorflow] Object Detection API - predict through your exclusive model
开始预测 一.训练结果 From: Testing Custom Object Detector - TensorFlow Object Detection API Tutorial p.6 训练结果 ...
- TensorFlow object detection API应用
前一篇讲述了TensorFlow object detection API的安装与配置,现在我们尝试用这个API搭建自己的目标检测模型. 一.准备数据集 本篇旨在人脸识别,在百度图片上下载了120张张 ...
- TensorFlow object detection API应用--配置
目标检测在图形识别的基础上有了更进一步的应用,但是代码也更加繁琐,TensorFlow专门为此开设了一个object detection API,接下来看看怎么使用它. object detectio ...
- 对于谷歌开源的TensorFlow Object Detection API视频物体识别系统实现教程
本教程针对Windows10实现谷歌近期公布的TensorFlow Object Detection API视频物体识别系统,其他平台也可借鉴. 本教程将网络上相关资料筛选整合(文末附上参考资料链接) ...
- Tensorflow object detection API(1)---环境搭建与测试
参考: https://blog.csdn.net/dy_guox/article/details/79081499 https://blog.csdn.net/u010103202/article/ ...
- 基于TensorFlow Object Detection API进行迁移学习训练自己的人脸检测模型(二)
前言 已完成数据预处理工作,具体参照: 基于TensorFlow Object Detection API进行迁移学习训练自己的人脸检测模型(一) 设置配置文件 新建目录face_faster_rcn ...
- 使用Tensorflow Object Detection进行训练和推理
整体流程(以PASCAL VOC为例) 1.下载PASCAL VOC2012数据集,并将数据集转为tfrecord格式 2.选择并下载预训练模型 3.配置训练文件configuration(所有的训练 ...
- TensorFlow Object Detection API(Windows下训练)
本文为作者原创,转载请注明出处(http://www.cnblogs.com/mar-q/)by 负赑屃 最近事情比较多,前面坑挖的有点久,今天终于有时间总结一下,顺便把Windows下训练跑通.Li ...
随机推荐
- 单例模式实例&多线程应用
单例模式是指:对于一个类在内存中只能存在唯一一个对象,这种设计模式叫做单例设计模式. 单例设计模式的写法: 1. 设置私有(private)的构造方法. 2. 实例化一个该类的对象作为成员变量,并设置 ...
- Spring Data Solr相关配置
1.增加Maven POM文件的存储库:pom配置如下: <repositories> <repository> <id>spring-milestone</ ...
- (引用)!Unicode,GBK以及UTF8的联系和区别
在实现单片机显示汉字的操作时,了解到有关汉字编码的相关概念. Unicode是一种字符集,该字符集可以涵盖世界上所有的语言.最常见的字符集是ASC II-0~127(0x00~0x7f).Unicod ...
- 报错:Heartbeating to master:7182 failed.
报错背景: cloudera-scm-agent 可以启动并且存活,但是jps没有进程. 报错现象: 查看报错日志:/opt/cm-5.15.1/log/cloudera-scm-agent/clou ...
- javaweb开发大致流程
- 一个故事带你理解if __name__ == '__main__'
如果你刚刚接触python,相信会在看别人的程序的时候会遇到if __name__ == '__main__'酱紫的语法,如果当时没看懂现在也一知半解的话,看下去,本文可以帮你解决这个问题. 大家都知 ...
- aspose.cells 复制单元格
将第1行至第27行复制到第28行 cells.CopyRows(cells, 0, i*27, 27);
- IIS发布ASP.NET Core
安装IIS.程序和功能--程序卸载--启用或关闭Windows功能 安装.NET Core SDK和Runtime.下载网址 https://www.microsoft.com/net/downloa ...
- 初次使用Windbg检查C#程序内存
1. 下载windbg并安装. 我下载的是 Windbg 6.12.注意,windbg分32位和64位,由分析环境的位数决定.我这里安装的是32位的.安装过程很简单,一路next就可以. 2. 准备被 ...
- vue-cli · Failed to download repo vuejs-templates/webpack: connect ETIMEDOUT 13.229.188.59:443
初始化vue项目 vue init webpack vue-demo 之后 一直报vue-cli · Failed to download repo vuejs-templates/webpack: ...