How to predict input image using trained model in Keras?

前端 未结 5 1391
刺人心
刺人心 2020-12-04 06:40

I\'m only beginning with keras and machine learning in general.

I trained a model to classify images from 2 classes and saved it using model.save(). Her

5条回答
  •  难免孤独
    2020-12-04 07:28

    keras predict_classes (docs) outputs A numpy array of class predictions. Which in your model case, the index of neuron of highest activation from your last(softmax) layer. [[0]] means that your model predicted that your test data is class 0. (usually you will be passing multiple image, and the result will look like [[0], [1], [1], [0]] )

    You must convert your actual label (e.g. 'cancer', 'not cancer') into binary encoding (0 for 'cancer', 1 for 'not cancer') for binary classification. Then you will interpret your sequence output of [[0]] as having class label 'cancer'

提交回复
热议问题