-
Notifications
You must be signed in to change notification settings - Fork 136
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
[Fix] Fix potential circular import in core, data and utils, disconnect unnecessary pytorch3d dependency #190
Conversation
Codecov Report
@@ Coverage Diff @@
## main #190 +/- ##
==========================================
- Coverage 85.24% 85.05% -0.20%
==========================================
Files 170 173 +3
Lines 14832 14826 -6
==========================================
- Hits 12644 12610 -34
- Misses 2188 2216 +28
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Import time compare:
|
Import failure compare if pytorch3d is not installed S: success, F: failure, W: success with a warning.
|
Is this file meant to be included in the main branch? |
docs/visualize_smpl.md
Outdated
@@ -29,7 +29,7 @@ | |||
If you want to visualize a T-pose smpl or your poses do not have global_orient, you can do: | |||
```python | |||
import torch | |||
from mmhuman3d.core.visualization import visualize_T_pose | |||
from mmhuman3d.core.visualization. import visualize_T_pose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here should be from mmhuman3d.core.visualization.visualize_smpl import visualize_T_pose
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 2dd48b7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me, no more comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
…ct unnecessary pytorch3d dependency (open-mmlab#190) - Move mmhuman3d.core.visualization.renderer to mmhuman3d.core.renderer - Split mmhuman3d.core.renderer.torch3d_renderer.builder into several seperated builders. - Make __init__.py in mmhuman3d.core.renderer, mmhuman3d.data, mmhuman3d.utils empty. - Allow pytorch3d import failure in mmhuman3d.utils.transforms, because the transforms.py is widely imported by many modules that do not need pytorch3d at all (transforms.py is introduced by demo_utils.py). - Fix failed tests caused by the changes above. - Accept mmcv 1.5.2. Co-authored-by: gaoyang3 <gaoyang3@sensetime.com>
mmhuman3d.core.visualization.renderer
tommhuman3d.core.renderer
mmhuman3d.core.renderer.torch3d_renderer.builder
into several seperated builders.__init__.py
in mmhuman3d.core.renderer, mmhuman3d.data, mmhuman3d.utils empty.Below are some cases indicates what is different in this PR.
case 1. When we are trying to import
visualize_kp2d
before this PR:
All the torch3d renderers, lights and shaders, vedo_renderer are imported because of
__init__.py
.If pytorch3d has not been installed(e.g. OS or hardware not supported), program exits because of the module we never use.
after this PR:
Only the modules related to visualize_kp2d are imported.
If pytorch3d has not been installed, the program casts a warning message of import error and call stack, goes on, allows you to visualize kp2d.
case 2. When we are trying to import
ParametricMeshes
before this PR:
All the torch3d renderers, lights and shaders, matplotlib_renderer, vedo_renderer are imported because of
__init__.py
.after this PR:
Only the
ParametricMeshes
is imported, with a price of longer import sentence.case 3. When we are trying to import
build_renderer
before this PR:
from mmhuman3d.core.visualization.renderer import build_renderer
.after this PR:
from mmhuman3d.core.renderer.torch3d_renderer.builder import build_renderer
. A little bit longer.case 4. When we are trying to import
MeshRenderer, PointCloudRenderer
before this PR:
from mmhuman3d.core.visualization.renderer import MeshRenderer, PointCloudRenderer
.after this PR:
from mmhuman3d.core.renderer.torch3d_renderer.builder import MeshRenderer, PointCloudRenderer
. Classes in same registry can be accessed in builder, one line import.case 5. When we are trying to import
HumanData
before this PR:
If pytorch3d has not been installed, program exits because that it is imported by SMCReader.
after this PR:
If pytorch3d has not been installed, nothing happens. You can use the module as you wish.