@@ -222,6 +222,7 @@ def unflatten(t):
222
222
normalized_X_nearest_clusters = unflatten (normalized_X_nearest_clusters )
223
223
#Y_nearest_clusters = torch.permute(Y_nearest_clusters.view(concat_features.shape[0],concat_features.shape[2],concat_features.shape[3],1),(0,3,1,2))
224
224
#X_nearest_clusters = torch.permute(X_nearest_clusters.view(concat_features.shape[0],concat_features.shape[2],concat_features.shape[3],1),(0,3,1,2))
225
+ p46 ()
225
226
Ymin = (self .Y - 2 * self .S ).clamp (0 ,None )
226
227
Ymax = (self .Y + 2 * self .S ).clamp (None ,self .image_height )
227
228
@@ -305,11 +306,19 @@ def assignment(self):
305
306
#------------------------------------------------------
306
307
cluster_y ,cluster_x = (self .image_height - 1 )* (cluster [0 ]* self .norm_spat_std [0 ]),(self .image_width - 1 )* (cluster [1 ]* self .norm_spat_std [1 ])
307
308
308
- top = (self .image_height - 1 )* (cluster [0 ]* self .norm_spat_std [0 ]) - 2 * self .S
309
- bottom = (self .image_height - 1 )* (cluster [0 ] * self .norm_spat_std [0 ]) + 2 * self .S
310
- left = (self .image_width - 1 )* (cluster [1 ] * self .norm_spat_std [1 ])- 2 * self .S
311
- right = (self .image_width - 1 )* (cluster [1 ]* self .norm_spat_std [1 ]) + 2 * self .S
309
+ #TODO: should this not be self.S//2
310
+ #...................................
311
+ #half_window_height = 2 * self.S
312
+ #half_window_width = 2 * self.S
313
+ half_window_height = self .S / 2
314
+ half_window_width = self .S / 2
315
+ #...................................
316
+ top = (self .image_height - 1 )* (cluster [0 ]* self .norm_spat_std [0 ]) - half_window_height
317
+ bottom = (self .image_height - 1 )* (cluster [0 ] * self .norm_spat_std [0 ]) + half_window_height
318
+ left = (self .image_width - 1 )* (cluster [1 ] * self .norm_spat_std [1 ])- half_window_width
319
+ right = (self .image_width - 1 )* (cluster [1 ]* self .norm_spat_std [1 ]) + half_window_width
312
320
top = max ( top ,0 )
321
+ #TODO: image_height - 1?
313
322
bottom = min (bottom ,self .image_height )
314
323
left = max (left ,0 )
315
324
right = min (right ,self .image_width )
0 commit comments