Skip to content

cast cropping args to ints, fix bottleneck params #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions imagenet/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ def _make_layer(self, block, planes, blocks, stride=1):

layers = []
layers.append(block(self.inplanes, planes, stride, downsample))
self.inplanes = planes * block.expansion
self.inplanes = planes * block.expansion
for i in range(1, blocks):
layers.append(block(planes, planes))
layers.append(block(self.inplanes, planes))

return nn.Sequential(*layers)

Expand Down
8 changes: 4 additions & 4 deletions imagenet/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def __init__(self, size):

def __call__(self, img):
w, h = img.size
x1 = round((w - self.size) / 2)
y1 = round((h - self.size) / 2)
x1 = int(round((w - self.size) / 2))
y1 = int(round((h - self.size) / 2))
return img.crop((x1, y1, x1 + self.size, y1 + self.size))


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

w = round(math.sqrt(target_area * aspect_ratio))
h = round(math.sqrt(target_area / aspect_ratio))
w = int(round(math.sqrt(target_area * aspect_ratio)))
h = int(round(math.sqrt(target_area / aspect_ratio)))

if random.random() < 0.5:
w, h = h, w
Expand Down