とらりもんHOME  Index  Search  Changes  Login

keras

classification

Here, "x" is the input data tensor (np.ndarray) "model" is an instance of classifier, such as keras.models.Sequential.

  • If you want the final class label only:
class = model.predict_class(x)
# The result "class" is a np.ndarray instance containing class label
  • If you want probability (softmax) of all the candidate classes:
class_prob = model.predict(x)
# The result "class_preob" is a np.ndarray instance containing probability of each class

* keras.json for tensorflow

{
   "image_data_format": "channels_last",
   "epsilon": 1e-07,
   "floatx": "float32",
   "backend": "tensorflow"
}
Last modified:2020/02/28 08:47:54
Keyword(s):
References: