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

Boost segmentation import performance #1261

Merged
merged 5 commits into from
Feb 13, 2024

Conversation

wonjuleee
Copy link
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
Contributor

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
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

if segm_id < 1000:
label_id = segm_id
is_crowd = True
ann_id = None
else:
label_id = segm_id // 1000
is_crowd = False
ann_id = segm_id % 1000
.

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
Contributor

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

if segm_id < 1000:
label_id = segm_id
is_crowd = True
ann_id = None
else:
label_id = segm_id // 1000
is_crowd = False
ann_id = segm_id % 1000

.
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
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

if segm_id < 1000:
label_id = segm_id
is_crowd = True
ann_id = None
else:
label_id = segm_id // 1000
is_crowd = False
ann_id = segm_id % 1000

.
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 :)

Copy link

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
Contributor

@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 openvinotoolkit:develop Feb 13, 2024
5 checks passed
@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