question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inverse of Extract Tensor Patches

See original GitHub issue

🚀 Feature

A kornia.contrib.CombineTensorPatches module which performs the inverse of kornia.contrib.ExtractTensorPatches

Motivation

In remote sensing it’s common to work with imagery which can be relatively large in shape (e.g. 3000x3000+). Therefore during training/inference images are broken into patches. After feeding to the model, it’s necessary to combine the patches back to a single image.

Pitch

A kornia.contrib.CombineTensorPatches which performs the inverse of kornia.contrib.ExtractTensorPatches, assuming a stride of 1 the same as the window size.

Alternatives

We could implement this functionality in our own library, however we feel that it is general-purpose enough to belong in Kornia.

Additional context

I implemented something similar here although using einops and with some custom pieces for handling our data structures.

We would like to use such functionality in torchgeo, a PyTorch domain library for geospatial data - https://github.com/microsoft/torchgeo.

@adamjstewart @calebrob6

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
edgarribacommented, Sep 19, 2021

@isaaccorley feel free to give it a shoot with a PR

0reactions
edgarribacommented, Oct 3, 2021

@shijianjian can we close this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inverse of extract Image Patches for TF 2.x - gists · GitHub
Solution based on https://stackoverflow.com/a/51785735/278836. import tensorflow as tf. def extract_patches(images):. return tf.image.extract_patches(.
Read more >
tf.image.extract_patches | TensorFlow v2.11.0
This op collects patches from the input image, as if applying a convolution. All extracted patches are stacked in the depth (last) dimension ......
Read more >
Reconstructing an image after using extract_image_patches
You can reconstruct the full image by inverting all operations in image_to_patches . Code sample (plots original image and patches): import ...
Read more >
What's inverse function of tensor.unfold? - PyTorch Forums
I use unfold to extract patches from a tensor, after that, I want to reconstruct the tensor from patches. How should I do?...
Read more >
ExtractImagePatches - OpenVINO™ Documentation
Short description : The ExtractImagePatches operation collects patches from the input tensor, as if applying a convolution. All extracted patches are ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found