deploy: 8168d837ad161f5d6ab58bf87bf756360d21714e
Browse files- README.md +1 -1
- layout_overlap.py +7 -1
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: Layout
|
| 3 |
emoji: π
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: purple
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Layout Overlap
|
| 3 |
emoji: π
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: purple
|
layout_overlap.py
CHANGED
|
@@ -118,18 +118,21 @@ class LayoutOverlap(evaluate.Metric):
|
|
| 118 |
self,
|
| 119 |
score_ac_layout_gan: npt.NDArray[np.float64],
|
| 120 |
batch_mask: npt.NDArray[np.bool_],
|
| 121 |
-
):
|
|
|
|
| 122 |
# shape: (B, S) -> (B,)
|
| 123 |
batch_mask = batch_mask.sum(axis=1)
|
| 124 |
|
| 125 |
# shape: (B,)
|
| 126 |
score_normalized = score_ac_layout_gan / batch_mask
|
| 127 |
score_normalized[np.isnan(score_normalized)] = 0.0
|
|
|
|
| 128 |
return score_normalized
|
| 129 |
|
| 130 |
def _compute_layout_gan(
|
| 131 |
self, S: int, B: int, ai: npt.NDArray[np.float64]
|
| 132 |
) -> npt.NDArray[np.float64]:
|
|
|
|
| 133 |
indices = np.arange(S)
|
| 134 |
ii, jj = np.meshgrid(indices, indices, indexing="ij")
|
| 135 |
|
|
@@ -154,6 +157,9 @@ class LayoutOverlap(evaluate.Metric):
|
|
| 154 |
# shape: (B, model_max_length)
|
| 155 |
batch_mask = np.array(batch_mask)
|
| 156 |
|
|
|
|
|
|
|
|
|
|
| 157 |
# S: model_max_length
|
| 158 |
B, S, C = batch_bbox.shape
|
| 159 |
|
|
|
|
| 118 |
self,
|
| 119 |
score_ac_layout_gan: npt.NDArray[np.float64],
|
| 120 |
batch_mask: npt.NDArray[np.bool_],
|
| 121 |
+
) -> npt.NDArray[np.float64]:
|
| 122 |
+
|
| 123 |
# shape: (B, S) -> (B,)
|
| 124 |
batch_mask = batch_mask.sum(axis=1)
|
| 125 |
|
| 126 |
# shape: (B,)
|
| 127 |
score_normalized = score_ac_layout_gan / batch_mask
|
| 128 |
score_normalized[np.isnan(score_normalized)] = 0.0
|
| 129 |
+
|
| 130 |
return score_normalized
|
| 131 |
|
| 132 |
def _compute_layout_gan(
|
| 133 |
self, S: int, B: int, ai: npt.NDArray[np.float64]
|
| 134 |
) -> npt.NDArray[np.float64]:
|
| 135 |
+
|
| 136 |
indices = np.arange(S)
|
| 137 |
ii, jj = np.meshgrid(indices, indices, indexing="ij")
|
| 138 |
|
|
|
|
| 157 |
# shape: (B, model_max_length)
|
| 158 |
batch_mask = np.array(batch_mask)
|
| 159 |
|
| 160 |
+
assert batch_bbox.ndim == 3
|
| 161 |
+
assert batch_mask.ndim == 2
|
| 162 |
+
|
| 163 |
# S: model_max_length
|
| 164 |
B, S, C = batch_bbox.shape
|
| 165 |
|