meetps/pytorch-semseg

Any tip to train models from scratch using cityscape dataset?

June-Jo opened this issue · 1 comments

Hi, I'm trying to train the segmentation models using cityscape dataset(training: 2975, validation:500).

In the papers of some segmentation models, mIoU of them is over 70%.
However, I cannot reach there.

I tried pspnet, segnet, and fcns, but they just reached to 40% of mIoU.
I also tried data augmentation(scaling, random rotation, horizontal flip).
In order to ignore the background, I changed the ignore_index of loss function from 250 to 0, and the label of 250 is replaced to 0.

Did I do something wrong or is there any tip to train them from scratch?

Thanks for your help in advance.

My cfg file of pspnet is below.

model:
    arch: pspnet
data:
    dataset: cityscapes
    train_split: train
    val_split: val
    img_rows: 512
    img_cols: 1024
    path: '/home/irobot/hj/Dataset/cityscape/'
training:
    train_iters: 120000
    batch_size: 16
    val_interval: 1000
    n_workers: 16
    print_interval: 20
    optimizer:
        name: 'sgd'
        lr: 1.0e-3
        weight_decay: 0.0001
        momentum: 0.9
    loss:
        name: 'multi_scale_cross_entropy'
        size_average: True
    lr_schedule: 
        name: 'multi_step'
        milestones: [30000, 60000, 90000]
    resume: pspnet_cityscape_best_model.pkl
    augmentations:
        rotate: 10                                    #[rotate -d to d degrees]
        scale: 2048                                 #[scale to size (h,w)]
        hflip: 0.5                                     #[flip horizontally with chance p]

I was confused of indexing method in data loader.
I noticed that 0 is not background or unlabeled but the road.....
Therefore, I changed ignore_index from 0 to 250 back.

Now the mIoU is 52% after 4 epochs and it looks like keep increasing.

I'll report after the training finishes.

P.S. I added more augmentations like below.

        rotate: 10  
        rsize: 1024 
        hflip: 0.5   
        vflip: 0.5
        brightness: 0.5
        saturation: 0.5
        contrast: 0.5
        gamma: 0.5
        hue: 0.5

pspnet reach at 65% of mIoU.
Any tips to increase further?