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

pytorch metrics implementation #430

Merged
merged 7 commits into from
Mar 29, 2021

Conversation

xiexinch
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Mar 17, 2021

Codecov Report

Merging #430 (87a654f) into master (6acd77e) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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              
Flag Coverage Δ
unittests 86.46% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmseg/core/evaluation/metrics.py 86.56% <100.00%> (+7.20%) ⬆️
mmseg/datasets/pipelines/transforms.py 97.12% <0.00%> (-0.87%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6acd77e...87a654f. Read the comment docs.

@xvjiarui
Copy link
Collaborator

Fix #408

@xvjiarui xvjiarui linked an issue Mar 20, 2021 that may be closed by this pull request
Comment on lines 77 to 78
gt_seg_maps (list[ndarray]): list of ground truth segmentation
maps.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
gt_seg_maps (list[ndarray]): list of ground truth segmentation
maps.
gt_seg_maps (list[ndarray]): list of ground truth segmentation
maps.

Copy link
Collaborator

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.

num_classes,
ignore_index,
num_classes: int,
ignore_index: int,
Copy link
Collaborator

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.

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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing indent.

Comment on lines 174 to 179
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)
Copy link
Collaborator

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

labels = np.random.randint(0, num_classes, size=pred_size)
labels[:, 2, 5:10] = ignore_index

temp_dir = tempfile.TemporaryDirectory()
Copy link
Collaborator

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:

@xvjiarui xvjiarui merged commit e86a87f into open-mmlab:master Mar 29, 2021
bowenroom pushed a commit to bowenroom/mmsegmentation that referenced this pull request Feb 25, 2022
* 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
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
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.

Speed of mIoU calculate
2 participants