ultrasound-nerve-segmentation
ultrasound-nerve-segmentation copied to clipboard
How to print out f1 score?
Hello @jocicmarko ,
Excellent code. I'm trying to reimplement your code.
I notice that in the method of model compile, you set loss function to dice_coef_loss and the metrics is dice_coef.
model.compile(optimizer=Adam(lr=1e-5), loss=dice_coef_loss, metrics=[dice_coef])
If I want to print out both dice coefficient and f1 score, how do I achieve that? Here I define the f1 score function as follow:
def f1score(y_true, y_pred):
return f1_score(y_true, y_pred, average=None)
Hope you will give me some advices. Looking forward to your reply. Sincerely,
Metric has to be defined with Keras tensors and ops, which means you have to implement it yourself. Also, another solution is a bit hacky, but you can make a Keras custom callback function which will output results of the validation/test set and calculate all the metrics you need with basic numpy/scikit-learn.
hi, iam taking some of the training data as a test data. How can i calculate accuracy of the testdata. please any one can you help me.