Model Making Error

Using model maker with roughly ~2000 images. Appears to be throwing a softmax_cross_entropy_with_logits error.

Unable to figure out what is going wrong

model.fit_generator(train_batch, validation_data=valid_batch,epochs=15,steps_per_epoch=SPE ,validation_steps=VS)

InvalidArgumentError                      Traceback (most recent call last)
<ipython-input-57-9acc62d69173> in <module>()
----> 1 model.fit_generator(train_batch, validation_data=valid_batch,epochs=15,steps_per_epoch=SPE ,validation_steps=VS)

2 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/eager/ 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 'categorical_crossentropy/softmax_cross_entropy_with_logits' defined at (most recent call last):
    File "/usr/lib/python3.7/", line 193, in _run_module_as_main
      "__main__", mod_spec)
    File "/usr/lib/python3.7/", line 85, in _run_code
      exec(code, run_globals)
    File "/usr/local/lib/python3.7/dist-packages/", line 16, in <module>
    File "/usr/local/lib/python3.7/dist-packages/traitlets/config/", line 846, in launch_instance

Any help is always greatly appreciated.


facing the same issue. did you solved it?

Check if the number of units in your output layer are the same as in your labels. For instance, if your labels are 3, the units must be 3.


Thanks for your comment :3

Thanks man, you made my day!!!