Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mean average precision (mAP) metric #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Mean average precision (mAP) metric #15

wants to merge 2 commits into from

Conversation

jhung0
Copy link
Contributor

@jhung0 jhung0 commented Jun 2, 2017

Resolves #6

@@ -1,2 +1,4 @@
keras-rcnn was written by Allen Goodman. It’s maintained by Allen Goodman and
various contributors:

Jane Hung
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're welcome to add your personal address and Twitter username, e.g.

Jane Hung <[email protected]> @janehung

import tensorflow

def mean_average_precision(y_true, y_pred):
return tensorflow.reduce_mean(tensorflow.metrics.sparse_average_precision_at_k(tensorflow.cast(y_true, tensorflow.int64), y_pred, 1)[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use keras.mean rather than tensorflow.reduce_mean.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to implement a custom average precision function because tensorflow.metrics.sparse_average_precision_at_k expects to be updated in training (i.e. it’s incompatible with Keras’s per-batch metrics), e.g.

keras.backend.mean(keras.backend.cumsum(a) / keras.backend.cumsum(b))

@0x00b1 0x00b1 changed the title mean average precision Mean average precision (mAP) Jun 2, 2017
@0x00b1 0x00b1 changed the title Mean average precision (mAP) Mean average precision (mAP) metric Jun 2, 2017
@rspadim
Copy link

rspadim commented Oct 19, 2017

is it working?

@jhung0
Copy link
Contributor Author

jhung0 commented Oct 20, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants