Spaces:
Running
Running
dont create pool with message flow
Browse files- modules/eval.py +3 -2
- modules/toXML.py +1 -3
modules/eval.py
CHANGED
@@ -240,7 +240,6 @@ def regroup_elements_by_pool(boxes, labels, scores, keypoints, class_dict, iou_t
|
|
240 |
|
241 |
if elements_not_in_pool:
|
242 |
elements_not_in_pool_to_delete = []
|
243 |
-
new_pool_index = len(labels)
|
244 |
labels = np.append(labels, list(class_dict.values()).index('pool'))
|
245 |
#find the messageflow,pool and lane in the elements_not_in_pool
|
246 |
for i in elements_not_in_pool:
|
@@ -248,7 +247,9 @@ def regroup_elements_by_pool(boxes, labels, scores, keypoints, class_dict, iou_t
|
|
248 |
elements_not_in_pool_to_delete.append(i)
|
249 |
#delete the messageflow from the elements_not_in_pool
|
250 |
elements_not_in_pool = [i for i in elements_not_in_pool if i not in elements_not_in_pool_to_delete]
|
251 |
-
|
|
|
|
|
252 |
|
253 |
# Separate empty pools
|
254 |
non_empty_pools = {k: v for k, v in pool_dict.items() if v}
|
|
|
240 |
|
241 |
if elements_not_in_pool:
|
242 |
elements_not_in_pool_to_delete = []
|
|
|
243 |
labels = np.append(labels, list(class_dict.values()).index('pool'))
|
244 |
#find the messageflow,pool and lane in the elements_not_in_pool
|
245 |
for i in elements_not_in_pool:
|
|
|
247 |
elements_not_in_pool_to_delete.append(i)
|
248 |
#delete the messageflow from the elements_not_in_pool
|
249 |
elements_not_in_pool = [i for i in elements_not_in_pool if i not in elements_not_in_pool_to_delete]
|
250 |
+
if len(elements_not_in_pool) > 0:
|
251 |
+
new_pool_index = len(labels)
|
252 |
+
pool_dict[new_pool_index] = elements_not_in_pool
|
253 |
|
254 |
# Separate empty pools
|
255 |
non_empty_pools = {k: v for k, v in pool_dict.items() if v}
|
modules/toXML.py
CHANGED
@@ -86,8 +86,6 @@ def align_boxes(pred, size):
|
|
86 |
else:
|
87 |
if pool_index >= len(modified_pred['boxes']):
|
88 |
print("Problem with the index")
|
89 |
-
#delete the pool
|
90 |
-
modified_pred['pool_dict'].pop(pool_index)
|
91 |
continue
|
92 |
min_x, min_y, max_x, max_y = modified_pred['boxes'][pool_index]
|
93 |
pool_width = max_x - min_x
|
@@ -97,7 +95,7 @@ def align_boxes(pred, size):
|
|
97 |
continue
|
98 |
if pool_index >= len(modified_pred['boxes']):
|
99 |
new_box = np.array([min_x - 50, min_y - 50, min_x + pool_width + 50, min_y + pool_height + 50])
|
100 |
-
modified_pred['boxes'] = np.append(modified_pred['boxes'],
|
101 |
else:
|
102 |
modified_pred['boxes'][pool_index] = [min_x -50, min_y-50, min_x+pool_width+50, min_y+pool_height+50]
|
103 |
|
|
|
86 |
else:
|
87 |
if pool_index >= len(modified_pred['boxes']):
|
88 |
print("Problem with the index")
|
|
|
|
|
89 |
continue
|
90 |
min_x, min_y, max_x, max_y = modified_pred['boxes'][pool_index]
|
91 |
pool_width = max_x - min_x
|
|
|
95 |
continue
|
96 |
if pool_index >= len(modified_pred['boxes']):
|
97 |
new_box = np.array([min_x - 50, min_y - 50, min_x + pool_width + 50, min_y + pool_height + 50])
|
98 |
+
modified_pred['boxes'] = np.append(modified_pred['boxes'], new_box, axis=0)
|
99 |
else:
|
100 |
modified_pred['boxes'][pool_index] = [min_x -50, min_y-50, min_x+pool_width+50, min_y+pool_height+50]
|
101 |
|