Home > database >  Tensorflow ValueError: Unexpected result of `train_function` (Empty logs). Please use `Model.compile
Tensorflow ValueError: Unexpected result of `train_function` (Empty logs). Please use `Model.compile

Time:01-24

I'm trying to make a face detection model with CNN. I used codes that I made for number detection. When I use number images, program work. But, when I use my face images, I get an error that is:

Unexpected result of train_function (Empty logs). Please use Model.compile(..., run_eagerly=True), or tf.config.run_functions_eagerly(True) for more information of where went wrong, or file a issue/bug to tf.keras.

Notebook link: a number image

Face image:a face image

CodePudding user response:

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" ))
  •  Tags:  
  • Related