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 ...
随机推荐
- ORA-00984: 列在此处不允许 SQL parse error location
ORA-00984: 列在此处不允许SQL parse error location Oracle 插入数据的时候一直提示列在此处不允许.网上搜索答案说是类型不匹配的多,但我的错误确是一个低级错误 ...
- 创建maven工程的时候卡死的解决办法
在idea的maven,runner,properties里面添加 archetypeCatalog=internal
- USB协议学习
URB:USB 请求块(USB request block,urb)是USB 设备驱动中用来描述与USB 设备通信所用的基本载体和核心数据结构,非常类似于网络设备驱动中的sk_buff 结构体.
- RTP实时传输协议
RTP协议是包括一对协议:RTP和RTCP. RTP传输数据,RTCP传输控制信息. 一般基于UDP,RTP使用偶数端口,RTCP使用下一个奇数端口. 层次关系: APP -> RTP -> ...
- FASTMM内存泄漏处理
https://blog.csdn.net/akof1314/article/details/6524767
- 工控随笔_16_西门子_S7-200.Smart软件安装兼容性说明和错误代码:error code hr=0x80070430
现在西门子的软件是更新换代太快了,前几年还是Step 7 Micro/Win,后来又出了S7-200 Smart PLC,理所当然的编程调试软件也水涨船高,出了新的Step 7 Micro/Win ...
- SMTP 协议
SMTP 响应状态码 代码 说明 说明 211 System status, or system help reply 系统状态或显示系统帮助. 214 Help message 显示系统帮助,通常用 ...
- 亚马逊EC2服务器申请+NODE服务器部署+阿里云域名申请+SSL证书使用
最近,由于项目需要,自己申请了一台亚马逊用于部署网站测试,在使用期间,发现网上没有一篇非常完整的文章讲解从服务器申请到域名解析,SSL证书申请的整个流程.所以自己总结一下,以供大家学习! 一.亚马逊E ...
- [STM32F103]串口UART配置
l 串口时钟使能,GPIO时钟使能: RCC_APB2PeriphClockCmd(); l 串口复位: USART_DeInit(); 这一步不是必须的 l GPIO端口模式设置: GPIO_Ini ...
- 小程序navigateBack,子页面传值给父页面
子页面 let page = getCurrentPages(); let prevPage = page[page.length - 2]; prevPage.setData({ lxr :item ...