Skip to content

Commit

Permalink
remove poisson_blend_old
Browse files Browse the repository at this point in the history
  • Loading branch information
otenim committed May 14, 2020
1 parent 47240c0 commit 71870a1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 119 deletions.
87 changes: 0 additions & 87 deletions poissonblending.py

This file was deleted.

32 changes: 0 additions & 32 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import torchvision.transforms as transforms
import numpy as np
import cv2
from poissonblending import blend


def gen_input_mask(
Expand Down Expand Up @@ -164,34 +163,3 @@ def poisson_blend(input, output, mask):
ret.append(out)
ret = torch.cat(ret, dim=0)
return ret


def poisson_blend_old(input, output, mask):
"""
* inputs:
- input (torch.Tensor, required)
Input tensor of Completion Network, whose shape = (N, 3, H, W).
- output (torch.Tensor, required)
Output tensor of Completion Network, whose shape = (N, 3, H, W).
- mask (torch.Tensor, required)
Input mask tensor of Completion Network, whose shape = (N, 1, H, W).
* returns:
Output image tensor of shape (N, 3, H, W) inpainted with poisson image editing method.
"""
num_samples = input.shape[0]
ret = []

# convert torch array to numpy array followed by
# converting 'channel first' format to 'channel last' format.
input_np = np.transpose(np.copy(input.cpu().numpy()), axes=(0, 2, 3, 1))
output_np = np.transpose(np.copy(output.cpu().numpy()), axes=(0, 2, 3, 1))
mask_np = np.transpose(np.copy(mask.cpu().numpy()), axes=(0, 2, 3, 1))

# apply poisson image editing method for each input/output image and mask.
for i in range(num_samples):
inpainted_np = blend(input_np[i], output_np[i], mask_np[i])
inpainted = torch.from_numpy(np.transpose(inpainted_np, axes=(2, 0, 1)))
inpainted = torch.unsqueeze(inpainted, dim=0)
ret.append(inpainted)
ret = torch.cat(ret, dim=0)
return ret

0 comments on commit 71870a1

Please sign in to comment.