'#GraphexecutionerrorinImageClassificationUsingML

Here is my code of image classification project in machine learning, i am not able to understand this error. I have imported all the necessary libraries.

from keras.callbacks import ModelCheckpoint,EarlyStopping
mc=ModelCheckpoint(filepath="./best_model.h5",
                     monitor="val_accuracy",
                     verbose=1,
                     save_best_only= True)
                                                 
es=EarlyStopping(monitor="val_accuracy",
                   min_delta= 0.01,
                   patience=5,
                   verbose=1)
cb=[mc,es]
his = model.fit_generator(train_data,
                          steps_per_epoch= 7,
                          epochs= 26,
                          callbacks= cb)

I get the following error when I try to run it:

Epoch 1/26
---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
<ipython-input-30-d3e718f31696> in <module>()
      2                           steps_per_epoch= 7,
      3                           epochs= 26,
----> 4                           callbacks= cb)

2 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
     53     ctx.ensure_initialized()
     54     tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 55                                         inputs, attrs, num_outputs)
     56   except core._NotOkStatusException as e:
     57     if name is not None:

InvalidArgumentError: Graph execution error:

Detected at node 'gradient_tape/binary_crossentropy/logistic_loss/mul/BroadcastGradientArgs' defined at (most recent call last):
    File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
      "__main__", mod_spec)
    File "/usr/lib/python3.7/runpy.py", line 85, in _run_code

and so on.. it is a very long error



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source