I want to compute F1 score in tensorflow. but my model predictions is a tensor array while my dataset is a dataframe. I don't know where I need to compute F1 score during training or predictions.
text_encoder = keras.models.load_model("text_encoder")
Converting caption to tensor
def read_text(caption):
return tf.convert_to_tensor(caption)
Loading whole dataframe with 3851 captions
j = df['findings'].astype(str)
j.shape
(3851,)
Making predictions of the above dataframe using trained text_encoder model.
text_embeddings = text_encoder.predict(
tf.data.Dataset.from_tensor_slices(j)
.map(read_text).batch(batch_size),
verbose=1,
)
print(f"Text embeddings shape: {text_embeddings.shape}.")
1926/1926 [==============================] - 25s 13ms/step
Text embeddings shape: (3851, 128, 256).