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 ...
随机推荐
- 题解 【Codeforces988E】Divisibility by 25
本题是数论好题! 首先我们需要了解一个关于数论的性质: 一个数只要后两位能被25(或4)整除,这个数就能被25(或4)整除. 同理,后三位:(或8).后四位:(或16)亦是如此. 所以,我们只需要判断 ...
- Ansible:playbook-nagios
一.创建目录结构 cd /etc/ansible/roles/ mkdir nagios/{files,templates,vars,handlers,meta,default,tasks} -pv ...
- Git - 08. git branch
概述 简单描述以下, git branch 讲解的目的, 只是方便新手入门, 基本都是最简单的操作 所以东西可能不全 一是 我不理解 二是 有的东西出现, 可能会让新手产生误解 准备 os win10 ...
- JMeter压力测试,http请求压测,5分钟让你学会如何压测接口!
JMeter压力测试 官网:https://jmeter.apache.org 最新款的jmeter需要java8的支持,所以请自行安装jdk8.这里就不啰嗦了. 可以根据自己的系统下载zip或者是t ...
- 操作系統3-內存管理(Linux內存管理)
操作系統3-內存管理(Linux系統的內存管理方法) 9.Linux系統的內存管理方法 Linux採用"按需調頁"算法,支持三層管理策略.由於Intel CPU在硬件級提供了段式存 ...
- Android 的UI基础布局的学习
一. 今天学习了Android 的UI基础布局的部分,绝大多数的布局都在Androidstudio的这个界面里,如下: 在左边的框里的palette的内部,包含了的大多数的布局所要用的button按钮 ...
- 1059 Prime Factors (25分)
1059 Prime Factors (25分) 1. 题目 2. 思路 先求解出int范围内的所有素数,把输入x分别对素数表中素数取余,判断是否为0,如果为0继续除该素数知道余数不是0,遍历到sqr ...
- [lua]紫猫lua教程-命令宝典-L1-01-10. 自定义函数
L1[function]01. 定义与调用函数 函数的定义 和概念 没什么可说的 lua的函数声明和调用是有先后顺序的 先声明后调用 函数就是变量的一种 所以可以自由的把函数在变量间相互赋值 不过注 ...
- Is It Good To Use LED Wall Light In Household Space?
Wall lamps are mostly used for local lighting, can play a very decorative effect, improve the visual ...
- phpstudy扩展mongoDB
观察如下3个参数,即位数,ts/nts,vc9/vc11/……三条规则(一定要一一对应) 重要是,还要对应PHP的版本,我选的是5.6的对应的版本 去http://windows.php.net/do ...