merge
This commit is contained in:
commit
4b11d0c3e6
@ -53,6 +53,22 @@ def FCN():
|
||||
|
||||
return model
|
||||
|
||||
def precision(y_true, y_pred):
|
||||
y_pred = np.round(y_pred)
|
||||
num = np.sum(np.logical_and(y_true, y_pred))
|
||||
den = np.sum(y_pred)
|
||||
return np.divide(num, den)
|
||||
|
||||
def recall(y_true, y_pred):
|
||||
y_pred = np.round(y_pred)
|
||||
num = np.sum(np.logical_and(y_true, y_pred))
|
||||
den = np.sum(y_true)
|
||||
return np.divide(num, den)
|
||||
|
||||
def f_measure(y_true, y_pred):
|
||||
p = precision(y_true, y_pred)
|
||||
r = recall(y_true, y_pred)
|
||||
return 2 * p * r / (p + r)
|
||||
|
||||
## Open data
|
||||
im_train = np.load('Waldo_train_data.npy')
|
||||
@ -131,4 +147,3 @@ accuracy = accuracy_score(lbl_test, pred_lbl)
|
||||
print("Accuracy: " + str(accuracy))
|
||||
print("Images generated in {} seconds".format(end - start))
|
||||
np.save('predicted_results.npy', pred_lbl)
|
||||
|
||||
|
Reference in New Issue
Block a user