tensorflow数据集制作以及使用Inceptionv3进行训练
该文件包含有一个inceptionv3的网络,以及制作和读取TFRecord格式的数据集的方法。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 153 2018-05-26 10:40 tensorflow-tfrecord.ideacodestylescodestyleConfig.xml
文件 198 2018-05-26 10:40 tensorflow-tfrecord.ideacodestylesProject.xml
文件 86 2018-03-18 15:56 tensorflow-tfrecord.ideadictionarieszhang.xml
文件 492 2018-05-26 10:41 tensorflow-tfrecord.ideagoogle_net.iml
文件 185 2018-05-26 10:41 tensorflow-tfrecord.ideamisc.xml
文件 272 2018-03-18 15:53 tensorflow-tfrecord.ideamodules.xml
文件 36283 2018-05-28 20:46 tensorflow-tfrecord.ideaworkspace.xml
文件 19502 2018-05-28 19:38 tensorflow-tfrecorddemo.py
文件 29869 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0241.jpg
文件 37834 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0242.jpg
文件 39620 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0243.jpg
文件 27486 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0244.jpg
文件 51546 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0245.jpg
文件 51051 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0246.jpg
文件 27496 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0247.jpg
文件 29280 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0248.jpg
文件 31243 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0249.jpg
文件 25481 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0250.jpg
文件 30929 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0251.jpg
文件 58349 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0252.jpg
文件 49208 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0253.jpg
文件 26639 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0254.jpg
文件 38494 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0255.jpg
文件 31550 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0256.jpg
文件 30950 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0257.jpg
文件 50187 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0258.jpg
文件 30159 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0259.jpg
文件 41462 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0260.jpg
文件 43310 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0261.jpg
文件 35088 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0262.jpg
............此处省略1366个文件信息
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import math
def _variable(name shape):
“““Helper to create a Variable stored on CPU memory.
Args:
name: name of the variable
shape: list of ints
Returns:
Variable Tensor
“““
with tf.device(‘/gpu:0‘):
var = tf.get_variable(name shape)
return var
def batch_norm(x_tensorname=None):
meanvariance=tf.nn.moments(x_tensoraxes = [0])
L=tf.nn.batch_normalization(x_tensormeanvariance0.0110.001name = name)
return L
def conv_layer(inputshapestrideactivation=Truepadding=‘VALID‘name=None):
in_channel=shape[2]
out_channel=shape[3]
k_size=shape[0]
with tf.variable_scope(name) as scope:
kernel=_variable(‘conv_weights‘shape = shape)
conv=tf.nn.conv2d(input = inputfilter = kernelstrides = stridepadding =padding)
biases=_variable(‘biases‘[out_channel])
bias=tf.nn.bias_add(convbiases)
bias = batch_norm(bias ‘bn‘)
if activation is True:
conv_out=tf.nn.relu(biasname = ‘relu‘)
else:
conv_out=bias
return conv_out
def conv_inception(input shape stride= [1111] activation = True padding = ‘SAME‘ name = None):
in_channel = shape[2]
out_channel = shape[3]
k_size = shape[0]
with tf.variable_scope(name) as scope:
kernel = _variable(‘conv_weights‘ shape = shape)
conv = tf.nn.conv2d(input = input filter = kernel strides = stride padding = padding)
biases = _variable(‘biases‘ [out_channel])
bias = tf.nn.bias_add(conv biases)
if activation is True:
conv_out = tf.nn.relu(bias name = ‘relu‘)
else:
conv_out = bias
return conv_out
def inception_block_tradition(input name=None):
with tf.variable_scope(name) as scope:
with tf.variable_scope(“Branch_0“):
branch_0=conv_inception(inputshape = [1128864]name = ‘0a_1x1‘)
with tf.variable_scope(‘Branch_1‘):
branch_1=conv_inception(inputshape = [1128848]name = ‘0a_1x1‘)
branch_1=conv_inception(branch_1shape = [554864]name = ‘0b_5x5‘)
with tf.variable_scope(“Branch_2“):
branch_2=conv_inception(inputshape = [1128864]name = ‘0a_1x1‘)
branch_2=conv_inception(branch_2shape = [336496]name = ‘0b_3x3‘)
with tf.variable_scope(‘Branch_3‘):
branch_3=tf.nn.avg_pool(inputksize = (1331)strides = [1111]padding = ‘SAME‘name = ‘Avgpool_0a_3x3‘)
branch_3=conv_inception(branch_3shape = [1128864]name = ‘0b_1x1‘)
inception_out=tf.concat([branch_0branch_1branch_2branch_3]3)
b=1 # for debug
return inception_out
def inception_grid_reduction_1(inputname=None):
with tf.variable_scope(name) as scope:
with tf.variable_scope(“Branch_0“):
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 153 2018-05-26 10:40 tensorflow-tfrecord.ideacodest
文件 198 2018-05-26 10:40 tensorflow-tfrecord.ideacodest
文件 86 2018-03-18 15:56 tensorflow-tfrecord.ideadictionarieszhang.xm
文件 492 2018-05-26 10:41 tensorflow-tfrecord.ideagoogle_net.iml
文件 185 2018-05-26 10:41 tensorflow-tfrecord.ideamisc.xm
文件 272 2018-03-18 15:53 tensorflow-tfrecord.ideamodules.xm
文件 36283 2018-05-28 20:46 tensorflow-tfrecord.ideaworkspace.xm
文件 19502 2018-05-28 19:38 tensorflow-tfrecorddemo.py
文件 29869 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0241.jpg
文件 37834 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0242.jpg
文件 39620 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0243.jpg
文件 27486 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0244.jpg
文件 51546 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0245.jpg
文件 51051 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0246.jpg
文件 27496 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0247.jpg
文件 29280 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0248.jpg
文件 31243 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0249.jpg
文件 25481 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0250.jpg
文件 30929 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0251.jpg
文件 58349 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0252.jpg
文件 49208 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0253.jpg
文件 26639 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0254.jpg
文件 38494 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0255.jpg
文件 31550 2006-05-05 07:03 tensorflow-tfrecordjpgluebellimage_0256.jpg
文件 30950 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0257.jpg
文件 50187 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0258.jpg
文件 30159 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0259.jpg
文件 41462 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0260.jpg
文件 43310 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0261.jpg
文件 35088 2006-05-05 07:04 tensorflow-tfrecordjpgluebellimage_0262.jpg
............此处省略1366个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)