fffiloni commited on
Commit
c36084d
·
1 Parent(s): 8d34a40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -68,7 +68,7 @@ def warpImage(im, vx, vy, cast_uint8=True):
68
  function to warp images with different dimensions
69
  '''
70
  print(f"WARP IM INPUT SHAPE: {im.shape}")
71
- im.reshape([3, 520, 960]))
72
  height2, width2, nChannels = im.shape
73
  print(f"WARP vx INPUT SHAPE: {vx.shape}")
74
  height1, width1 = vx.shape
@@ -104,8 +104,8 @@ def warpImage(im, vx, vy, cast_uint8=True):
104
 
105
  def get_warp_res(fname_image, fname_flow, fname_output='warped.png'):
106
  print(f"FNAME IMAGE: {fname_image}")
107
- #im2 = imread(fname_image)
108
- im2 = fname_image
109
  print(f"FNAME IMAGE READED: {im2}")
110
  flow = fname_flow.cpu().detach().numpy()
111
  im_warped, _ = warpImage(im2, flow[:, :, 0], flow[:, :, 1])
@@ -212,11 +212,11 @@ def infer():
212
 
213
  # convert the tensor to PIL image using above transform
214
  img = transform(frames[100])
215
-
216
  # display the PIL image
217
  #img.show()
218
  img.save('frame_input.jpg')
219
- res = get_warp_res(frames[100], predicted_flow, fname_output='warped.png')
220
  #print(res)
221
  return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg'
222
  ####################################
 
68
  function to warp images with different dimensions
69
  '''
70
  print(f"WARP IM INPUT SHAPE: {im.shape}")
71
+
72
  height2, width2, nChannels = im.shape
73
  print(f"WARP vx INPUT SHAPE: {vx.shape}")
74
  height1, width1 = vx.shape
 
104
 
105
  def get_warp_res(fname_image, fname_flow, fname_output='warped.png'):
106
  print(f"FNAME IMAGE: {fname_image}")
107
+ im2 = imread(fname_image)
108
+ #im2 = fname_image
109
  print(f"FNAME IMAGE READED: {im2}")
110
  flow = fname_flow.cpu().detach().numpy()
111
  im_warped, _ = warpImage(im2, flow[:, :, 0], flow[:, :, 1])
 
212
 
213
  # convert the tensor to PIL image using above transform
214
  img = transform(frames[100])
215
+ img = img.resize((520, 960))
216
  # display the PIL image
217
  #img.show()
218
  img.save('frame_input.jpg')
219
+ res = get_warp_res('frame_input.jpg', predicted_flow, fname_output='warped.png')
220
  #print(res)
221
  return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg'
222
  ####################################