Skip to content

Commit 80aee30

Browse files
author
Natalia Gimelshein
committed
cast croppint args to ints, fix bottleneck params
1 parent 0324719 commit 80aee30

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

imagenet/resnet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ def _make_layer(self, block, planes, blocks, stride=1):
114114

115115
layers = []
116116
layers.append(block(self.inplanes, planes, stride, downsample))
117-
self.inplanes = planes * block.expansion
117+
self.inplanes = planes * block.expansion
118118
for i in range(1, blocks):
119-
layers.append(block(planes, planes))
119+
layers.append(block(self.inplanes, planes))
120120

121121
return nn.Sequential(*layers)
122122

imagenet/transforms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def __init__(self, size):
5757

5858
def __call__(self, img):
5959
w, h = img.size
60-
x1 = round((w - self.size) / 2)
61-
y1 = round((h - self.size) / 2)
60+
x1 = int(round((w - self.size) / 2))
61+
y1 = int(round((h - self.size) / 2))
6262
return img.crop((x1, y1, x1 + self.size, y1 + self.size))
6363

6464

@@ -101,8 +101,8 @@ def __call__(self, img):
101101
target_area = random.uniform(0.08, 1.0) * area
102102
aspect_ratio = random.uniform(3 / 4, 4 / 3)
103103

104-
w = round(math.sqrt(target_area * aspect_ratio))
105-
h = round(math.sqrt(target_area / aspect_ratio))
104+
w = int(round(math.sqrt(target_area * aspect_ratio)))
105+
h = int(round(math.sqrt(target_area / aspect_ratio)))
106106

107107
if random.random() < 0.5:
108108
w, h = h, w

0 commit comments

Comments
 (0)