Update app.py
Browse files
app.py
CHANGED
@@ -103,7 +103,8 @@ def warpImage(im, vx, vy, cast_uint8=True):
|
|
103 |
|
104 |
def get_warp_res(fname_image, fname_flow, fname_output='warped.png'):
|
105 |
print(f"FNAME IMAGE: {fname_image}")
|
106 |
-
im2 = imread(fname_image)
|
|
|
107 |
print(f"FNAME IMAGE READED: {im2}")
|
108 |
flow = fname_flow.cpu().detach().numpy()
|
109 |
im_warped, _ = warpImage(im2, flow[:, :, 0], flow[:, :, 1])
|
@@ -203,18 +204,18 @@ def infer():
|
|
203 |
flo_file = write_flo(predicted_flow, "flofile.flo")
|
204 |
#write_jpeg(frames[100], f"input_image.jpg")
|
205 |
#res = warp_image(img1_batch, predicted_flow)
|
206 |
-
|
207 |
|
208 |
# define a transform to convert a tensor to PIL image
|
209 |
transform = T.ToPILImage()
|
210 |
|
211 |
# convert the tensor to PIL image using above transform
|
212 |
-
img = transform(
|
213 |
|
214 |
# display the PIL image
|
215 |
#img.show()
|
216 |
img.save('frame_input.jpg')
|
217 |
-
res = get_warp_res(
|
218 |
#print(res)
|
219 |
return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg'
|
220 |
####################################
|
|
|
103 |
|
104 |
def get_warp_res(fname_image, fname_flow, fname_output='warped.png'):
|
105 |
print(f"FNAME IMAGE: {fname_image}")
|
106 |
+
#im2 = imread(fname_image)
|
107 |
+
im2 = fname_image
|
108 |
print(f"FNAME IMAGE READED: {im2}")
|
109 |
flow = fname_flow.cpu().detach().numpy()
|
110 |
im_warped, _ = warpImage(im2, flow[:, :, 0], flow[:, :, 1])
|
|
|
204 |
flo_file = write_flo(predicted_flow, "flofile.flo")
|
205 |
#write_jpeg(frames[100], f"input_image.jpg")
|
206 |
#res = warp_image(img1_batch, predicted_flow)
|
207 |
+
|
208 |
|
209 |
# define a transform to convert a tensor to PIL image
|
210 |
transform = T.ToPILImage()
|
211 |
|
212 |
# convert the tensor to PIL image using above transform
|
213 |
+
img = transform(frame[100])
|
214 |
|
215 |
# display the PIL image
|
216 |
#img.show()
|
217 |
img.save('frame_input.jpg')
|
218 |
+
res = get_warp_res(frame[100], predicted_flow, fname_output='warped.png')
|
219 |
#print(res)
|
220 |
return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg'
|
221 |
####################################
|