huawei-noah / Pretrained-IPT

Apache License 2.0
434 stars 63 forks source link

Could give more details for "forward_chop" func? #30

Closed leeynnnn closed 1 year ago

leeynnnn commented 2 years ago

Could give more details or code comments for "forward_chop" func?

what are the meanings of these variables defined in this function? such as h_cut, w_cut, x_unfold, x_hw_cut, y_hw_cut, x_h_cut, x_w_cut, y_h_cut, y_w_cut, x_h_top, x_w_top, y_h_top, y_w_top, y_unfold, ........ and so many other variables

and what are the func "cut_h" and "cut_w" used for? could you please give more details for these two functions as well? (eg, the meanings for the variables in these functions)

Thank u!

HantingChen commented 2 years ago

The reason to use the "forward_chop" func: The IPT model can only support a fixed input size (4848 for training and testing), While in image processing task, the input images have different size. Therefore, we chop these images into 4848 size and put them into the IPT model.

x_unfold is to unfold the whole images into 48*48 patches.

Since the size of images are not always divided by 48 exatcly. We should manually handle the edge patches, which is x_h_cut, x_w_cut, x_h_top, x_w_top and x_hw_cut. The cut_h and cut_w are used for handling these patches.

y*** is the output of x**.

An illustration: 无标题

leeynnnn commented 2 years ago

Thanks for your reply!

And I have another question. Is this process of "chop these images into 4848 size and put them into the IPT model" needed for both training and testing phase? And do they have the same treating process when training and testing?

HantingChen commented 2 years ago

Thanks for your reply!

And I have another question. Is this process of "chop these images into 4848 size and put them into the IPT model" needed for both training and testing phase? And do they have the same treating process when training and testing?

Only for the testing phase. In the training phase, we directly crop the images into 48*48 patches.