-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
pytorch metrics implementation #430
Conversation
Codecov Report
@@ Coverage Diff @@
## master #430 +/- ##
==========================================
+ Coverage 86.43% 86.46% +0.03%
==========================================
Files 97 97
Lines 4960 4964 +4
Branches 805 806 +1
==========================================
+ Hits 4287 4292 +5
+ Misses 518 517 -1
Partials 155 155
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Fix #408 |
mmseg/core/evaluation/metrics.py
Outdated
gt_seg_maps (list[ndarray]): list of ground truth segmentation | ||
maps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gt_seg_maps (list[ndarray]): list of ground truth segmentation | |
maps. | |
gt_seg_maps (list[ndarray]): list of ground truth segmentation | |
maps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may update the doc string since results
and gt_seg_maps
could be list of str now.
mmseg/core/evaluation/metrics.py
Outdated
num_classes, | ||
ignore_index, | ||
num_classes: int, | ||
ignore_index: int, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may update the docstring since pred_label
and label
could be str now.
mmseg/core/evaluation/metrics.py
Outdated
torch.Tensor: The intersection of prediction and ground truth | ||
histogram on all classes. | ||
torch.Tensor: The union of prediction and ground truth histogram on | ||
all classes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing indent.
tests/test_metrics.py
Outdated
def save_arr(input_arrays: list, title: str, is_image: bool): | ||
filenames = [] | ||
PREFIX = './temp' | ||
SUFFIX = '.png' if is_image else '.npy' | ||
if not os.path.exists(PREFIX): | ||
os.makedirs(PREFIX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may use python tempfile library https://docs.python.org/3/library/tempfile.html
tests/test_metrics.py
Outdated
labels = np.random.randint(0, num_classes, size=pred_size) | ||
labels[:, 2, 5:10] = ignore_index | ||
|
||
temp_dir = tempfile.TemporaryDirectory() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with
statement is preferred. So we won't forget to clean up.
with tempfile.TemporaryDirectory() as temp_dir:
* pytorch metrics impl and test * support list[str] input, delete unused test code and delete numpy version * modify input data type * add docstring and unitest of filename inputs * add indents in docstring and use tempfile lib to create dir * using with statement
No description provided.