Upload model
Browse files- modeling.py +6 -5
modeling.py
CHANGED
@@ -93,11 +93,12 @@ class BoneAgeCropModel(PreTrainedModel):
|
|
93 |
# if img_shape is provided, will provide rescaled coordinates
|
94 |
# otherwise, provide normalized [0, 1] coordinates
|
95 |
# coords format is xywh
|
96 |
-
|
97 |
-
0
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
101 |
|
102 |
x = self.normalize(x)
|
103 |
features = self.pooling(self.backbone(x))
|
|
|
93 |
# if img_shape is provided, will provide rescaled coordinates
|
94 |
# otherwise, provide normalized [0, 1] coordinates
|
95 |
# coords format is xywh
|
96 |
+
if img_shape is not None:
|
97 |
+
assert x.size(0) == img_shape.size(
|
98 |
+
0
|
99 |
+
), f"x.size(0) [{x.size(0)}] must equal img_shape.size(0) [{img_shape.size(0)}]"
|
100 |
+
# img_shape = (batch_dim, 2)
|
101 |
+
# img_shape[:, 0] = height, img_shape[:, 1] = width
|
102 |
|
103 |
x = self.normalize(x)
|
104 |
features = self.pooling(self.backbone(x))
|