app
Browse files
app.py
CHANGED
@@ -73,24 +73,25 @@ def label_to_color_image(label):
|
|
73 |
def draw_plot(pred_img, seg):
|
74 |
fig = plt.figure(figsize=(20, 15))
|
75 |
|
76 |
-
grid_spec = gridspec.GridSpec(1, 2, width_ratios=[
|
77 |
|
78 |
-
plt.subplot(grid_spec[
|
79 |
-
plt.imshow(pred_img)
|
80 |
-
plt.axis('off')
|
81 |
LABEL_NAMES = np.asarray(labels_list)
|
82 |
FULL_LABEL_MAP = np.arange(len(LABEL_NAMES)).reshape(len(LABEL_NAMES), 1)
|
83 |
FULL_COLOR_MAP = label_to_color_image(FULL_LABEL_MAP)
|
84 |
|
85 |
unique_labels = np.unique(seg.numpy().astype("uint8"))
|
86 |
-
ax = plt.
|
87 |
-
plt.imshow(FULL_COLOR_MAP[unique_labels].astype(np.uint8), interpolation="nearest")
|
88 |
ax.yaxis.tick_right()
|
89 |
plt.yticks(range(len(unique_labels)), LABEL_NAMES[unique_labels])
|
90 |
plt.xticks([], [])
|
91 |
ax.tick_params(width=0.0, labelsize=25)
|
92 |
-
return fig
|
93 |
|
|
|
|
|
|
|
|
|
|
|
94 |
def sepia(input_img):
|
95 |
input_img = Image.fromarray(input_img)
|
96 |
|
|
|
73 |
def draw_plot(pred_img, seg):
|
74 |
fig = plt.figure(figsize=(20, 15))
|
75 |
|
76 |
+
grid_spec = gridspec.GridSpec(1, 2, width_ratios=[1, 6])
|
77 |
|
78 |
+
plt.subplot(grid_spec[1])
|
|
|
|
|
79 |
LABEL_NAMES = np.asarray(labels_list)
|
80 |
FULL_LABEL_MAP = np.arange(len(LABEL_NAMES)).reshape(len(LABEL_NAMES), 1)
|
81 |
FULL_COLOR_MAP = label_to_color_image(FULL_LABEL_MAP)
|
82 |
|
83 |
unique_labels = np.unique(seg.numpy().astype("uint8"))
|
84 |
+
ax = plt.imshow(FULL_COLOR_MAP[unique_labels].astype(np.uint8), interpolation="nearest")
|
|
|
85 |
ax.yaxis.tick_right()
|
86 |
plt.yticks(range(len(unique_labels)), LABEL_NAMES[unique_labels])
|
87 |
plt.xticks([], [])
|
88 |
ax.tick_params(width=0.0, labelsize=25)
|
|
|
89 |
|
90 |
+
plt.subplot(grid_spec[0])
|
91 |
+
plt.imshow(pred_img)
|
92 |
+
plt.axis('off')
|
93 |
+
|
94 |
+
return fig
|
95 |
def sepia(input_img):
|
96 |
input_img = Image.fromarray(input_img)
|
97 |
|