Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions mindediting/dataset/src/vimeo_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,21 @@ def imresizemex(inimg, weights, indices, dim):
out_shape[dim] = w_shape[0]
outimg = np.zeros(out_shape)
if dim == 0:
index = 1
slice_start, slice_end = indice, i_img
outimg_start, outimg_end = i_w, i_img
for i_img in range(in_shape[1]):
for i_w in range(w_shape[0]):
w = weights[i_w, :]
indice = indices[i_w, :]
im_slice = inimg[indice, i_img].astype(np.float64)
ind = indices[i_w, :]
im_slice = inimg[ind, i_img].astype(np.float64)
mult = np.multiply(np.squeeze(im_slice, axis=0), w.T)
outimg[i_w, i_img] = np.sum(mult, axis=0)
elif dim == 1:
index = 0
slice_start, slice_end = i_img, indice
outimg_start, outimg_end = i_img, i_w

for i_img in range(in_shape[index]):
for i_w in range(w_shape[0]):
w = weights[i_w, :]
indice = indices[i_w, :]
im_slice = inimg[slice_start, slice_end].astype(np.float64)
mult = np.multiply(np.squeeze(im_slice, axis=0), w.T)
outimg[outimg_start, outimg_end] = np.sum(mult, axis=0)
for i_img in range(in_shape[0]):
for i_w in range(w_shape[0]):
w = weights[i_w, :]
ind = indices[i_w, :]
im_slice = inimg[i_img, ind].astype(np.float64)
mult = np.multiply(np.squeeze(im_slice, axis=0), w.T)
outimg[i_img, i_w] = np.sum(mult, axis=0)

if inimg.dtype == np.uint8:
outimg = np.clip(outimg, 0, 255)
Expand Down
25 changes: 9 additions & 16 deletions mindediting/deploy/data_io/srdiff_sr/utils_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,21 @@ def imresizemex(inimg, weights, indices, dim):
out_shape[dim] = w_shape[0]
outimg = np.zeros(out_shape)
if dim == 0:
index = 1
slice_start, slice_end = indice, i_img
outimg_start, outimg_end = i_w, i_img
for i_img in range(in_shape[1]):
for i_w in range(w_shape[0]):
w = weights[i_w, :]
indice = indices[i_w, :]
im_slice = inimg[indice, i_img].astype(np.float64)
ind = indices[i_w, :]
im_slice = inimg[ind, i_img].astype(np.float64)
mult = np.multiply(np.squeeze(im_slice, axis=0), w.T)
outimg[i_w, i_img] = np.sum(mult, axis=0)
elif dim == 1:
index = 0
slice_start, slice_end = i_img, indice
outimg_start, outimg_end = i_img, i_w

for i_img in range(in_shape[index]):
for i_w in range(w_shape[0]):
w = weights[i_w, :]
indice = indices[i_w, :]
im_slice = inimg[slice_start, slice_end].astype(np.float64)
mult = np.multiply(np.squeeze(im_slice, axis=0), w.T)
outimg[outimg_start, outimg_end] = np.sum(mult, axis=0)
for i_img in range(in_shape[0]):
for i_w in range(w_shape[0]):
w = weights[i_w, :]
ind = indices[i_w, :]
im_slice = inimg[i_img, ind].astype(np.float64)
mult = np.multiply(np.squeeze(im_slice, axis=0), w.T)
outimg[i_img, i_w] = np.sum(mult, axis=0)

if inimg.dtype == np.uint8:
outimg = np.clip(outimg, 0, 255)
Expand Down