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

F2 Score metric for object detection. #393

Closed
innat opened this issue Apr 28, 2022 · 23 comments
Closed

F2 Score metric for object detection. #393

innat opened this issue Apr 28, 2022 · 23 comments

Comments

@innat
Copy link
Contributor

innat commented Apr 28, 2022

The F2-score was used to evaluate the performance in TensorFlow - Help Protect the Great Barrier Reef. It might be a good addition in keras-cv.

@bhack
Copy link
Contributor

bhack commented Apr 28, 2022

https://github.com/tensorflow/addons/blob/master/tensorflow_addons/metrics/f_scores.py

@quantumalaviya
Copy link
Contributor

Wouldn't it be better to just write a general FScore metric and change the beta values?

@LukeWood
Copy link
Contributor

LukeWood commented May 5, 2022

great issue, we can add this. I agree with @quantumalaviya that we can have a general FScore and tune beta; though it may be a valuable issue to also offer a F2Score class that just subclasses FScore and provides a beta of 2.

@bhack
Copy link
Contributor

bhack commented May 5, 2022

F2Score class that just subclasses FScore and provides a beta of 2.

...I think this is like my previous comment as:

class F1Score(FBetaScore):

@markub3327
Copy link

FBetaScore should be accept the sparsely defined labels.

For example:

# check for sparse labels
if tf.rank(y_true) < tf.rank(y_pred):
    y_true = tf.one_hot(y_true, self.num_classes)

@bhack
Copy link
Contributor

bhack commented May 11, 2022

@markub3327 Do you want to port the component and your PR on this repo?

@markub3327
Copy link

@bhack Yes, I can.

@bhack
Copy link
Contributor

bhack commented May 11, 2022

@LukeWood Can you assign this to @markub3327 ?

@markub3327
Copy link

@bhack

tensorflow_addons/metrics/f_scores.py to keras_cv/metrics/f_scores.py and my PR too?

@bhack
Copy link
Contributor

bhack commented May 11, 2022

Yes and if you want also F2 with the related tests.
Note, that you could need or not to adapt/refactor these a bit for this repo standards, we have few metrics integrated at https://github.com/keras-team/keras-cv/tree/master/keras_cv/metrics/coco

@markub3327
Copy link

@bhack Okey, let's do it.

@innat
Copy link
Contributor Author

innat commented May 11, 2022

FBetaScore should be accept the sparsely defined labels.

For example:

# check for sparse labels
if tf.rank(y_true) < tf.rank(y_pred):
    y_true = tf.one_hot(y_true, self.num_classes)

Pleaae note that, in keras, it may require to write two separate classes for sparse and one hot encoded target vector.

@markub3327
Copy link

@innat Or, it can be argument:

sparse=True or sparse=False

@bhack
Copy link
Contributor

bhack commented May 11, 2022

@innat Or, it can be argument:

sparse=True or sparse=False

@markub3327 Check the thread at #371 (comment)

@markub3327
Copy link

markub3327 commented May 11, 2022

@bhack Ok

@pure-rgb
Copy link

Any update on this?
Already asked. keras-team/keras#15811

@tanzhenyu
Copy link
Contributor

I think we should add F1 score to Keras, and keep F2 score to KerasCV?

@tanmaypandey7
Copy link

@tanzhenyu why don't we keep both f1 and f2 scores to keras itself? Won't it be a bit confusing to the user, if he needs to import the f1 metric from keras and f2 from keras-cv?

Also, i would like to work/help on this PR if there is nobody working on it currently.
cc: @markub3327

@innat
Copy link
Contributor Author

innat commented Feb 3, 2023

keras-team/keras#17516

@bhack
Copy link
Contributor

bhack commented Feb 3, 2023

#423

@LukeWood
Copy link
Contributor

LukeWood commented May 4, 2023

closing as this most likely fits in keras core

@LukeWood LukeWood closed this as completed May 4, 2023
@innat
Copy link
Contributor Author

innat commented May 4, 2023

@LukeWood
Could u please move this ticket to keras?

@LukeWood
Copy link
Contributor

LukeWood commented May 4, 2023

@LukeWood Could u please move this ticket to keras?

I do not have Keras ownership O_o. Can we re-open there with a link here?

freedomtan pushed a commit to freedomtan/keras-cv that referenced this issue Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants