A question about test_pipeline #2358
Replies: 9 comments
-
In inference, the batch size is 1. I think this is the main reason. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer. But I think the image size (2550, 2271) is far more than 4 times image size (512, 512). |
Beta Was this translation helpful? Give feedback.
-
# dataset settings
dataset_type = 'RemoteSenseDataset'
data_root = 'data/rs128'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
crop_size = (512, 512)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations'),
# dict(type='Resize', img_scale=(2550, 2271), ratio_range=(0.5, 2)),
dict(type='Resize', ratio_range=(0.8, 1.25), keep_ratio=True),
dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75),
dict(type='RandomFlip', prob=0.5),
dict(type='PhotoMetricDistortion'),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size=crop_size, pad_val=0, seg_pad_val=255),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_semantic_seg']),
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(2550, 2271),
# img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75],
flip=False,
transforms=[
dict(type='Resize', keep_ratio=True),
dict(type='RandomFlip'),
dict(type='Normalize', **img_norm_cfg),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img']),
]
)
]
data = dict(
samples_per_gpu=4,
workers_per_gpu=1,
train=dict(
type=dataset_type,
data_root=data_root,
img_dir='JPEGImages',
ann_dir='SegmentationClass',
split='ImageSets/Segmentation/train.txt',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
data_root=data_root,
img_dir='JPEGImages',
ann_dir='SegmentationClass',
split='ImageSets/Segmentation/val.txt',
pipeline=test_pipeline),
test=dict(
type=dataset_type,
data_root=data_root,
img_dir='JPEGImages',
ann_dir='SegmentationClass',
split='ImageSets/Segmentation/val.txt',
pipeline=test_pipeline))
#My dataset image size is (2550, 2271). Is my test image size also (2550, 2271) during testing? |
Beta Was this translation helpful? Give feedback.
-
I was wondering if it was because the batch_ The size is set to 4, which means that four models and four pictures are loaded at the same time, so the cuda memory is full. When testing, batch_ The size is 1 and only one model is loaded, so you can test images of that size. Is my guess right? |
Beta Was this translation helpful? Give feedback.
-
The image size won't be changed during testing. |
Beta Was this translation helpful? Give feedback.
-
Only one model loaded to a GPU and a batch data contains 4 images if https://mmsegmentation.readthedocs.io/en/latest/tutorials/customize_datasets.html#data-configuration |
Beta Was this translation helpful? Give feedback.
-
I was very confused why the image I tested was so large that there was no memory explosion. The model I used is ocrnet. The RTX3080 memory is 16G. The image I tested was (2550, 2271). |
Beta Was this translation helpful? Give feedback.
-
Hi @createhappily, during training, parameters, gradients, optimizer states, and intermedia activations would cost the GPU memory. |
Beta Was this translation helpful? Give feedback.
-
Thank you. |
Beta Was this translation helpful? Give feedback.
-
Hello, may I ask a question about the test pipeline? When I train, I usually crop image to (512, 512), set the batch size to 4, and the cuda memory is basically full. But when I test the image, the specifications of the image can reach (2550, 2271). I want to ask why such a large image test will not exceed cuda memory.
Beta Was this translation helpful? Give feedback.
All reactions