tjvandal / deepsd

DeepSD Super-resolution for Climate Downscaling in KDD 2017
https://www.kdd.org/kdd2017/papers/view/deepsd-generating-high-resolution-climate-change-projections-through-single
MIT License
88 stars 25 forks source link

The crop procedure for input labels #1

Closed zzfoutofspace closed 6 years ago

zzfoutofspace commented 6 years ago

In train.py , you cropped your training labels as belows border_size = int((sum(KERNEL_SIZES) - len(KERNEL_SIZES))/2) train_labels_cropped = train_labels[:,border_size:-border_size,border_size:-border_size,:] What's this process for? It seems this isn't mentioned in the paper.

tjvandal commented 6 years ago

The output of a CNN layer with kernel size > 1 and without padding returns a tensor with smaller width and height. For example, a three layer network with kernels 9,1,5 returns a tensor with 6 pixels on each side chopped off. During training we do not want to pad these outputs (then we'd be adding artifacts into the model). However, during test time it is preferable to return an image of the same size, and hence padding is used. So these two lines you show help capture these cases.

I can probably change the training script a bit and include this operation within the SRCNN model.

zzfoutofspace commented 6 years ago

That makes sense. I didn't realize that it's for padding using "valid" way in the very beginning. Thanks for answering!