crop_size and img_scale order
See original GitHub issueIn base dataset-related configs you usually have something like, e.g. in cityscapes
crop_size = (512, 1024)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations'),
dict(type='Resize', img_scale=(2048, 1024), ratio_range=(0.5, 2.0)),
does it mean that crop_size
has height-width order while img_scale
in Resize
has width-height order as cityscapes is obviously has the width equal to ~2x of the height and crops are expected to have similar ratio?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
CSS Display an Image Resized and Cropped - Stack Overflow
I want to show an image from an URL with a certain width and height even if it has a different size ratio....
Read more >Part 2: Scale and Crop Images - SERC - Carleton
Order, download, and unzip the data on your computer. Use both cropping and scaling to reduce the images to a smaller size.
Read more >CropSize Review: Bulk Photo Processing and Resizing App ...
CropSize is an iPad app that allows you to easily resize a batch of images and save them all for Web. Or resize...
Read more >Source code for torchvision.transforms.transforms - PyTorch
If size is an int instead of sequence like (h, w), a square crop (size, size) is made. If provided a tuple or...
Read more >CropSize - Image Size Editor on the App Store - Apple
Offers over 75 features for Crop, Edit, Resize, Filter, Metadata and other tools for single photo and group of photos.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @nizhib For term
size
, we usually use hight-width order in this codebase. For termimg_scale
inResize
transform, the order doesn’t matter. The smaller one will be considered as the short side, the larger one will be considered as the long side. Specifically,img_scale=(2048, 1024)
means the max scale of the resized image is of long side 2048, short side 1024.After investigating, I found that mmcv.imresize takes in (w,h) while mmcv.pad takes in (h,w). When img_scale=(w,h) is passed as a tuple to mmseg with no other scaling parameters, it is passed to mmcv.imresize(w,h) properly.
The way mmseg uses mmcv needs crop and pad to be (h, w).