用mobilenet模型跑tensorflow CNN的样例:image_retrain.py和label_image.py
2018-03-16 00:46
369 查看
系统是 ubuntu 16.04,tensorflow版本是1.6, cuDNN版本是7.0。git clone tensorflow后试着跑了一下image_retrain.py(以下简称retrain)和label_image.py(以下简称label)。retain训练新的mobilenet分类器成功,用label测试新分类器也成功。但是用label在tensorflow 1.4以下的环境中测试新分类器中出错。错误提示如下:
而且在tensorflow 1.4的环境下,运行image_retrain.py(更新日期为2018年2月28日)也报错。
读代码可知,新retain下载的mobilenet地址是
旧retrain下载的mobilenet的地址是
而且根据github上的image_retain.py文件描述
大致可以猜测到新的mobilenet由tensorflow 1.6构造,已经不兼容tensorflow 1.4了。
所以,由于种种原因不能升级到tensorflow 1.6版本的同学,要把老版本的mobilenet和image_retrain.py留好了。
> InvalidArgumentError (see above for traceback): NodeDef mentions attr > 'dilations' not in Op<name=Conv2D; signature=input:T, filter:T -> > output:T; attr=T:type,allowed=[DT_HALF, DT_FLOAT]; > attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; > attr=padding:string,allowed=["SAME", "VALID"]; > attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]>; > NodeDef: import/MobilenetV1/MobilenetV1/Conv2d_0/Conv2D = > Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], > padding="SAME", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, > _device="/job:localhost/replica:0/task:0/device:GPU:0"](_arg_import/input_0_0/_1, > import/MobilenetV1/Conv2d_0/weights). (Check whether your > GraphDef-interpreting binary is up to date with your > GraphDef-generating binary.). [[Node: > import/MobilenetV1/MobilenetV1/Conv2d_0/Conv2D = Conv2D[T=DT_FLOAT, > data_format="NHWC", dilations=[1, 1, 1, 1], padding="SAME", > strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, > _device="/job:localhost/replica:0/task:0/device:GPU:0"](_arg_import/input_0_0/_1, > import/MobilenetV1/Conv2d_0/weights)]]
而且在tensorflow 1.4的环境下,运行image_retrain.py(更新日期为2018年2月28日)也报错。
读代码可知,新retain下载的mobilenet地址是
data_url = 'http://download.tensorflow.org/models/mobilenet_v1_2018_02_22/'
旧retrain下载的mobilenet的地址是
data_url = 'http://download.tensorflow.org/models/mobilenet_v1_'
而且根据github上的image_retain.py文件描述
Modify retrain script to output TFLite compatible quantized models.
大致可以猜测到新的mobilenet由tensorflow 1.6构造,已经不兼容tensorflow 1.4了。
所以,由于种种原因不能升级到tensorflow 1.6版本的同学,要把老版本的mobilenet和image_retrain.py留好了。
相关文章推荐
- Tensorflow + ResNet101 + fasterRcnn 训练自己的模型 数据(一)
- (转)Image Segmentation with Tensorflow using CNNs and Conditional Random Fields
- Ubuntu下深度环境的搭建opencv2.4.9+caffe+py-faster-rcnn+tensorflow的搭建
- retrain tensorflow中InceptionV3模型
- Faster-RCNN Tensorflow版本源码解析(二)train_net.py所用到的函数
- Chinese-Text-Classification:Tensorflow CNN 模型实现的中文文本分类器[不分词版]
- TensorFlow MNIST LeNet 模型持久化
- Keras TensorFlow教程:如何从零开发一个复杂深度学习模型
- Mask R-CNN+tensorflow/keras的配置介绍、代码详解与训练自己的数据集演示
- 机器学习: Tensor Flow +CNN 做笑脸识别
- WARNING:tensorflow:From tf_should_use.py:107 initialize_all_variables(from tensorflow.python.ops.var
- 机器学习: Tensor Flow with CNN 做表情识别
- Docker使用tensorflow serving部署mnist模型
- Tensorflow object detection API 源码阅读笔记:Fast r-cnn
- “Tensorflow+OpenCV“容器进行CNN数字识别训练
- Implementing a CNN for Text Classification in TensorFlow(用tensorflow实现CNN文本分类) 阅读笔记
- TensorFlow on Android:训练模型
- TensorFlow(2):给TensorFlow Image 打补丁增加 TuShare 支持
- 从小白开始入门python+tensorflow+cnn做人脸性别识别(一)
- tensorflow object_detection 用自己的数据训练目标检测模型Mobilenet