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

memory efficient test #330

Merged
merged 7 commits into from Jan 10, 2021
Merged

memory efficient test #330

merged 7 commits into from Jan 10, 2021

Conversation

yamengxi
Copy link
Collaborator

@yamengxi yamengxi commented Jan 5, 2021

CPU memory efficient test DeeplabV3+ on Cityscapes (without saving the test results) and evaluate the mIoU.

```shell
python tools/test.py \
configs/deeplabv3plus/deeplabv3plus_r18-d8_512x1024_80k_cityscapes.py \
deeplabv3plus_r18-d8_512x1024_80k_cityscapes_20201226_080942-cff257fe.pth \
--eval-options efficient_test=True \
--eval mIoU
```

Using pmap to view CPU memory footprint, it used 2.25GB CPU memory with efficient_test=True and 11.06GB CPU memory with efficient_test=False . This optional parameter can save a lot of memory.

Comment on lines 71 to 73
temp_file_name = tempfile.NamedTemporaryFile(
suffix='.npy', delete=False).name
np.save(temp_file_name, item)
Copy link
Collaborator

@xvjiarui xvjiarui Jan 9, 2021

Choose a reason for hiding this comment

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

I suggest making this part a function. So that we could have sth like:

results.extend(np2tmp(_) for _ in result)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there a pair of []?

results.extend([np2tmp(_) for _ in result])

Comment on lines +33 to +37
if reduce_zero_label:
# avoid using underflow conversion
label[label == 0] = 255
label = label - 1
label[label == 254] = 255
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could reduce_zero_labels be merged with label_map?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But in custom.py, reduce_zero_label and label_map is two different attributes. If we merge the two different attributes in metrics.py but retain the two different attributes in custom.py, is it something disunity?

@xvjiarui
Copy link
Collaborator

xvjiarui commented Jan 9, 2021

  • Unittest
  • Documentation

@codecov
Copy link

codecov bot commented Jan 10, 2021

Codecov Report

Merging #330 (7a2f83b) into master (9f071ca) will decrease coverage by 0.40%.
The diff coverage is 30.43%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #330      +/-   ##
==========================================
- Coverage   86.47%   86.07%   -0.41%     
==========================================
  Files          95       95              
  Lines        4761     4789      +28     
  Branches      765      778      +13     
==========================================
+ Hits         4117     4122       +5     
- Misses        499      519      +20     
- Partials      145      148       +3     
Flag Coverage Δ
unittests 86.07% <30.43%> (-0.41%) ⬇️

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

Impacted Files Coverage Δ
mmseg/datasets/cityscapes.py 21.34% <0.00%> (-0.50%) ⬇️
mmseg/apis/test.py 22.68% <26.31%> (-1.13%) ⬇️
mmseg/core/evaluation/metrics.py 77.77% <26.66%> (-16.34%) ⬇️
mmseg/datasets/custom.py 88.60% <50.00%> (+1.18%) ⬆️
mmseg/datasets/pipelines/transforms.py 97.12% <0.00%> (+<0.01%) ⬆️

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 9f071ca...7a2f83b. Read the comment docs.

@yamengxi
Copy link
Collaborator Author

CPU memory efficient test DeeplabV3+ on Cityscapes (without saving the test results) and evaluate the mIoU.

```shell
python tools/test.py \
configs/deeplabv3plus/deeplabv3plus_r18-d8_512x1024_80k_cityscapes.py \
deeplabv3plus_r18-d8_512x1024_80k_cityscapes_20201226_080942-cff257fe.pth \
--eval-options efficient_test=True \
--eval mIoU
```

Using pmap to view CPU memory footprint, it used 2.25GB CPU memory with efficient_test=True and 11.06GB CPU memory with efficient_test=False . This optional parameter can save a lot of memory.

@xvjiarui xvjiarui merged commit ce46d70 into open-mmlab:master Jan 10, 2021
bowenroom pushed a commit to bowenroom/mmsegmentation that referenced this pull request Feb 25, 2022
* memory efficient test

* implement efficient test

* merge

* Add document and docstring

* fix unit test

* add memory usage report
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
* add void check

* remove void, add types for params
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.

None yet

2 participants