Skip to content

Commit

Permalink
Don't assume regression size.
Browse files Browse the repository at this point in the history
  • Loading branch information
hgaiser committed Oct 9, 2018
1 parent 2d065c2 commit fcd6da4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions keras_retinanet/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def _smooth_l1(y_true, y_pred):
"""
# separate target and state
regression = y_pred
regression_target = y_true[:, :, :4]
anchor_state = y_true[:, :, 4]
regression_target = y_true[:, :, :-1]
anchor_state = y_true[:, :, -1]

# filter out "ignore" anchors
indices = backend.where(keras.backend.equal(anchor_state, 1))
Expand Down
2 changes: 1 addition & 1 deletion keras_retinanet/utils/anchors.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def anchor_targets_bbox(
anchors_centers = np.vstack([(anchors[:, 0] + anchors[:, 2]) / 2, (anchors[:, 1] + anchors[:, 3]) / 2]).T
indices = np.logical_or(anchors_centers[:, 0] >= image.shape[1], anchors_centers[:, 1] >= image.shape[0])

labels_batch[index, indices, -1] = - 1
labels_batch[index, indices, -1] = -1
regression_batch[index, indices, -1] = -1

return labels_batch, regression_batch
Expand Down

0 comments on commit fcd6da4

Please sign in to comment.