Skip to content

Conversation

@msokoloff1
Copy link
Contributor

  • Add code for datarow level iou scores

@msokoloff1 msokoloff1 changed the title Ms/mea metrics mea metrics Jun 10, 2021
ious = [iou for iou in ious if iou is not None]
if not ious:
return None
return 100 * np.mean(ious)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure where to put this * 100. I kind of feel like this should just be a float that is bound between 0 and 1. Any thoughts?

Copy link
Contributor Author

@msokoloff1 msokoloff1 Jun 10, 2021

Choose a reason for hiding this comment

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

fyi I reverted this back ( removed the 100 ) but I still want to discuss.

Copy link
Contributor

Choose a reason for hiding this comment

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

I feel better for some reason with values like this as within [0, 1].
But whatever is typical in this domain would also be a good way to decide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think 0 to 1 makes the most sense

@retry.Retry(deadline=10.)
def url_to_numpy(mask_url: str) -> np.ndarray:
""" Downloads an image and converts to a numpy array """
return np.array(Image.open(BytesIO(requests.get(mask_url).content)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these resources closed automatically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup!


def mask_iou(predictions: List[NDMask], labels: List[NDMask]) -> float:
"""
Creates prediction and label binary mask for all features with the same feature scheama id.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this method check for same feature schema id's, or is that something assumed from the input?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not checked here. Technically it could accept any ids. because it is just calculating the iou between any set of masks.

label_content : one row from the bulk label export - `project.export_labels()`
ndjsons: Model predictions in the ndjson format specified here (https://docs.labelbox.com/data-model/en/index-en#annotations)
include_classifications: Whether or not to factor top level classifications into the iou score.
include_subclassifications: Whether or not to factor in subclassifications into the iou score
Copy link
Contributor

Choose a reason for hiding this comment

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

Are include_classifications, include_subclassifications independent, or should there be some validation on their relation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are independent.

@msokoloff1 msokoloff1 requested a review from awu-labelbox June 10, 2021 20:59
prediction, label = predictions[0], labels[0]

if type(prediction) != type(label):
raise Type
Copy link
Contributor

Choose a reason for hiding this comment

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

This works?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope! that is bug haha

Copy link
Contributor

@awu-labelbox awu-labelbox left a comment

Choose a reason for hiding this comment

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

Just one comment, but otherwise lgtm!

@msokoloff1 msokoloff1 merged commit 4bfa6be into mea-dev Jun 11, 2021
@msokoloff1
Copy link
Contributor Author

Please don't delete this branch! There is testing code floating around that relies on it.

@msokoloff1 msokoloff1 deleted the ms/mea-metrics branch July 21, 2021 14:14
msokoloff1 added a commit that referenced this pull request Sep 22, 2021
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