Spaces:
Runtime error
Runtime error
Fix RoIAlign/RoIPool output_size to always be a tuple
Browse filesThe downstream code accesses output_size[0] and output_size[1],
so normalize int inputs to (int, int) tuples.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- setup_mmcv_shim.py +4 -0
setup_mmcv_shim.py
CHANGED
|
@@ -61,6 +61,8 @@ def roi_align(input, rois, output_size, spatial_scale=1.0, sampling_ratio=-1, po
|
|
| 61 |
class RoIAlign(torch.nn.Module):
|
| 62 |
def __init__(self, output_size, spatial_scale=1.0, sampling_ratio=-1, pool_mode="avg", aligned=True, use_torchvision=False):
|
| 63 |
super().__init__()
|
|
|
|
|
|
|
| 64 |
self.output_size = output_size
|
| 65 |
self.spatial_scale = spatial_scale
|
| 66 |
self.sampling_ratio = sampling_ratio
|
|
@@ -71,6 +73,8 @@ class RoIAlign(torch.nn.Module):
|
|
| 71 |
class RoIPool(torch.nn.Module):
|
| 72 |
def __init__(self, output_size, spatial_scale=1.0):
|
| 73 |
super().__init__()
|
|
|
|
|
|
|
| 74 |
self.output_size = output_size
|
| 75 |
self.spatial_scale = spatial_scale
|
| 76 |
def forward(self, input, rois):
|
|
|
|
| 61 |
class RoIAlign(torch.nn.Module):
|
| 62 |
def __init__(self, output_size, spatial_scale=1.0, sampling_ratio=-1, pool_mode="avg", aligned=True, use_torchvision=False):
|
| 63 |
super().__init__()
|
| 64 |
+
if isinstance(output_size, int):
|
| 65 |
+
output_size = (output_size, output_size)
|
| 66 |
self.output_size = output_size
|
| 67 |
self.spatial_scale = spatial_scale
|
| 68 |
self.sampling_ratio = sampling_ratio
|
|
|
|
| 73 |
class RoIPool(torch.nn.Module):
|
| 74 |
def __init__(self, output_size, spatial_scale=1.0):
|
| 75 |
super().__init__()
|
| 76 |
+
if isinstance(output_size, int):
|
| 77 |
+
output_size = (output_size, output_size)
|
| 78 |
self.output_size = output_size
|
| 79 |
self.spatial_scale = spatial_scale
|
| 80 |
def forward(self, input, rois):
|