Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions deepprofiler/imaging/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ def get_cropping_regions(batch, config, box_size):
boxes[:,1] = locations[X_KEY] - box_size/2
boxes[:,2] = locations[Y_KEY] + box_size/2
boxes[:,3] = locations[X_KEY] + box_size/2
boxes[:,[0,2]] /= config["dataset"]["images"]["height"]
boxes[:,[1,3]] /= config["dataset"]["images"]["width"]

img_shape = images[index].shape
assert len(img_shape) == 3, f"Images should be 3D arrays, got {img_shape=}"
height, width, _ = img_shape
boxes[:,[0,2]] /= height
boxes[:,[1,3]] /= width
# Create indicators for this set of boxes, belonging to the same image
box_ind = index * np.ones((len(locations)), np.int32)
# Propagate the same labels to all crops
Expand Down