# What does 'downsampling' and 'upsampling' mean in coarse-to-fine segmentation?

The paper here in section 2.1 Coarse-to-fine prediction:

To increase the field of view presented to the CNN and reduce the redundancy among neighboring voxels, each image is downsampled by a factor of 2. The resulting prediction maps are then resampled back to the original resolution using nearest-neighbor interpolation.

What does it actually mean to downsample by a factor of 2?

If I have an image size of $$256 \times 256 \times 170$$, and if I downsample it by a factor of 2, then will it result in an image of size $$128 \times 128 \times 85$$?

Similarly, would upsampling/resampling be the opposite interpolation method, getting back to the original size of $$256 \times 256 \times 170$$?

What is actually the downsampling of 2 mean?

If I have an image size of 256x256x170 and if I downsample it by a factor of 2, it will result in an image of size 128x128x85?

Yes, that is correct.

Similarly, upsampling or resampling is the opposite interpolation method to original size 256x256x170?

Yes, correct result again. Resampling is a more general term and describes resizing an image (or other grid-based signal) using an automatic rule which could be enlarging or reducing the size.

What resampling does not mean in digital signal processing is going back to the original source and taking a second sample. That might be a reasonable interpretation of the word when coming across it for the first time, but it is not correct here.

Just saying that a signal is resampled does not give enough information to say exactly what was done numerically to the signal, because it does not specify the rule of what happens with the lost (in case of downsampling) or missing (in case of upsampling) information. There are a few different ways to perform the resize, and different kinds of interpolation. It looks like the paper does give more information here, but you may need to read more or inspect the authors' code to be certain - for instance "nearest neighbour interpolation" probably involves looking at values of the six adjacent voxels to each new one you create, and taking the mean value of the ones that exist in the original grid (some will not, they will be other new cells), but there are a few different ways to manage that process.

• @Neuk Slater, they use: dx = 2 dy=2 dz=2 L = L[::dx, ::dy, ::dz] I = I[::dx, ::dy, ::dz]  to downsample the Image(I) and Label(L). But resampling back changes the label values. I am finding it hard to print the codes here. May 31 at 22:03
• Moreover, in section 2.2 second paragraph, "...the 3D FCN is trained on images of the lowest resolution in order to capture the largest amount of context, downsampled with a factor of ds1 = 2S and optimized using the Dice loss L1... In the next level, we use the predicted segmentation maps as a second input channel to the 3D FCN while learning from the images at a higher resolution, downsampled by a factor of ds2 =ds1 /2, and optimized using Dice loss L2." What does it mean by downsampling again by ds2? Shouldn't they upsample prediction by 2 or to original size of high-resolution patch? Jun 1 at 22:15
• @banikr I am not sure of the answers to your follow-up questions, and don't think they would fit in a comment anyway. Could you please ask a new question on the site. You could link this one to help explain what you have already understood. Jun 2 at 6:52
• Thanks will do that. Jun 2 at 20:24
• Check the post: ai.stackexchange.com/questions/28067/… @Neil Slater Jun 2 at 20:58