About tensorflow event()

Asked 1 years ago, Updated 1 years ago, 61 views

While studying CNN's program for images, I'm going to convolution using the model function, but I'm going to use pred to do it.

result=self.pred.eval({self.images:train_data,self.labels:train_label})

I'm running in . I think this eval() passes image data of train_data and train_label to the model function, but the model function only uses self.images for convolution.

The processing here is to complete the training and test the accuracy using the sample image.
train_data is the training data and train_label is creating the correct answer data as a data set using a different function.

def train(self,config):
    train_data, train_label=read_data(data_dir)
    self.train_step=tf.train.GradientDescentOptimizer(config.learning_rate).minimize(self.mse)

    tf.initialize_all_variables().run()
    self.pred=model()


def model(self):
    conv1=tf.nn.relu(tf.nn.conv2d(self.images,self.weights['w1'], strides=[1,1,1,1], padding='VALID')+self.bias['b1'])
    conv2=tf.nn.relu(tf.nn.conv2d(conv1,self.weights['w2'], strides=[1,1,1,1], padding='VALID')+self.bias['b2']))
    conv3 = tf.nn.conv2d(conv2, self.weights['w3'], strides = [1,1,1,1], padding = 'VALID') + self.bases ['b3' ]
    return conv3

python tensorflow

2022-09-30 21:27

1 Answers

Why do you also give train_label?

The evaluation function is a function that measures the accuracy of the model, so it is natural that we have to give the data and the correct level.If you don't give me the answer, I can't tell if the model got the answer.


2022-09-30 21:27

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.