open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.7k stars 9.48k forks source link

[YOLOX] MultiImageMixDataset on VOC #5997

Closed PPeanutButter closed 3 years ago

PPeanutButter commented 3 years ago

这是我原始的可以用的

data = dict(
    samples_per_gpu=1,
    workers_per_gpu=1,
    train=dict(
        type='RepeatDataset',
        times=3,
        dataset=dict(
            type='VOCDataset',
            ann_file=[
                '/media/user/Data/.../ImageSets/Main/trainval_c.txt'
            ],
            img_prefix=['/media/user/Data/.../VOC2007/'],
            pipeline=[
                dict(type='LoadImageFromFile'),
                dict(type='LoadAnnotations', with_bbox=True),
                dict(type='Resize', img_scale=(2880, 1728), keep_ratio=True),
                dict(type='RandomFlip', flip_ratio=0.5),
                dict(
                    type='Normalize',
                    mean=[123.675, 116.28, 103.53],
                    std=[58.395, 57.12, 57.375],
                    to_rgb=True),
                dict(type='Pad', size_divisor=32),
                dict(type='DefaultFormatBundle'),
                dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])]),
            ]),

根据yolox加入MixUp, ignore dataset path, hidden for privacy

         type='MultiImageMixDataset',
        dataset=dict(
            type='VOCDataset',
            ann_file=[
                '/media/user/Data/.../VOC2007/ImageSets/Main/trainval_c.txt'
            ],
            img_prefix=['/media/user/Data/.../VOC2007/C8/'],
            pipeline=[
                dict(type='LoadImageFromFile'),
                dict(type='LoadAnnotations', with_bbox=True),
            ]),
        pipeline=[
                dict(type='MixUp', img_scale=(2880, 1728)),
                dict(type='Resize', img_scale=(2880, 1728), keep_ratio=True),
                dict(type='RandomFlip', flip_ratio=0.5),
                dict(
                    type='Normalize',
                    mean=[123.675, 116.28, 103.53],
                    std=[58.395, 57.12, 57.375],
                    to_rgb=True),
                dict(type='Pad', size_divisor=32),
                dict(type='DefaultFormatBundle'),
                dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])]),

it says this

Original Traceback (most recent call last):
  File "/home/user/anaconda3/envs/mmlab-drs/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/user/anaconda3/envs/mmlab-drs/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/user/anaconda3/envs/mmlab-drs/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/media/user/Data/mmdet-2.15.1/mmdet/datasets/dataset_wrappers.py", line 354, in __getitem__
    indexes = transform.get_indexes(self.dataset)
  File "/media/user/Data/mmdet-2.15.1/mmdet/datasets/pipelines/transforms.py", line 2254, in get_indexes
    gt_bboxes_i = dataset.get_ann_info(index)['bboxes']
AttributeError: 'ConcatDataset' object has no attribute 'get_ann_info'

但是我没用ConcatDataset

Originally posted by @PPeanutButter in https://github.com/open-mmlab/mmdetection/issues/5916#issuecomment-909837180

hhaAndroid commented 3 years ago

@PPeanutButter Thank you for your feedback, we will test it on VOC.

hhaAndroid commented 3 years ago

@PPeanutButter Please do not use RepeatDataset for now, you can directly modify ConcatDataset to VOCDataset on the yolox_tiny configuration we provide and then adjust the corresponding parameters.

PPeanutButter commented 3 years ago

@PPeanutButter Please do not use RepeatDataset for now, you can directly modify ConcatDataset to VOCDataset on the yolox_tiny configuration we provide and then adjust the corresponding parameters.

Thanks for the solution very much, I will try it later. So, MultiImageMixDataset is kind of extend of ConcatDataset?

hhaAndroid commented 3 years ago

@PPeanutButter Please do not use RepeatDataset for now, you can directly modify ConcatDataset to VOCDataset on the yolox_tiny configuration we provide and then adjust the corresponding parameters.

Thanks for the solution very much, I will try it later. So, MultiImageMixDataset is kind of extend of ConcatDataset?

Yes