JasonZhang156 / Sound-Recognition-Tutorial

A simple sound recognition tutorial, including data analysis, feature extraction, model building, model train and model test ...
Apache License 2.0
88 stars 25 forks source link

评测函数有问题 #1

Closed MichelleYang2017 closed 1 year ago

MichelleYang2017 commented 4 years ago

keras里面的评测的ACC本质上计算是这样的:label:[[0,1,0,0],[0,0,0,1]],pred:[[0,0,0,0],[0,0,0,1]]准确率不是50%,而是87.5%

JasonZhang156 commented 4 years ago

keras使用‘accuracy’作为metrics时,默认调用的是metrics.py里的categorical_accuracy函数,如下 def categorical_accuracy(y_true, y_pred): '''Calculates the mean accuracy rate across all predictions for multiclass classification problems. ''' return K.mean(K.equal(K.argmax(y_true, axis=-1), K.argmax(y_pred, axis=-1)))

我认为计算方法是没有问题。

MichelleYang2017 commented 4 years ago

eras使用‘accuracy’作为metrics时,默认调用的是metrics.py里的accuracy(y_true, y_pred)函数吧,当指定为metrics.categorical_accuracy才用的是categorical_accuracy函数吧

JasonZhang156 commented 4 years ago

默认调用categorical_accuracy,可以参考training.py

MichelleYang2017 commented 4 years ago

ok,感谢

z小白 notifications@github.com 于2019年12月5日周四 下午6:23写道:

默认调用categorical_accuracy,可以参考training.py https://github.com/fchollet/keras/blob/d8b226f26b35348d934edb1213061993e7e5a1fa/keras/engine/training.py#L651

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JasonZhang156/Sound-Recognition-Tutorial/issues/1?email_source=notifications&email_token=AHXR3ZAJVEQKRBBOIHQ6UZ3QXDJDJA5CNFSM4JI4RYGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGAHLRI#issuecomment-562066885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHXR3ZBNH5DO45KVJAP2ULDQXDJDJANCNFSM4JI4RYGA .