mmsegmentation
mmsegmentation copied to clipboard
How to specify config-file for grayscale images of certain size?
I am following this tutorial: https://github.com/open-mmlab/mmsegmentation/blob/master/demo/MMSegmentation_Tutorial.ipynb
I am using grayscale images of size (3006,4104). What should the following values in the config be changed to:
cfg.img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
cfg.crop_size = (256, 256)
cfg.train_pipeline = [ dict(type='Resize', img_scale=(320, 240), ratio_range=(0.5, 2.0)),
img_norm_cfg
should keep the same because most pretrained models of MMSegmentation are pretrained based on this image normalization value.
crop_size
may be larger because your grayscale images are much larger than normal datasets. But noted that large crop_size
may increase GPU memory requirement.
img_scale
in Resize
may keep the ratio with crop_size
, for example, if crop_sizze = (512, 512)
then cfg.train_pipeline = [dict(type='Resize', img_scale=(640, 480), ratio_range=(0.5, 2.0)),
Even if crop_size
is bigger, should it always be quadratic, or should/could it be adapted to the aspect ratio of the image?
Could you elaborate your example on how img_scale
Resize
may keep the ratio with crop_size
? How do you mean that the ratio is kept if crop_size = (512, 512) and you then set cfg.train_pipeline = [dict(type='Resize', img_scale=(640, 480)?
Thanks for the quick response!
-
The setting of crop size is not strict, you may have a try to find a suitable value.
-
For example,
ade20k.py
andade20k_640x640.py
.
So if my grayscale images are of size (3006,4104) and I choose cfg.crop_size = (1024,1024)
.
Does this in anyway affect how I should choose img_scale
in dict(type='Resize', img_scale
or what should I otherwise take into consideration when setting img_scale
?
It depends on your dataset, you can try to find suitable variables by grid search of these hyper parameters.
Closing the issue, as there is no activity for a while. We hope your issue has been resolved. If not, please feel free to open a new one.