Skip to content

Boost segmentation import performance#1261

Merged
wonjuleee merged 5 commits intoopen-edge-platform:developfrom
wonjuleee:boost_seg_perf
Feb 13, 2024
Merged

Boost segmentation import performance#1261
wonjuleee merged 5 commits intoopen-edge-platform:developfrom
wonjuleee:boost_seg_perf

Conversation

@wonjuleee
Copy link
Copy Markdown
Contributor

@wonjuleee wonjuleee commented Feb 6, 2024

Summary

When analyzing the import performance for cityscapes and kaggle_image_mask, I have checked that the most bottleneck is np.unique for parsing the unique class indices within each mask.
Analysis before PR:
image

Analysis after PR:
image

Instead of parsing unique class indices within a mask, I have changed to use all class indices in a dataset.
As a result, the performance is 5 times faster.

How to test

Checklist

  • I have added unit tests to cover my changes.​
  • I have added integration tests to cover my changes.​
  • I have added the description of my changes into CHANGELOG.​
  • I have updated the documentation accordingly

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below).
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT

@wonjuleee wonjuleee requested review from a team as code owners February 6, 2024 00:33
@wonjuleee wonjuleee requested review from jihyeonyi and removed request for a team February 6, 2024 00:33
@jihyeonyi
Copy link
Copy Markdown

Are you going to fix the unit-test errors? It seems that the errors are not directly related to this PR. Your code change looks good to me.

@wonjuleee
Copy link
Copy Markdown
Contributor Author

Are you going to fix the unit-test errors? It seems that the errors are not directly related to this PR. Your code change looks good to me.

The unit tests are broken because of checking is_crowd logic in https://github.com/openvinotoolkit/datumaro/blob/76fc9416e902ccd4e8bb364ed0d1cc2caef47785/src/datumaro/plugins/data_formats/cityscapes.py#L276-L283.

From my investigation, this is not defined in the official cityscapes document https://www.cityscapes-dataset.com/dataset-overview/#class-definitions, while this is for support CVAT cityscapes format as described in https://opencv.github.io/cvat/docs/manual/advanced/formats/format-cityscapes/.
So, we need to decide whether drop this logic in Datumaro or not.
What do you think @openvinotoolkit/datumaro-maintainers?

@jihyeonyi
Copy link
Copy Markdown

Are you going to fix the unit-test errors? It seems that the errors are not directly related to this PR. Your code change looks good to me.

The unit tests are broken because of checking is_crowd logic in

https://github.com/openvinotoolkit/datumaro/blob/76fc9416e902ccd4e8bb364ed0d1cc2caef47785/src/datumaro/plugins/data_formats/cityscapes.py#L276-L283

.
From my investigation, this is not defined in the official cityscapes document https://www.cityscapes-dataset.com/dataset-overview/#class-definitions, while this is for support CVAT cityscapes format as described in https://opencv.github.io/cvat/docs/manual/advanced/formats/format-cityscapes/. So, we need to decide whether drop this logic in Datumaro or not. What do you think @openvinotoolkit/datumaro-maintainers?

How about marking skip or xfail for this test and investigate this further later?
It is because we could miss something.

@wonjuleee
Copy link
Copy Markdown
Contributor Author

Are you going to fix the unit-test errors? It seems that the errors are not directly related to this PR. Your code change looks good to me.

The unit tests are broken because of checking is_crowd logic in
https://github.com/openvinotoolkit/datumaro/blob/76fc9416e902ccd4e8bb364ed0d1cc2caef47785/src/datumaro/plugins/data_formats/cityscapes.py#L276-L283

.
From my investigation, this is not defined in the official cityscapes document https://www.cityscapes-dataset.com/dataset-overview/#class-definitions, while this is for support CVAT cityscapes format as described in https://opencv.github.io/cvat/docs/manual/advanced/formats/format-cityscapes/. So, we need to decide whether drop this logic in Datumaro or not. What do you think @openvinotoolkit/datumaro-maintainers?

How about marking skip or xfail for this test and investigate this further later? It is because we could miss something.

I have fixed unit tests within cityscapes. Please review again :)

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8fdb120) 80.60% compared to head (3317081) 80.60%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1261   +/-   ##
========================================
  Coverage    80.60%   80.60%           
========================================
  Files          270      270           
  Lines        30347    30350    +3     
  Branches      5904     5906    +2     
========================================
+ Hits         24462    24465    +3     
  Misses        4504     4504           
  Partials      1381     1381           
Flag Coverage Δ
ubuntu-20.04_Python-3.8 80.59% <100.00%> (+<0.01%) ⬆️
windows-2022_Python-3.8 80.57% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown

@jihyeonyi jihyeonyi left a comment

Choose a reason for hiding this comment

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

LGTM

@wonjuleee wonjuleee merged commit 7d3b237 into open-edge-platform:develop Feb 13, 2024
@yunchu yunchu added this to the 2.0.0 milestone Mar 28, 2024
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