likyoo/open-cd

ModuleNotFoundError: No module named 'DCNv3'

chartgod opened this issue · 0 comments

(opencd) lsh@new-gpu:~/share/open-cd$ CUDA_VISIBLE_DEVICES=7 python tools/train.py configs/changer/changer_ex_r18_512x512_40k_levircd.py --work-dir ./changer_r18_levir_workdir
08/01 09:30:23 - mmengine - INFO -

System environment:
sys.platform: linux
Python: 3.8.19 (default, Mar 20 2024, 19:58:24) [GCC 11.2.0]
CUDA available: True
MUSA available: False
numpy_random_seed: 398902526
GPU 0: NVIDIA GeForce RTX 3090
CUDA_HOME: /usr/local/cuda
NVCC: Cuda compilation tools, release 11.4, V11.4.48
GCC: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
PyTorch: 1.10.0
PyTorch compiling details: PyTorch built with:

  • GCC 7.3

  • C++ Version: 201402

  • Intel(R) oneAPI Math Kernel Library Version 2023.1-Product Build 20230303 for Intel(R) 64 architecture applications

  • Intel(R) MKL-DNN v2.2.3 (Git Hash 7336ca9f055cf1bfa13efb658fe15dc9b41f0740)

  • OpenMP 201511 (a.k.a. OpenMP 4.5)

  • LAPACK is enabled (usually provided by MKL)

  • NNPACK is enabled

  • CPU capability usage: AVX512

  • CUDA Runtime 11.3

  • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=compute_37

  • CuDNN 8.2

  • Magma 2.5.2

  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.3, CUDNN_VERSION=8.2.0, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.10.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,

    TorchVision: 0.11.0
    OpenCV: 4.10.0
    MMEngine: 0.10.4

Runtime environment:
cudnn_benchmark: True
mp_cfg: {'mp_start_method': 'fork', 'opencv_num_threads': 0}
dist_cfg: {'backend': 'nccl'}
seed: 398902526
Distributed launcher: none
Distributed training: False
GPU number: 1

08/01 09:30:23 - mmengine - INFO - Config:
crop_size = (
512,
512,
)
data_preprocessor = dict(
bgr_to_rgb=True,
mean=[
123.675,
116.28,
103.53,
123.675,
116.28,
103.53,
],
pad_val=0,
seg_pad_val=255,
size_divisor=32,
std=[
58.395,
57.12,
57.375,
58.395,
57.12,
57.375,
],
test_cfg=dict(size_divisor=32),
type='DualInputSegDataPreProcessor')
data_root = 'data/LEVIR-CD'
dataset_type = 'LEVIR_CD_Dataset'
default_hooks = dict(
checkpoint=dict(
by_epoch=False, interval=4000, save_best='mIoU',
type='CheckpointHook'),
logger=dict(interval=50, log_metric_by_epoch=False, type='LoggerHook'),
param_scheduler=dict(type='ParamSchedulerHook'),
sampler_seed=dict(type='DistSamplerSeedHook'),
timer=dict(type='IterTimerHook'),
visualization=dict(
img_shape=(
1024,
1024,
3,
), interval=1, type='CDVisualizationHook'))
default_scope = 'opencd'
env_cfg = dict(
cudnn_benchmark=True,
dist_cfg=dict(backend='nccl'),
mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0))
img_ratios = [
0.75,
1.0,
1.25,
]
launcher = 'none'
load_from = None
log_level = 'INFO'
log_processor = dict(by_epoch=False)
model = dict(
backbone=dict(
contract_dilation=True,
depth=18,
dilations=(
1,
1,
1,
1,
),
interaction_cfg=(
None,
dict(p=0.5, type='SpatialExchange'),
dict(p=0.5, type='ChannelExchange'),
dict(p=0.5, type='ChannelExchange'),
),
norm_cfg=dict(requires_grad=True, type='SyncBN'),
norm_eval=False,
num_stages=4,
out_indices=(
0,
1,
2,
3,
),
strides=(
1,
2,
2,
2,
),
style='pytorch',
type='IA_ResNetV1c'),
data_preprocessor=dict(
bgr_to_rgb=True,
mean=[
123.675,
116.28,
103.53,
123.675,
116.28,
103.53,
],
pad_val=0,
seg_pad_val=255,
size_divisor=32,
std=[
58.395,
57.12,
57.375,
58.395,
57.12,
57.375,
],
test_cfg=dict(size_divisor=32),
type='DualInputSegDataPreProcessor'),
decode_head=dict(
align_corners=False,
channels=128,
dropout_ratio=0.1,
in_channels=[
64,
128,
256,
512,
],
in_index=[
0,
1,
2,
3,
],
loss_decode=dict(
loss_weight=1.0, type='mmseg.CrossEntropyLoss', use_sigmoid=False),
norm_cfg=dict(requires_grad=True, type='SyncBN'),
num_classes=2,
sampler=dict(
min_kept=100000, thresh=0.7, type='mmseg.OHEMPixelSampler'),
type='Changer'),
pretrained=None,
test_cfg=dict(mode='whole'),
train_cfg=dict(),
type='DIEncoderDecoder')
norm_cfg = dict(requires_grad=True, type='SyncBN')
optim_wrapper = dict(
optimizer=dict(
betas=(
0.9,
0.999,
), lr=0.005, type='AdamW', weight_decay=0.05),
type='OptimWrapper')
optimizer = dict(
betas=(
0.9,
0.999,
), lr=0.005, type='AdamW', weight_decay=0.05)
param_scheduler = [
dict(
begin=0, by_epoch=False, end=1000, start_factor=1e-06,
type='LinearLR'),
dict(
begin=1000,
by_epoch=False,
end=40000,
eta_min=0.0,
power=1.0,
type='PolyLR'),
]
resume = False
test_cfg = dict(type='TestLoop')
test_dataloader = dict(
batch_size=1,
dataset=dict(
data_prefix=dict(
img_path_from='test/A',
img_path_to='test/B',
seg_map_path='test/label'),
data_root='data/LEVIR-CD',
pipeline=[
dict(type='MultiImgLoadImageFromFile'),
dict(keep_ratio=True, scale=(
1024,
1024,
), type='MultiImgResize'),
dict(type='MultiImgLoadAnnotations'),
dict(type='MultiImgPackSegInputs'),
],
type='LEVIR_CD_Dataset'),
num_workers=4,
persistent_workers=True,
sampler=dict(shuffle=False, type='DefaultSampler'))
test_evaluator = dict(
iou_metrics=[
'mFscore',
'mIoU',
], type='mmseg.IoUMetric')
test_pipeline = [
dict(type='MultiImgLoadImageFromFile'),
dict(keep_ratio=True, scale=(
1024,
1024,
), type='MultiImgResize'),
dict(type='MultiImgLoadAnnotations'),
dict(type='MultiImgPackSegInputs'),
]
train_cfg = dict(max_iters=40000, type='IterBasedTrainLoop', val_interval=4000)
train_dataloader = dict(
batch_size=8,
dataset=dict(
data_prefix=dict(
img_path_from='train/A',
img_path_to='train/B',
seg_map_path='train/label'),
data_root='data/LEVIR-CD',
pipeline=[
dict(type='MultiImgLoadImageFromFile'),
dict(type='MultiImgLoadAnnotations'),
dict(
degree=(
-20,
20,
),
flip_prob=0.5,
rotate_prob=0.5,
type='MultiImgRandomRotFlip'),
dict(
cat_max_ratio=0.75,
crop_size=(
512,
512,
),
type='MultiImgRandomCrop'),
dict(prob=0.5, type='MultiImgExchangeTime'),
dict(
brightness_delta=10,
contrast_range=(
0.8,
1.2,
),
hue_delta=10,
saturation_range=(
0.8,
1.2,
),
type='MultiImgPhotoMetricDistortion'),
dict(type='MultiImgPackSegInputs'),
],
type='LEVIR_CD_Dataset'),
num_workers=4,
persistent_workers=True,
sampler=dict(shuffle=True, type='InfiniteSampler'))
train_pipeline = [
dict(type='MultiImgLoadImageFromFile'),
dict(type='MultiImgLoadAnnotations'),
dict(
degree=(
-20,
20,
),
flip_prob=0.5,
rotate_prob=0.5,
type='MultiImgRandomRotFlip'),
dict(
cat_max_ratio=0.75, crop_size=(
512,
512,
), type='MultiImgRandomCrop'),
dict(prob=0.5, type='MultiImgExchangeTime'),
dict(
brightness_delta=10,
contrast_range=(
0.8,
1.2,
),
hue_delta=10,
saturation_range=(
0.8,
1.2,
),
type='MultiImgPhotoMetricDistortion'),
dict(type='MultiImgPackSegInputs'),
]
tta_model = dict(type='mmseg.SegTTAModel')
tta_pipeline = [
dict(backend_args=None, type='MultiImgLoadImageFromFile'),
dict(
transforms=[
[
dict(
keep_ratio=True, scale_factor=0.75, type='MultiImgResize'),
dict(keep_ratio=True, scale_factor=1.0, type='MultiImgResize'),
dict(
keep_ratio=True, scale_factor=1.25, type='MultiImgResize'),
],
[
dict(
direction='horizontal',
prob=0.0,
type='MultiImgRandomFlip'),
dict(
direction='horizontal',
prob=1.0,
type='MultiImgRandomFlip'),
],
[
dict(type='MultiImgLoadAnnotations'),
],
[
dict(type='MultiImgPackSegInputs'),
],
],
type='TestTimeAug'),
]
val_cfg = dict(type='ValLoop')
val_dataloader = dict(
batch_size=1,
dataset=dict(
data_prefix=dict(
img_path_from='val/A',
img_path_to='val/B',
seg_map_path='val/label'),
data_root='data/LEVIR-CD',
pipeline=[
dict(type='MultiImgLoadImageFromFile'),
dict(keep_ratio=True, scale=(
1024,
1024,
), type='MultiImgResize'),
dict(type='MultiImgLoadAnnotations'),
dict(type='MultiImgPackSegInputs'),
],
type='LEVIR_CD_Dataset'),
num_workers=4,
persistent_workers=True,
sampler=dict(shuffle=False, type='DefaultSampler'))
val_evaluator = dict(
iou_metrics=[
'mFscore',
'mIoU',
], type='mmseg.IoUMetric')
vis_backends = [
dict(type='CDLocalVisBackend'),
]
visualizer = dict(
alpha=1.0,
name='visualizer',
type='CDLocalVisualizer',
vis_backends=[
dict(type='CDLocalVisBackend'),
])
work_dir = './changer_r18_levir_workdir'

Traceback (most recent call last):
File "tools/train.py", line 104, in
main()
File "tools/train.py", line 93, in main
runner = Runner.from_cfg(cfg)
File "/home/lsh/miniconda3/envs/opencd/lib/python3.8/site-packages/mmengine/runner/runner.py", line 462, in from_cfg
runner = cls(
File "/home/lsh/miniconda3/envs/opencd/lib/python3.8/site-packages/mmengine/runner/runner.py", line 429, in init
self.model = self.build_model(model)
File "/home/lsh/miniconda3/envs/opencd/lib/python3.8/site-packages/mmengine/runner/runner.py", line 836, in build_model
model = MODELS.build(model)
File "/home/lsh/miniconda3/envs/opencd/lib/python3.8/site-packages/mmengine/registry/registry.py", line 570, in build
return self.build_func(cfg, *args, **kwargs, registry=self)
File "/home/lsh/miniconda3/envs/opencd/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 232, in build_model_from_cfg
return build_from_cfg(cfg, registry, default_args)
File "/home/lsh/miniconda3/envs/opencd/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 98, in build_from_cfg
obj_cls = registry.get(obj_type)
File "/home/lsh/miniconda3/envs/opencd/lib/python3.8/site-packages/mmengine/registry/registry.py", line 451, in get
self.import_from_location()
File "/home/lsh/miniconda3/envs/opencd/lib/python3.8/site-packages/mmengine/registry/registry.py", line 376, in import_from_location
import_module(loc)
File "/home/lsh/miniconda3/envs/opencd/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 843, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/lsh/share/open-cd/opencd/models/init.py", line 1, in
from .backbones import *
File "/home/lsh/share/open-cd/opencd/models/backbones/init.py", line 12, in
from .intern_image import InternImage
File "/home/lsh/share/open-cd/opencd/models/backbones/intern_image.py", line 18, in
from .ops_dcnv3 import modules as opsm
File "/home/lsh/share/open-cd/opencd/models/backbones/ops_dcnv3/modules/init.py", line 7, in
from .dcnv3 import DCNv3, DCNv3_pytorch
File "/home/lsh/share/open-cd/opencd/models/backbones/ops_dcnv3/modules/dcnv3.py", line 16, in
from ..functions import DCNv3Function, dcnv3_core_pytorch
File "/home/lsh/share/open-cd/opencd/models/backbones/ops_dcnv3/functions/init.py", line 7, in
from .dcnv3_func import DCNv3Function, dcnv3_core_pytorch
File "/home/lsh/share/open-cd/opencd/models/backbones/ops_dcnv3/functions/dcnv3_func.py", line 19, in
import DCNv3
ModuleNotFoundError: No module named 'DCNv3'

Can you tell me why this error is occurring?