Spaces:
Runtime error
Runtime error
vahidrezanezhad
commited on
Commit
•
533cad9
1
Parent(s):
6f5ee08
Update app.py
Browse files
app.py
CHANGED
@@ -38,12 +38,18 @@ def visualize_model_output(prediction, img):
|
|
38 |
output[:,:,1][prediction[:,:,0]==unq_class] = rgb_class_unique[1]
|
39 |
output[:,:,2][prediction[:,:,0]==unq_class] = rgb_class_unique[2]
|
40 |
|
41 |
-
output = output.astype(np.
|
42 |
-
img = img.astype(np.
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
|
49 |
def do_prediction(model_name, img):
|
|
|
38 |
output[:,:,1][prediction[:,:,0]==unq_class] = rgb_class_unique[1]
|
39 |
output[:,:,2][prediction[:,:,0]==unq_class] = rgb_class_unique[2]
|
40 |
|
41 |
+
output = output.astype(np.int8)
|
42 |
+
img = img.astype(np.int8)
|
43 |
+
|
44 |
+
bg_img = img.copy()
|
45 |
+
shapes = np.zeros_like(img, np.uint8)
|
46 |
+
shapes = output
|
47 |
+
mask = shapes.astype(bool)
|
48 |
+
alpha = 0.2
|
49 |
+
bg_img[mask] = cv2.addWeighted(bg_img, 1 - alpha, shapes, alpha, 0)[mask]
|
50 |
+
|
51 |
+
|
52 |
+
return bg_img
|
53 |
|
54 |
|
55 |
def do_prediction(model_name, img):
|