-
大小: 57.89MB文件類型: .rar金幣: 1下載: 0 次發(fā)布日期: 2022-12-06
- 語(yǔ)言: 其他
- 標(biāo)簽: tensorflow??inception??TFRecord??
資源簡(jiǎn)介
該文件包含有一個(gè)inceptionv3的網(wǎng)絡(luò),以及制作和讀取TFRecord格式的數(shù)據(jù)集的方法。
代碼片段和文件信息
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“):
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????153??2018-05-26?10:40??tensorflow-tfrecord\.idea\codest
?????文件????????198??2018-05-26?10:40??tensorflow-tfrecord\.idea\codest
?????文件?????????86??2018-03-18?15:56??tensorflow-tfrecord\.idea\dictionaries\zhang.xm
?????文件????????492??2018-05-26?10:41??tensorflow-tfrecord\.idea\google_net.iml
?????文件????????185??2018-05-26?10:41??tensorflow-tfrecord\.idea\misc.xm
?????文件????????272??2018-03-18?15:53??tensorflow-tfrecord\.idea\modules.xm
?????文件??????36283??2018-05-28?20:46??tensorflow-tfrecord\.idea\workspace.xm
?????文件??????19502??2018-05-28?19:38??tensorflow-tfrecord\demo.py
?????文件??????29869??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0241.jpg
?????文件??????37834??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0242.jpg
?????文件??????39620??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0243.jpg
?????文件??????27486??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0244.jpg
?????文件??????51546??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0245.jpg
?????文件??????51051??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0246.jpg
?????文件??????27496??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0247.jpg
?????文件??????29280??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0248.jpg
?????文件??????31243??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0249.jpg
?????文件??????25481??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0250.jpg
?????文件??????30929??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0251.jpg
?????文件??????58349??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0252.jpg
?????文件??????49208??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0253.jpg
?????文件??????26639??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0254.jpg
?????文件??????38494??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0255.jpg
?????文件??????31550??2006-05-05?07:03??tensorflow-tfrecord\jpg\bluebell\image_0256.jpg
?????文件??????30950??2006-05-05?07:04??tensorflow-tfrecord\jpg\bluebell\image_0257.jpg
?????文件??????50187??2006-05-05?07:04??tensorflow-tfrecord\jpg\bluebell\image_0258.jpg
?????文件??????30159??2006-05-05?07:04??tensorflow-tfrecord\jpg\bluebell\image_0259.jpg
?????文件??????41462??2006-05-05?07:04??tensorflow-tfrecord\jpg\bluebell\image_0260.jpg
?????文件??????43310??2006-05-05?07:04??tensorflow-tfrecord\jpg\bluebell\image_0261.jpg
?????文件??????35088??2006-05-05?07:04??tensorflow-tfrecord\jpg\bluebell\image_0262.jpg
............此處省略1366個(gè)文件信息
評(píng)論
共有 條評(píng)論