4 thoughts on “Build an Android app for custom object image classification using TensorFlow & Keras

  1. Can you make a video for this tutorial?i new with machine learning and i want to make an application for classification using mobilenetv2
    I run your google colab and got error in step 9

  2. /usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/training.py:1940: UserWarning: `Model.fit_generator` is deprecated and will be removed in a future version. Please use `Model.fit`, which supports generators.
    warnings.warn(‘`Model.fit_generator` is deprecated and ‘
    Epoch 1/11
    InvalidArgumentError Traceback (most recent call last)
    in ()
    7 history = model.fit_generator(train_gen, validation_data=val_gen, epochs=11,
    8 steps_per_epoch=steps_per_epoch,
    —-> 9 callbacks = [batch_stats_callback, tensorboard])

    7 frames
    /usr/local/lib/python3.7/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
    58 ctx.ensure_initialized()
    59 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
    —> 60 inputs, attrs, num_outputs)
    61 except core._NotOkStatusException as e:
    62 if name is not None:

    InvalidArgumentError: logits and labels must be broadcastable: logits_size=[32,2] labels_size=[32,7]
    [[node categorical_crossentropy/softmax_cross_entropy_with_logits (defined at :9) ]] [Op:__inference_train_function_35584]

    Function call stack:

    I got this error from step 9, can you tell me why?

    1. my tutorial is for 2 classes only. u r probably training for 7 classes. if that is the case change this in step 7 line 3.

      layers.Dense(2, activation=’softmax’) —> layers.Dense(7, activation=’softmax’)

      I have to make a few adjustments in this article. will also make a video for this soon.

Leave a Reply