![](/assets/images/project_default_logo.png)
--- yoloseg/inference_.py
+++ yoloseg/inference_.py
... | ... | @@ -20,9 +20,6 @@ |
20 | 20 |
def sigmoid(self, x): |
21 | 21 |
return 1 / (1 + np.exp(-x)) |
22 | 22 |
|
23 |
- def inverse_sigmoid(self, x): |
|
24 |
- return np.log(x/(1-x)) |
|
25 |
- |
|
26 | 23 |
def run_inference(self, input_image): |
27 | 24 |
model_input = input_image |
28 | 25 |
if self.letter_box_for_square and self.model_shape[0] == self.model_shape[1]: |
... | ... | @@ -100,6 +97,7 @@ |
100 | 97 |
x1, y1, w, h = box |
101 | 98 |
x1, y1, x2, y2 = x1, y1, x1 + w, y1 + h |
102 | 99 |
|
100 |
+ # To handle edge cases where you get bboxes that pass beyond the original image |
|
103 | 101 |
if y2 > image_shape[1]: |
104 | 102 |
h = h + image_shape[1] - h - y1 |
105 | 103 |
if x2 > image_shape[0]: |
... | ... | @@ -110,7 +108,7 @@ |
110 | 108 |
|
111 | 109 |
# Compute the linear combination of proto masks |
112 | 110 |
# for now, plural batch operation is not supported, and this is the point where you should start. |
113 |
- # instead of proto_masks[0], do some iterative operation. |
|
111 |
+ # instead of hardcoded proto_masks[0], do some iterative operation. |
|
114 | 112 |
mask = np.tensordot(coeffs, proto_masks[0], axes=[0, 0]) # Dot product along the number of prototypes |
115 | 113 |
|
116 | 114 |
# Resize mask to the bounding box size, using sigmoid to normalize |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?