-
Notifications
You must be signed in to change notification settings - Fork 2
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
Backbones #14
Open
humanpose1
wants to merge
27
commits into
master
Choose a base branch
from
backbones
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,883
−75
Open
Backbones #14
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
d459cd9
add code for pointnet++ and kpconv
humanpose1 1597c9d
KPConv internal modules
humanpose1 f15c417
pointnet++
humanpose1 1708bf1
add collate function
humanpose1 1ee6dd6
add data file
humanpose1 6e46522
add data file
humanpose1 f121bfc
add test
humanpose1 c1810ec
solve test
humanpose1 307b841
add test for batches
humanpose1 ac65ddb
start writing tests
humanpose1 11454fa
add utils convolutionformat
humanpose1 c8f700e
add test hydra run with a script runner
humanpose1 83f6b46
as in lightning transformer there is fixture
humanpose1 e9be4f8
move test
humanpose1 6c12148
test datasets
humanpose1 239e20e
debug tests
humanpose1 23eaa33
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2bec877
test kpconv
humanpose1 b95366b
add the conf files and the tests of the api
humanpose1 d169f31
tests pass for kpconv
humanpose1 c09890b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] a30c9bc
remove collate_fn
humanpose1 9fd7e00
remove useless class in config
humanpose1 16b4db5
add custom non linearity for minkowski and torchsparse
humanpose1 edba40c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] c4bda7b
change the modules for sparseConv3d
humanpose1 44a12d8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ model: | |
backbone: | ||
input_nc: ${dataset.cfg.feature_dimension} | ||
architecture: unet | ||
conv_type: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# @package model | ||
defaults: | ||
- /model/segmentation/default | ||
|
||
model: | ||
conv_type: "PARTIAL_DENSE" | ||
backbone: | ||
_target_: torch_points3d.applications.kpconv.KPConv | ||
config: | ||
define_constants: | ||
in_grid_size: 0.02 | ||
in_feat: 64 | ||
bn_momentum: 0.2 | ||
max_neighbors: 25 | ||
down_conv: | ||
down_conv_nn: | ||
[ | ||
[[FEAT + 1, in_feat], [in_feat, 2*in_feat]], | ||
[[2*in_feat, 2*in_feat], [2*in_feat, 4*in_feat]], | ||
[[4*in_feat, 4*in_feat], [4*in_feat, 8*in_feat]], | ||
[[8*in_feat, 8*in_feat], [8*in_feat, 16*in_feat]], | ||
[[16*in_feat, 16*in_feat], [16*in_feat, 32*in_feat]], | ||
] | ||
grid_size: | ||
[ | ||
[in_grid_size, in_grid_size], | ||
[2*in_grid_size, 2*in_grid_size], | ||
[4*in_grid_size, 4*in_grid_size], | ||
[8*in_grid_size, 8*in_grid_size], | ||
[16*in_grid_size, 16*in_grid_size], | ||
] | ||
prev_grid_size: | ||
[ | ||
[in_grid_size, in_grid_size], | ||
[in_grid_size, 2*in_grid_size], | ||
[2*in_grid_size, 4*in_grid_size], | ||
[4*in_grid_size, 8*in_grid_size], | ||
[8*in_grid_size, 16*in_grid_size], | ||
] | ||
block_names: | ||
[ | ||
["SimpleBlock", "ResnetBBlock"], | ||
["ResnetBBlock", "ResnetBBlock"], | ||
["ResnetBBlock", "ResnetBBlock"], | ||
["ResnetBBlock", "ResnetBBlock"], | ||
["ResnetBBlock", "ResnetBBlock"], | ||
] | ||
has_bottleneck: | ||
[ | ||
[False, True], | ||
[True, True], | ||
[True, True], | ||
[True, True], | ||
[True, True], | ||
] | ||
deformable: | ||
[ | ||
[False, False], | ||
[False, False], | ||
[False, False], | ||
[False, False], | ||
[False, False], | ||
] | ||
max_num_neighbors: | ||
[[max_neighbors,max_neighbors], [max_neighbors, max_neighbors], [max_neighbors, max_neighbors], [max_neighbors, max_neighbors], [max_neighbors, max_neighbors]] | ||
module_name: KPDualBlock | ||
up_conv: | ||
module_name: FPModule_PD | ||
up_conv_nn: | ||
[ | ||
[32*in_feat + 16*in_feat, 8*in_feat], | ||
[8*in_feat + 8*in_feat, 4*in_feat], | ||
[4*in_feat + 4*in_feat, 2*in_feat], | ||
[2*in_feat + 2*in_feat, in_feat], | ||
] | ||
skip: True | ||
up_k: [1,1,1,1] | ||
bn_momentum: | ||
[ | ||
bn_momentum, | ||
bn_momentum, | ||
bn_momentum, | ||
bn_momentum, | ||
bn_momentum, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# @package model | ||
defaults: | ||
- /model/segmentation/default | ||
|
||
model: | ||
conv_type: "DENSE" | ||
backbone: | ||
_target_: torch_points3d.applications.pointnet2.PointNet2 | ||
config: | ||
down_conv: | ||
module_name: PointNetMSGDown | ||
npoint: [1024, 256, 64, 16] | ||
radii: [[0.05, 0.1], [0.1, 0.2], [0.2, 0.4], [0.4, 0.8]] | ||
nsamples: [[16, 32], [16, 32], [16, 32], [16, 32]] | ||
down_conv_nn: | ||
[ | ||
[[FEAT+3, 16, 16, 32], [FEAT+3, 32, 32, 64]], | ||
[[32 + 64+3, 64, 64, 128], [32 + 64+3, 64, 96, 128]], | ||
[ | ||
[128 + 128+3, 128, 196, 256], | ||
[128 + 128+3, 128, 196, 256], | ||
], | ||
[ | ||
[256 + 256+3, 256, 256, 512], | ||
[256 + 256+3, 256, 384, 512], | ||
], | ||
] | ||
up_conv: | ||
module_name: DenseFPModule | ||
up_conv_nn: | ||
[ | ||
[512 + 512 + 256 + 256, 512, 512], | ||
[512 + 128 + 128, 512, 512], | ||
[512 + 64 + 32, 256, 256], | ||
[256 + FEAT, 128, 128], | ||
] | ||
skip: True | ||
mlp_cls: | ||
nn: [128, 128] | ||
dropout: 0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[email protected]:1624465837 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from typing import List | ||
import os | ||
import os.path as osp | ||
import pytest | ||
|
||
from hydra import compose, initialize | ||
from hydra.test_utils.test_utils import find_parent_dir_containing | ||
|
||
from torch_points3d.trainer import LitTrainer | ||
from torch_points3d.core.instantiator import HydraInstantiator | ||
|
||
|
||
class ScriptRunner: | ||
|
||
@staticmethod | ||
def find_hydra_conf_dir(config_dir: str = "conf") -> str: | ||
""" | ||
Util function to find the hydra config directory from the main repository for testing. | ||
Args: | ||
config_dir: Name of config directory. | ||
Returns: Relative config path | ||
""" | ||
parent_dir = find_parent_dir_containing(config_dir) | ||
relative_conf_dir = osp.relpath(parent_dir, os.path.dirname(__file__)) | ||
return osp.join(relative_conf_dir, config_dir) | ||
|
||
def train(self, cmd_args: List[str]) -> None: | ||
relative_conf_dir = self.find_hydra_conf_dir() | ||
with initialize(config_path=relative_conf_dir, job_name="test_app"): | ||
cfg = compose(config_name="config", overrides=cmd_args) | ||
instantiator = HydraInstantiator() | ||
trainer = LitTrainer( | ||
instantiator, | ||
dataset=cfg.get("dataset"), | ||
trainer=cfg.get("trainer"), | ||
model=cfg.get("model")) | ||
trainer.train() | ||
|
||
def hf_train(self, dataset: str, model: str, num_workers: int = 0, fast_dev_run: int = 1): | ||
cmd_args = [] | ||
cmd_args.extend([ | ||
f'model={model}', | ||
f'dataset={dataset}', | ||
f'trainer.max_epochs=1', | ||
f'training.num_workers=1' | ||
]) | ||
self.train(cmd_args) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def script_runner() -> ScriptRunner: | ||
return ScriptRunner() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Eventually we can redo this to use hydra instantiation for blocks and remove some of the model factory reflection code