Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a function to extract image patches in PyTorch?

Given a batch of images, I'd like to extract all possible image patches, similar to a convolution. In TensorFlow, we can use tf.extract_image_patches to achieve this. Is there an equivalent function in PyTorch?

Thank you.

like image 409
Gabriel Bianconi Avatar asked Aug 22 '17 23:08

Gabriel Bianconi


1 Answers

Unfortunately, there might not be a direct way to achieve your goal.
But Tensor.unfold function might be a solution.
https://discuss.pytorch.org/t/how-to-extract-smaller-image-patches-3d/16837/2
This website might help you.

like image 118
gasoon Avatar answered Nov 06 '22 04:11

gasoon