question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use albu data augmentation in HTC algorithm?

See original GitHub issue

Checklist

  1. I have searched related issues but cannot get the expected help. yes
  2. The bug has not been fixed in the latest version. yes

Describe the bug when i use albu data augmentation in htc_x101_32x4d_fpn without semantic ,like albu example(mask rcnn):

dataset_type = 'CocoDataset'
data_root = '/disk2/data/'
img_norm_cfg = dict(
    mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
albu_train_transforms = [
    dict(
        type='ShiftScaleRotate',
        shift_limit=0.0625,
        scale_limit=0.0,
        rotate_limit=30,
        interpolation=2,
        p=0.5),
    dict(
        type='RandomBrightnessContrast',
        brightness_limit=[0.1, 0.3],
        contrast_limit=[0.1, 0.3],
        p=0.2),
    dict(
        type='OneOf',
        transforms=[
            dict(
                type='RGBShift',
                r_shift_limit=10,
                g_shift_limit=10,
                b_shift_limit=10,
                p=1.0),
            dict(
                type='HueSaturationValue',
                hue_shift_limit=20,
                sat_shift_limit=30,
                val_shift_limit=20,
                p=1.0)
        ],
        p=0.1),
    dict(type='JpegCompression', quality_lower=85, quality_upper=95, p=0.2),
    dict(type='ChannelShuffle', p=0.1),
    dict(
        type='OneOf',
        transforms=[
            dict(type='Blur', blur_limit=3, p=1.0),
            dict(type='MedianBlur', blur_limit=3, p=1.0)
        ],
        p=0.1),
]
train_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(
        type='LoadAnnotations', with_bbox=True, with_mask=True),
    #dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),
    dict(
        type='Resize',
        img_scale=[(1400, 600), (1400, 1024)],
        multiscale_mode='range',
        keep_ratio=True),
    dict(type='RandomFlip', flip_ratio=0.0),
    dict(type='Pad', size_divisor=32),
    dict(
        type='Albu',
        transforms=albu_train_transforms,
        bbox_params=dict(
            type='BboxParams',
            format='pascal_voc',
            label_fields=['gt_labels'],
            min_visibility=0.0,
            filter_lost_elements=True),
        keymap={
            'img': 'image',
            'gt_masks': 'masks',
            'gt_bboxes': 'bboxes'
        },
        update_pad_shape=False,
        skip_img_without_anno=True),
    dict(type='Normalize', **img_norm_cfg),
    dict(type='DefaultFormatBundle'),
    dict(
        type='Collect',
        keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']),
]

Reproduction

  1. What command or script did you run?
#!/bin/bash
export PYTHONPATH=`pwd`:$PYTHONPATH
CUDA_VISIBLE_DEVICES=2 python tools/train.py configs/htc/zh_htc_x101_32x4d_fpn_20e_mstrain_imgaug_8gpu.py
  1. Did you make any modifications on the code or config? Did you understand what you have modified? No change!
  2. What dataset did you use? custom datasets (like coco ) Environment
  • OS: centos 7.2
  • GCC :4.9.4
  • PyTorch version : 1.1.0
  • How you installed PyTorch : pip
  • GPU model : V100 *8
  • CUDA and CUDNN version: CUDA9 and cudnn7

Error traceback If applicable, paste the error trackback here.

2019-11-28 14:09:55,816 - INFO - Start running, host: suishou.zh@pic-plat-dev-02.et2, work_dir: /disk2/data/suishou.zh/poi_project/temp/mmdetection/work_dirs/htc_without_semantic_x101_32x4d_fpn_20e
2019-11-28 14:09:55,816 - INFO - workflow: [('train', 1)], max: 20 epochs
Traceback (most recent call last):
  File "tools/train.py", line 108, in <module>
    main()
  File "tools/train.py", line 104, in main
    logger=logger)
  File "/disk2/data/suishou.zh/poi_project/temp/mmdetection/mmdet/apis/train.py", line 60, in train_detector
    _non_dist_train(model, dataset, cfg, validate=validate)
  File "/disk2/data/suishou.zh/poi_project/temp/mmdetection/mmdet/apis/train.py", line 232, in _non_dist_train
    runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
  File "/home/suishou.zh/open-mmlab/lib/python3.6/site-packages/mmcv/runner/runner.py", line 358, in run
    epoch_runner(data_loaders[i], **kwargs)
  File "/home/suishou.zh/open-mmlab/lib/python3.6/site-packages/mmcv/runner/runner.py", line 264, in train
    self.model, data_batch, train_mode=True, **kwargs)
  File "/disk2/data/suishou.zh/poi_project/temp/mmdetection/mmdet/apis/train.py", line 38, in batch_processor
    losses = model(**data)
  File "/home/suishou.zh/open-mmlab/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/suishou.zh/open-mmlab/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/home/suishou.zh/open-mmlab/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/disk2/data/suishou.zh/poi_project/temp/mmdetection/mmdet/core/fp16/decorators.py", line 49, in new_func
    return old_func(*args, **kwargs)
  File "/disk2/data/suishou.zh/poi_project/temp/mmdetection/mmdet/models/detectors/base.py", line 117, in forward
    return self.forward_train(img, img_meta, **kwargs)
  File "/disk2/data/suishou.zh/poi_project/temp/mmdetection/mmdet/models/detectors/htc.py", line 296, in forward_train
    semantic_feat)
  File "/disk2/data/suishou.zh/poi_project/temp/mmdetection/mmdet/models/detectors/htc.py", line 109, in _mask_forward_train
    rcnn_train_cfg)
  File "/disk2/data/suishou.zh/poi_project/temp/mmdetection/mmdet/models/mask_heads/fcn_mask_head.py", line 111, in get_target
    gt_masks, rcnn_train_cfg)
  File "/disk2/data/suishou.zh/poi_project/temp/mmdetection/mmdet/core/mask/mask_target.py", line 12, in mask_target
    mask_targets = torch.cat(list(mask_targets))
  File "/disk2/data/suishou.zh/poi_project/temp/mmdetection/mmdet/core/mask/mask_target.py", line 22, in mask_target_single
    _, maxh, maxw = gt_masks.shape
AttributeError: 'list' object has no attribute 'shape'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
unlabeledDatacommented, May 25, 2020

How to use albu aug in HTC with gt_semantic_seg?

1reaction
yhcao6commented, Dec 16, 2019

Thanks for reporting the bug, #1818 fix this error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image augmentation for classification - Albumentations
Step 1. Import the required libraries. Step 2. Define an augmentation pipeline. Step 3. Read images from the disk. ... Step 4. Pass...
Read more >
A Comprehensive Survey of Image Augmentation ... - arXiv
Specifically, we first explain why different image augmentation algorithms have been designed and leveraged across diverse applications. More ...
Read more >
Data Augmentation in Python: Everything You Need to Know
To augment images when using TensorFlow or Keras as our DL framework, we can: Write our own augmentation pipelines or layers using tf.image....
Read more >
Data Augmentation | How to use Deep Learning when you ...
So, if I use ALL of these techniques, my ML algorithm would be robust right? Is it really worth the effort? Further Reading....
Read more >
Soma da altın fiyatları - dasmiyesin.online
Serbest Piyasa 2022-09-27 Mahjong zorlu beyin jimnastiği 0793 Gram altın satış: 892,28 85 Soma arsa fiyatları (imarlı ort İşte 6 Mayıs Cuma günü...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found