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

[Fix] RAFT KITTI test cfg and set_env #165

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion configs/_base_/datasets/kitti2015_raft_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
img_norm_cfg = dict(mean=[0., 0., 0.], std=[255., 255., 255.], to_rgb=False)
img_norm_cfg = dict(
mean=[127.5, 127.5, 127.5], std=[127.5, 127.5, 127.5], to_rgb=False)

kitti_test_pipeline = [
dict(type='LoadImageFromFile'),
Expand Down
9 changes: 7 additions & 2 deletions mmflow/utils/set_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
def setup_multi_processes(cfg):
"""Setup multi-processing environment variables."""
logger = get_root_logger()

# set multi-process start method
if platform.system() != 'Windows':
mp_start_method = cfg.get('mp_start_method', None)
Expand All @@ -31,7 +30,13 @@ def setup_multi_processes(cfg):
else:
logger.info(f'OpenCV num_threads is `{cv2.getNumThreads()}')

if cfg.data.train_dataloader.workers_per_gpu > 1:
if cfg.data.get('train_dataloader') is not None:
workers_per_gpu = cfg.data.train_dataloader.get('workers_per_gpu', 0)
elif cfg.data.get('test_dataloader') is not None:
workers_per_gpu = cfg.data.test_dataloader.get('workers_per_gpu', 0)
else:
workers_per_gpu = 0
if workers_per_gpu > 1:
# setup OMP threads
# This code is referred from https://github.com/pytorch/pytorch/blob/master/torch/distributed/run.py # noqa
omp_num_threads = cfg.get('omp_num_threads', None)
Expand Down