GImInI commited on
Commit
2a305f6
·
1 Parent(s): 9c7f1f8
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -73,23 +73,26 @@ 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=[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):
 
73
  def draw_plot(pred_img, seg):
74
  fig = plt.figure(figsize=(20, 15))
75
 
76
+ # 그리드의 구성을 변경하여 입력 상자와 출력 상자의 위치를 바꿈
77
  grid_spec = gridspec.GridSpec(1, 2, width_ratios=[1, 6])
78
 
79
+ # 출력 상자를 먼저 플로팅
80
+ ax = plt.subplot(grid_spec[1])
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.imshow(FULL_COLOR_MAP[unique_labels].astype(np.uint8), interpolation="nearest")
87
  ax.yaxis.tick_right()
88
  plt.yticks(range(len(unique_labels)), LABEL_NAMES[unique_labels])
89
  plt.xticks([], [])
90
  ax.tick_params(width=0.0, labelsize=25)
91
 
92
+ # 입력 상자를 다음으로 플로팅
93
+ ax = plt.subplot(grid_spec[0])
94
+ ax.imshow(pred_img)
95
+ ax.axis('off')
96
 
97
  return fig
98
  def sepia(input_img):