kongkip commited on
Commit
4240815
1 Parent(s): 42fec8f

resizing mask to original image shape

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -13,7 +13,7 @@ model = tf.keras.models.load_model("./tf_model.h5")
13
 
14
  def predict(image):
15
  img = np.array(image)
16
- shape = img.shape[:2]
17
 
18
  im = tf.image.resize(img, (128, 128))
19
  im = tf.cast(im, tf.float32) / 255.0
@@ -54,6 +54,7 @@ def predict(image):
54
  mask *= 255
55
 
56
  mask = np.array(Image.fromarray(mask).convert("L"))
 
57
 
58
  return mask
59
 
 
13
 
14
  def predict(image):
15
  img = np.array(image)
16
+ original_shape = img.shape[:2]
17
 
18
  im = tf.image.resize(img, (128, 128))
19
  im = tf.cast(im, tf.float32) / 255.0
 
54
  mask *= 255
55
 
56
  mask = np.array(Image.fromarray(mask).convert("L"))
57
+ mask = np.resize(mask, original_shape)
58
 
59
  return mask
60