-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Comments
@Czm369 please to take a look |
Please see if you can solve you issue following the solution in #9610. |
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 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 |
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 |
@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? |
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:
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: classConcatDataset
in mmengine/dataset/dataset_wrapper.py: classCocoDataset
in mmdet/datasets/coco.py: need at least one array to concatenateAdditional 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.
The text was updated successfully, but these errors were encountered: