ianpan commited on
Commit
0157b9c
·
verified ·
1 Parent(s): abc80a7

Upload model

Browse files
Files changed (1) hide show
  1. 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
- assert x.size(0) == img_shape.size(
97
- 0
98
- ), f"x.size(0) [{x.size(0)}] must equal img_shape.size(0) [{img_shape.size(0)}]"
99
- # img_shape = (batch_dim, 2)
100
- # img_shape[:, 0] = height, img_shape[:, 1] = width
 
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))