class10--tensorflow:复现VGGNet实现神经网络特定应用

x = tf.placeholder(tf.float32,shape = [BATCH_SIZE,IMAGE_PIXELS])

np.load  np.save讲数组以二进制的格式读出/写入磁盘,拓展名为.npy

np.save(".npy",某个数组),就是把数组写入某个npy文件

某变量=np.load(".npy",encoding=" ").item()  遍历整个npy文件的键值对

tf.shape(a)返回a的维度  a可以是tensor、list、array

sess.run(tf.shape(x))

tf.nn.bias_add(乘加和,bias)  #把bias加到乘加和上

tf.reshape(tensor,[n,m]/[-1,m])  -1表示行跟随m列自动计算

np.argsort(列表)   #对列表从小到大排序,返回索引值

os.getcwd()  #返回当前工作目录

os.path.join(   ,   )  #拼出整个路径,可引导到特定文件

eg.vgg16_path = os.path.join(os.getcwd(),"vgg16.npy")

tf.split(切谁,怎么切,在哪个维度切)

value.shape [5,30]

split0,split1,split2 = tf.split(value,[4,15,11],1)

tf.shape(split0)   [5,4]

tf.shape(split1)   [5,15]

tf.shape(split2)    [5,11]

tf.concat(值,在哪个维度)

t1 = [[1,2,3],[4,5,6]]

t2 = [[7,8,9],[10,11,12]]

tf.concat([t1,t2],0)   ==> [[1,2,3],[4,5,6],[7,8,9],[10,11,12]]

具体其他很多函数可以查阅https://tensorflow.google.cn/

#画图

fig = plt.figure("图名字")

img = io.imread(图片路径)

ax = fig.add_subplot(数,数,数)  数数数分别是:包含几行,几列,当前是第几个

ax.bar(bar的个数,bar的值,每个bar的名字,bar宽,bar色)  条形统计图

ax.set_ylabel(" ")   y轴名字,u"中文"

ax.set_title(" ") #子图名字

ax.text(文字x坐标,文字y坐标,文字内容,ha='center'(横向),va='bottom'(纵向),fontsize = 7)

ax = imshow(图)

猜你喜欢

转载自blog.csdn.net/jane_6091/article/details/81094050