TensorFlow:谷歌图像识别网络inception-v3下载与查看结构
学习博客:
# https://www.cnblogs.com/felixwang2/p/9190731.html
# https://www.cnblogs.com/felixwang2/p/9190731.html
# TensorFlow(十四):谷歌图像识别网络inception-v3下载与查看结构
import tensorflow as tf
import os
import tarfile
import requests # inception模型下载地址
inception_pretrain_model_url = 'http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz'
# inception_pretrain_model_url = 'http://download.tensorflow.org/models/inception_v4_2016_09_09.tar.gz' # 模型存放地址
inception_pretrain_model_dir = "inception_model"
if not os.path.exists(inception_pretrain_model_dir):
os.makedirs(inception_pretrain_model_dir) # 获取文件名,以及文件路径
filename = inception_pretrain_model_url.split('/')[-1]
filepath = os.path.join(inception_pretrain_model_dir, filename) # 下载模型
if not os.path.exists(filepath):
print("download: ", filename)
r = requests.get(inception_pretrain_model_url, stream=True)
with open(filepath, 'wb') as f:
for chunk in r.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
print("finish: ", filename)
# 解压文件
tarfile.open(filepath, 'r:gz').extractall(inception_pretrain_model_dir) # 模型结构存放文件
log_dir = 'inception_log'
if not os.path.exists(log_dir):
os.makedirs(log_dir) # classify_image_graph_def.pb为google训练好的模型
inception_graph_def_file = os.path.join(inception_pretrain_model_dir, 'classify_image_graph_def.pb')
# inception_graph_def_file = os.path.join(inception_pretrain_model_dir, 'inception_v4.ckpt')
gpu_options = tf.GPUOptions(allow_growth=True)
with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options)) as sess:
# 创建一个图来存放google训练好的模型
with tf.gfile.FastGFile(inception_graph_def_file, 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
tf.import_graph_def(graph_def, name='')
# 保存图的结构
writer = tf.summary.FileWriter(log_dir, sess.graph)
writer.close()


查看网络:
在命令窗口输入:
tensorboard --logdir=D:\documents\pycharm\practice\inception_log
窗口输出:TensorBoard 1.13.1 at http://wangmingze:6006 (Press CTRL+C to quit)
但是我输入这个网址无法访问,宇于是就输入:http://localhost:6006 就进去了。
由于网页截图太小,我就下载图片并上传,这样显示比较清楚。

TensorFlow:谷歌图像识别网络inception-v3下载与查看结构的更多相关文章
- Tensorflow学习(练习)—下载骨骼图像识别网络inception数据集
import tensorflow as tfimport osimport tarfileimport requests #inception模型下载地址inception_pretrain_mod ...
- TensorFlow(十四):谷歌图像识别网络inception-v3下载与查看结构
上代码: import tensorflow as tf import os import tarfile import requests #inception模型下载地址 inception_pre ...
- 源码分析——迁移学习Inception V3网络重训练实现图片分类
1. 前言 近些年来,随着以卷积神经网络(CNN)为代表的深度学习在图像识别领域的突破,越来越多的图像识别算法不断涌现.在去年,我们初步成功尝试了图像识别在测试领域的应用:将网站样式错乱问题.无线领域 ...
- 微调Inception V3网络-对Satellite分类
目录 1. 流程概述 2. 准备数据集 2.1 Satellite数据集介绍 3. Inception V3网络 4. 训练 4.1 基于Keras微调Inception V3网络 4.2 Keras ...
- Inception V3 的 tensorflow 实现
tensorflow 官方给出的实现:models/inception_v3.py at master · tensorflow/models · GitHub 1. 模型结构 首先来看 Incept ...
- 1、VGG16 2、VGG19 3、ResNet50 4、Inception V3 5、Xception介绍——迁移学习
ResNet, AlexNet, VGG, Inception: 理解各种各样的CNN架构 本文翻译自ResNet, AlexNet, VGG, Inception: Understanding va ...
- Windows10 64位下安装TensorFlow谷歌人工智能系统已官方原生支持
Windows10 64位下安装TensorFlow谷歌人工智能系统已官方原生支持 GitHub - tensorflow/tensorflow: Computation using data flo ...
- TensorFlow创建DeepDream网络
TensorFlow创建DeepDream网络 Google 于 2014 年在 ImageNet 大型视觉识别竞赛(ILSVRC)训练了一个神经网络,并于 2015 年 7 月开放源代码. 该网络学 ...
- 深度卷积网络-Inception系列
目录 1. Inception V1 1.1 Inception module 2. Inception V2 3. Inception V3 4. Inception V4, Inception-R ...
随机推荐
- 使用pip install mysqlclient命令安装mysqlclient失败?(基于Python)
我们使用Django.flask等来操作MySQL,实际上底层还是通过Python来操作的.因此我们想要用Django来操作MySQL,首先还是需要安装一个驱动程序.在Python3中,驱动程序有多种 ...
- C语言预处理学习记录
#include<stdio.h> #define LOCAL //无参宏 //条件编译 #ifdef LOCAL int a=1; #else int a=2; #endif #ifnd ...
- [SDOI2012]任务安排 - 斜率优化dp
虽然以前学过斜率优化dp但是忘得和没学过一样了.就当是重新学了. 题意很简单(反人类),利用费用提前的思想,考虑这一次决策对当前以及对未来的贡献,设 \(f_i\) 为做完前 \(i\) 个任务的贡献 ...
- MyEclipse设置不编译js部分
https://jingyan.baidu.com/album/ca41422fe094251eae99ede7.html?picindex=1 步骤: 1)选中当前工程,右键单击properties ...
- java基础(三)之面向对象编程
对象的创建方法 语法: class 类名{ 属性; 方法; } 生成对象的方法 类名 对象名 = new 类名(); Dog dog = new Dog(); 对象的使用方法1.对象.变量;2.对象. ...
- MS SQL Server 2014,sa登录失败问题
1.用Windows身份验证登录 2.服务器属性-安全性 3.进入服务,重启所有SQL服务
- 如何强制文件上传git仓库里
1.首先在本地创建一个文件夹里写入一个txt文件 2.然后复制你仓库的地址 3.平时正常操作都是这样上传不上 4.没关系我们使用强制上传 代码是 git push -f “你的仓库地址” mast ...
- Python_函数进阶
楔子 假如有一个函数,实现返回两个数中的较大值: def my_max(x,y): m = x if x>y else y return mbigger = my_max(10,20)print ...
- 松软科技课堂:jQuery 语法
jQuery 语法 jQuery 语法是为 HTML 元素的选取编制的,可以对元素执行某些操作. 基础语法是:$(selector).action() 美元符号定义 jQuery 选择符(select ...
- Vue - 自定义组件双向绑定
前言 无论在任何的语言或框架中,我们都提倡代码的复用性.对于Vue来说也是如此,相同的代码逻辑会被封装成组件,除了复用之外,更重要的是统一管理提高开发效率.我真就接手过一个项目,多个页面都会用到的列表 ...