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

[Feature] File I/O migration and reconstruction #2319

Merged
merged 5 commits into from
Mar 13, 2023

Conversation

Xiangxu-0103
Copy link
Collaborator

@Xiangxu-0103 Xiangxu-0103 commented Mar 1, 2023

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

The fileio module has been refactored in mmengine in #533.
The modification can be referred from mmdet #9709.

Modification

  • file_client_args has been renamed to backend_args, and HardDiskBackend to LocalBackend

    previous:

    file_client_args = dict(backend='disk')

    now:

    backend_args = dict(backend='local')
  • Usage:

    previous:

    >>> import mmengine.fileio as fileio
    >>> client = fileio.FileClient(backend='petrel')
    >>> client.get('s3:https://path/of/your/file')
    b'hello world'
    
    >>> file_client_args = dict(backend='petrel')
    >>> client = fileio.FileClient.infer_client(file_client_args=file_client_args)
    >>> client.get('s3:https://path/of/your/file')
    b'hello world'
    >>> client = fileio.FileClient.infer_client(uri='s3:https://path/of/your/file')
    >>> client.get('s3:https://path/of/your/file')
    b'hello world'

    now:

    >>> import mmengine.fileio as fileio
    >>> backend = fileio.get_file_backend(backend_args={'backend': 'petrel'})
    >>> backend.get('s3:https://path/of/your/file')
    b'hello world'
    
    >>> fileio.get('s3:https://path/of/your/file', backend_args={'backend': 'petrel'})
    b'hello world'
    >>> fileio.get('s3:https://path/of/your/file')  # set backend_args to None, and let the file I/O module automatically infer from prefix to data root.
    b'hello world'

BC-breaking (Optional)

Does the modification introduce changes that break the back-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@codecov
Copy link

codecov bot commented Mar 1, 2023

Codecov Report

Patch coverage: 32.33% and project coverage change: -0.18 ⚠️

Comparison is base (8cf1acb) 47.04% compared to head (5d55ddf) 46.86%.

❗ Current head 5d55ddf differs from pull request most recent head a884e49. Consider uploading reports for the commit a884e49 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           dev-1.x    #2319      +/-   ##
===========================================
- Coverage    47.04%   46.86%   -0.18%     
===========================================
  Files          262      264       +2     
  Lines        22040    22173     +133     
  Branches      3467     3482      +15     
===========================================
+ Hits         10368    10392      +24     
- Misses       11006    11118     +112     
+ Partials       666      663       -3     
Flag Coverage Δ
unittests 46.86% <32.33%> (-0.18%) ⬇️

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

Impacted Files Coverage Δ
mmdet3d/datasets/scannet_dataset.py 82.75% <ø> (ø)
mmdet3d/datasets/waymo_dataset.py 17.72% <ø> (ø)
...tion/functional/waymo_utils/prediction_to_waymo.py 0.00% <0.00%> (ø)
mmdet3d/evaluation/metrics/waymo_metric.py 8.11% <ø> (ø)
mmdet3d/models/voxel_encoders/voxel_encoder.py 38.28% <ø> (-0.48%) ⬇️
mmdet3d/utils/misc.py 2.12% <0.00%> (-0.20%) ⬇️
mmdet3d/models/losses/lovasz_loss.py 16.81% <16.81%> (ø)
mmdet3d/evaluation/metrics/kitti_metric.py 9.09% <33.33%> (ø)
mmdet3d/models/decode_heads/cylinder3d_head.py 36.84% <36.84%> (ø)
mmdet3d/evaluation/metrics/lyft_metric.py 17.50% <50.00%> (ø)
... and 10 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@JingweiZhang12 JingweiZhang12 left a comment

Choose a reason for hiding this comment

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

Please add a link of the corresponding refactoring in mmengine in PR message.
Please add a PR description about the difference between the usage of backend_args and that of file_client_args if they have.

@ZCMax
Copy link
Collaborator

ZCMax commented Mar 2, 2023

Please check the replace_ceph_backend in train.py / test.py

@Xiangxu-0103
Copy link
Collaborator Author

Please check the replace_ceph_backend in train.py / test.py

Have checked.

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

4 participants