Skip to content

Commit

Permalink
Specify unbiased shape while picking coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
lmanan committed Sep 30, 2023
1 parent cc0964f commit b1ce717
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cellulus/criterions/oce_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ def forward(self, prediction):
if self.num_spatial_dims == 2:
b, c, h, w = prediction.shape

num_anchors = int(self.density * h * w)
h_ = h - 2 * self.kappa # unbiased height
w_ = w - 2 * self.kappa # unbiased width

num_anchors = int(self.density * h_ * w_)
anchor_coordinates_y = np.random.randint(
self.kappa, h - self.kappa, num_anchors
)
Expand All @@ -46,7 +49,12 @@ def forward(self, prediction):
) # N x 2
elif self.num_spatial_dims == 3:
b, c, d, h, w = prediction.shape
num_anchors = int(self.density * d * h * w)

d_ = d - 2 * self.kappa # unbiased depth
h_ = h - 2 * self.kappa # unbiased height
w_ = w - 2 * self.kappa # unbiased width

num_anchors = int(self.density * d_ * h_ * w_)
anchor_coordinates_z = np.random.randint(
self.kappa, d - self.kappa, num_anchors
)
Expand Down

0 comments on commit b1ce717

Please sign in to comment.