共 40 篇文章
显示摘要每页显示  条
img = tf.decode_raw(features[''''''''image''''''''], tf.uint8)img = tf.reshape(img, [300, 300,3])#notice shape应该保持一致。TFRecordReader() _, serialized_example = reader.read(filename_queue) #返回文件名和文件 features = tf.parse_single_example(serialize...
path = "/home/mj/cats_vs_dogs/data/expermient"filenames=os.listdir(path)writer = tf.python_io.for name in os.listdir(path): class_path = path + os.sep + name for img_name in os.listdir(class_path): img_path = class_path+os.sep+img_name img = Image.open(img_path) img = img.resize((500,500)) img_raw = img.toby...
import cv2import osdef rebuild(dir): for root,dirs,files in os.walk(dir): for file in files: filepath=os.path.join(root,file) try: image=cv2.imread(filepath) dim=(227,227) resized=cv2.resize(image,dim) path="/home/mj/kaggle/retrain1/"+file cv2.imwrite(path,resized) except: print(filepath) os.remove(filepath)
TensorFlow 第八课 使用inception-v3.
x=tf.placeholder(tf.float32,[None,784])y=tf.placeholder(tf.float32,[None,10])Variable(tf.zeros(10))prediction=tf.nn.softmax(tf.matmul(x,w)+b)loss=tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(labels=y,logits=prediction))correct_prediction=tf.equal(tf.argmax(y,1),tf.argmax(prediction,1))accu=tf.reduce_mean(...
x=tf.placeholder(tf.float32,[None,784])y=tf.placeholder(tf.float32,[None,10])Variable(tf.zeros(10))prediction=tf.nn.softmax(tf.matmul(x,w)+b)loss=tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(labels=y,logits=prediction))correct_prediction=tf.equal(tf.argmax(y,1),tf.argmax(prediction,1))accu=tf.reduce_mean(...
<ipython-input-8-a4f3de4a35a8> in RNN(X, weights, biases) 38 inputs = tf.reshape(X,[-1,max_time,n_inputs]) 39 #定义LSTM基本CELL---> 40 lstm_cell = tf.contrib.rnn.core_rnn_cell.BasicLSTMCell(lstm_size) 41 #lstm_cell = rnn.BasicLSTMCell(lstm_size) 42 # final_state[0]是cell stateAttributeError: module ''...
import tensorflow as tffrom tensorflow.contrib import rnnfrom tensorflow.examples.tutorials.mnist import input_data#载入数据mnist = input_data.read_data_sets("/home/mj/MINIST_data", one_hot=True)#输入图片是28*28n_inputs=28#max_time=28lstm_size=100n_classes=10batch_size=50n_batch=mnist.train.num_examplesx=tf....
模型与训练的模型要相同,包括nameimport tensorflow as tfimport numpy as np##saive to filew=tf.Variable(np.arange(6).reshape((2,3)),dtype=tf.float32,name=''''''''weights'''''''')b=tf.Variable(np.arange(3).reshape((1,3)),dtype=tf.float32,name='''...
帮助 | 留言交流 | 联系我们 | 服务条款 | 下载网文摘手 | 下载手机客户端
北京六智信息技术股份有限公司 Copyright© 2005-2024 360doc.com , All Rights Reserved
京ICP证090625号 京ICP备05038915号 京网文[2016]6433-853号 京公网安备11010502030377号
返回
顶部