Skip to content

Commit 0f13342

Browse files
committed
chore(coordinates): replace magic numbers with TILE_SIZE
1 parent a59175c commit 0f13342

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/osm_ai_helper/utils/inference.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ def split_area_into_lat_lon_centers(
4444
lat_lon_centers = []
4545
for col in range(left + margin, right + 1, (margin * 2) + 1):
4646
for row in range(top + margin, bottom + 1, (margin * 2) + 1):
47-
pixel_col_center = (col * 512) + 256
48-
pixel_row_center = (row * 512) + 256
47+
pixel_col_center = (col * TILE_SIZE) + TILE_SIZE / 2
48+
pixel_row_center = (row * TILE_SIZE) + TILE_SIZE / 2
4949
meters_col_center, meters_row_center = pixel_col_row_to_meters_col_row(
5050
pixel_col_center, pixel_row_center, zoom
5151
)
@@ -188,8 +188,8 @@ def predict_tile_batch(
188188
if bbox_pad > 0:
189189
bbox_int[0] = max(0, bbox_int[0] - bbox_pad)
190190
bbox_int[1] = max(0, bbox_int[1] - bbox_pad)
191-
bbox_int[2] = min(512, bbox_int[2] + bbox_pad)
192-
bbox_int[3] = min(512, bbox_int[3] + bbox_pad)
191+
bbox_int[2] = min(TILE_SIZE, bbox_int[2] + bbox_pad)
192+
bbox_int[3] = min(TILE_SIZE, bbox_int[3] + bbox_pad)
193193

194194
masks, *_ = sam_predictor.predict(
195195
box=[bbox_int],

0 commit comments

Comments
 (0)