Tensorflow ValueError: Unexpected result of `train_function` (Empty logs). Please use `Model.compile(…, run_eagerly=True)

We Are Going To Discuss About Tensorflow ValueError: Unexpected result of `train_function` (Empty logs). Please use `Model.compile(…, run_eagerly=True). So lets Start this Python Article.

Tensorflow ValueError: Unexpected result of `train_function` (Empty logs). Please use `Model.compile(…, run_eagerly=True)

  1. How to solve Tensorflow ValueError: Unexpected result of `train_function` (Empty logs). Please use `Model.compile(…, run_eagerly=True)

    Your input images have a shape of (32,32,3) whil you first conv2D layer sets the inputshape to (32,32,1). Most likely your numbers have only 1 channel since they are grayscale, while you face images have 3 color channels.
    change:
    model.add(tf.keras.layers.Conv2D(input_shape = (32,32,1), filters = 8, kernel_size = (5,5),activation = "relu", padding = "same" ))
    to
    model.add(tf.keras.layers.Conv2D(input_shape = (32,32,3), filters = 8, kernel_size = (5,5),activation = "relu", padding = "same" ))

  2. Tensorflow ValueError: Unexpected result of `train_function` (Empty logs). Please use `Model.compile(…, run_eagerly=True)

    Your input images have a shape of (32,32,3) whil you first conv2D layer sets the inputshape to (32,32,1). Most likely your numbers have only 1 channel since they are grayscale, while you face images have 3 color channels.
    change:
    model.add(tf.keras.layers.Conv2D(input_shape = (32,32,1), filters = 8, kernel_size = (5,5),activation = "relu", padding = "same" ))
    to
    model.add(tf.keras.layers.Conv2D(input_shape = (32,32,3), filters = 8, kernel_size = (5,5),activation = "relu", padding = "same" ))

Solution 1

Your input images have a shape of (32,32,3) whil you first conv2D layer sets the inputshape to (32,32,1). Most likely your numbers have only 1 channel since they are grayscale, while you face images have 3 color channels.

change:

model.add(tf.keras.layers.Conv2D(input_shape = (32,32,1), filters = 8, kernel_size = (5,5),activation = "relu", padding = "same" ))

to

model.add(tf.keras.layers.Conv2D(input_shape = (32,32,3), filters = 8, kernel_size = (5,5),activation = "relu", padding = "same" ))

Original Author Sascha Kirch Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment