Closed zzfoutofspace closed 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.
That makes sense. I didn't realize that it's for padding using "valid" way in the very beginning. Thanks for answering!
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.