title: How to get precision and recall, for a keras model?
body: <p>i want to see precision and recall for my model for a binary image classification but i can find how do to that</p>
  <p>Here is my code</p>
  <pre><code>
  x = base_model.output
  
  x = tf.keras.layers.GlobalAveragePooling2D()(x)
  
  x = tf.keras.layers.Dense(1024, activation='relu')(x) 
  x = tf.keras.layers.Dense(1024, activation='relu')(x)
  x = tf.keras.layers.Dense(512, activation='relu')(x)
  preds = tf.keras.layers.Dense(2, activation='softmax')(x)
  
  model = tf.keras.Model(inputs = base_model.input, outputs = preds)
  
  for layer in model.layers[:175]:
    layer.trainable = False 
  
  for layer in model.layers[175:]:
    layer.trainable = True  
  
  model.compile(optimizer='Adam', loss='categorical_crossentropy', metrics=['accuracy'])
  
  history = model.fit_generator(generator=train_generator,
                                epochs=20,
                                steps_per_epoch=step_size_train,
                                validation_data = test_generator,
                                validation_steps=step_size_test)```
  </code></pre>