chansung commited on
Commit
0b5484f
·
1 Parent(s): 9d6f58d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -211,15 +211,12 @@ def sepia(input_img):
211
  img_batch = np.expand_dims(img, axis=0)
212
  img_batch = np.transpose(img_batch, (0, 3, 1, 2))
213
 
214
- outputs = sess.run(None, {"pixel_values": img_batch})[0]
215
- logits = outputs.logits
216
-
217
- logits = tf.transpose(logits, [0, 2, 3, 1])
218
- logits = tf.image.resize(
219
- logits, input_img.size[::-1]
220
- ) # We reverse the shape of `image` because `image.size` returns width and height.
221
- seg = tf.math.argmax(logits, axis=-1)[0]
222
 
 
 
 
 
223
  color_seg = np.zeros(
224
  (seg.shape[0], seg.shape[1], 3), dtype=np.uint8
225
  ) # height, width, 3
 
211
  img_batch = np.expand_dims(img, axis=0)
212
  img_batch = np.transpose(img_batch, (0, 3, 1, 2))
213
 
214
+ logits = sess.run(None, {"pixel_values": img_batch})[0]
 
 
 
 
 
 
 
215
 
216
+ logits = np.transpose(logits, (0, 2, 3, 1))
217
+ seg = np.argmax(logits, axis=-1)[0].astype('float32')
218
+ seg = cv2.resize(seg, (640, 640))
219
+
220
  color_seg = np.zeros(
221
  (seg.shape[0], seg.shape[1], 3), dtype=np.uint8
222
  ) # height, width, 3