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

[Bug] #9706

Closed
3 tasks done
southeastboss opened this issue Jan 31, 2023 · 5 comments
Closed
3 tasks done

[Bug] #9706

southeastboss opened this issue Jan 31, 2023 · 5 comments
Assignees
Labels
Milestone

Comments

@southeastboss
Copy link

Prerequisite

Task

I have modified the scripts/configs, or I'm working on my own tasks/models/datasets.

Branch

3.x branch https://github.com/open-mmlab/mmdetection/tree/3.x

Environment

sys.platform: linux
Python: 3.8.10 (default, Jun 4 2021, 15:09:15) [GCC 7.5.0]
CUDA available: True
numpy_random_seed: 2147483648
GPU 0: NVIDIA GeForce RTX 3060
CUDA_HOME: /usr/local/cuda
NVCC: Cuda compilation tools, release 11.3, V11.3.109
GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
PyTorch: 1.11.0+cu113
PyTorch compiling details: PyTorch built with:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v2.5.2 (Git Hash a9302535553c73243c632ad3c4c80beec3d19a1e)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • LAPACK is enabled (usually provided by MKL)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • 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_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
  • 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-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.11.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF,

TorchVision: 0.12.0+cu113
OpenCV: 4.6.0
MMEngine: 0.3.2
MMDetection: 3.0.0rc5+92d03df

Reproduces the problem - code sample

base = [
'../base/models/faster-rcnn_r50_fpn.py',
'../base/default_runtime.py',
'../base/datasets/semi_coco_detection.py',
'../base/schedules/schedule_1x.py'
]

detector = base.model
detector.data_preprocessor = dict(
type='DetDataPreprocessor',
mean=[103.530, 116.280, 123.675],
std=[1.0, 1.0, 1.0],
bgr_to_rgb=False,
pad_size_divisor=32)
detector.backbone = dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=False),
norm_eval=True,
style='caffe',
init_cfg=dict(
type='Pretrained',
checkpoint='open-mmlab://detectron2/resnet50_caffe'))

model = dict(
delete=True,
type='SoftTeacher',
detector=detector,
data_preprocessor=dict(
type='MultiBranchDataPreprocessor',
data_preprocessor=detector.data_preprocessor),
semi_train_cfg=dict(
freeze_teacher=True,
sup_weight=1.0,
unsup_weight=4.0,
pseudo_label_initial_score_thr=0.5,
rpn_pseudo_thr=0.9,
cls_pseudo_thr=0.9,
reg_pseudo_thr=0.02,
jitter_times=10,
jitter_scale=0.06,
min_pseudo_bbox_wh=(1e-2, 1e-2)),
semi_test_cfg=dict(predict_on='teacher'))

custom_hooks = [dict(type='MeanTeacherHook')]
val_cfg = dict(type='TeacherStudentValLoop')
work_dir='work_dir/faster_rcnn_semi_detection'

Reproduces the problem - command or script

python tools/train.py configs/faster_rcnn/faster_rcnn_semi_detection.py

Reproduces the problem - error message

Traceback (most recent call last):
File "tools/train.py", line 130, in
main()
File "tools/train.py", line 126, in main
runner.train()
File "/root/miniconda3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1654, in train
self._train_loop = self.build_train_loop(
File "/root/miniconda3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1446, in build_train_loop
loop = LOOPS.build(
File "/root/miniconda3/lib/python3.8/site-packages/mmengine/registry/registry.py", line 454, in build
return self.build_func(cfg, *args, **kwargs, registry=self)
File "/root/miniconda3/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 135, in build_from_cfg
raise type(e)(
ValueError: class EpochBasedTrainLoop in mmengine/runner/loops.py: class ConcatDataset in mmengine/dataset/dataset_wrapper.py: class CocoDataset in mmdet/datasets/coco.py: need at least one array to concatenate

Additional information

I try to use semi-supervised object detection in my Dataset I follow the docs in https://mmdetection.readthedocs.io/en/3.x/user_guides/semi_det.html
I prepare and split my dataset as blow
mmdetection
├── data
│ ├── coco
│ │ ├── annotations
│ │ │ ├── image_info_unlabeled2017.json
│ │ │ ├── instances_train2017.json
│ │ │ ├── instances_unlabeled2017.json
│ │ │ ├── instances_val2017.json
│ │ ├── train2017
│ │ ├── unlabeled2017
│ │ ├── val2017

and using the config show in the code sample part,
but it arise error show in the error message part.

@ZwwWayne ZwwWayne added this to the 3.0.0rc6 milestone Feb 2, 2023
@ZwwWayne
Copy link
Collaborator

ZwwWayne commented Feb 2, 2023

@Czm369 please to take a look

@ZwwWayne
Copy link
Collaborator

ZwwWayne commented Feb 2, 2023

Please see if you can solve you issue following the solution in #9610.

@southeastboss
Copy link
Author

I solve this problem with change the config. Now I use the config which inherit the config in configs/soft_teacher/soft-teacher_faster-rcnn_r50-caffe_fpn_180k_semi-0.1-coco.py and change the key of 'num_classes', 'labeled_dataset.ann_file', 'unlabeled_dataset.ann_file', and add key of 'metainfo' in each dataset dict part.

the metainfo as below
metainfo=dict(
classes=('a', 'b', 'c'),
palette=[(255, 0, 0), (0, 255, 0), (0, 0, 255)]),

I see the config in configs/soft_teacher/soft-teacher_faster-rcnn_r50-caffe_fpn_180k_semi-0.1-coco.py use the train_cfg as blow
train_cfg = dict(type='IterBasedTrainLoop', max_iters=180000, val_interval=5000)
so in the semi_detection can we use other type train_cfg? I have not see in the user_guides.
so I think the user_guides in https://mmdetection.readthedocs.io/en/3.x/user_guides/semi_det.html is not complete.
I hope the group of mmdetection can improve the docs and we can use the mmdetection more convenient.
thank you!

@Czm369
Copy link
Collaborator

Czm369 commented Feb 2, 2023

Because semi-supervised object detection involves labeled dataset and unlabeled dataset, the sizes of the two data sets are different and it is difficult to define epoch, so only supported IterBasedTrainLoop.

@Sundragon1993
Copy link

@Czm369 In case I train a traditional supervise method like RTMDet using ConcatDataset type, could you confirm that the mmdet v3 doesn't support using EpochBasedTrainLoop?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants