Categories
Mastering Development

Tensorflow with batch size and wrong dimesion

Here are my code: # Model parameters: W and b # tf.reset_default_graph() W = tf.get_variable("weight",shape = [784, 10], dtype=tf.float32) b = tf.get_variable("b", shape=(784,10), dtype= tf.float32) input_X = tf.placeholder(‘float32’, shape = (None,10)) input_y = tf.placeholder(‘float32’, [784, 10]) ogits = W*input_X + b probas = tf.nn.softmax(logits) classes = tf.argmax(probas) loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels = input_y, logits = logits)) […]

Categories
Mastering Development

ValueError: Cannot feed value of shape (1, 50, 50, 3) for Tensor ‘input/X:0’, which has shape ‘(?, 50, 50, 1)’

my model input shape is (50,50,1) I am getting the frame by: cv2.VideoCapture(0).read() When I’m using np.reshape() function it does not reshape it the desired shape. sized_frame = (cv2.resize(frame, (50,50))) cv2.waitKey(0) img_data = np.array(photo) data = tf.reshape(img_data, (1,50,50,3)) model_out = model.predict([img_data])[0] print(model_out) if np.argmax(model_out) == 1: str_label = ‘Dog’ else: str_label = ‘Cat’ return str_label […]

Categories
Development Google

How to do Inference and Transfer Learning with TensorFlow Frozen GraphDef (single saved_model.pb) from Google AutoML Vision Classification

I am using an exported classification model from Google AutoML Vision, hence I only have a saved_model.pb and no variables, checkpoints etc. I want to load this model graph into a local TensorFlow installation, use it for inference and continue training with more pictures. Main questions: Is this plan possible, i.e. to use a single […]

Categories
Development

Cannot feed value of shape (100,) for Tensor ‘Placeholder_1:0’, which has shape ‘(?, 1)’

Tensorflow 1.14 gives me issue “Cannot feed value of shape (100,) for Tensor ‘Placeholder_1:0’, which has shape ‘(?, 1)’” as mentioned in the question. This error occurs in the session segment of the code [last cell of the code]. How do I solve it? Im not able to understand where the bug is lying. The […]

Categories
Development

Another “ValueError: Cannot feed value of shape (30, 5) for Tensor ‘Placeholder:0’, which has shape ‘(?, 30)'”

Be kind, I’m new to TensorFlow. I have found a project that trains a Policy Gradient agent to trade the stock market, trained on only the daily Close prices. And I’m interested in making it train on the Open, High, Low, and Volume features as well, so I’m attempting to add them in to the […]