Skip to content

Commit 3864748

Browse files
bug in augment=True cropping when image < 224x224 !!
1 parent 9854949 commit 3864748

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cellpose/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def run_net(net, imgi, batch_size=8, augment=False, tile_overlap=0.1, bsize=224,
251251
# pad image for net so Ly and Lx are divisible by 4
252252
imgb = transforms.resize_image(imgi[b], rsz=rsz) if rsz is not None else imgi[b].copy()
253253
imgb = np.pad(imgb.transpose(2,0,1), pads, mode="constant")
254-
IMG, ysub, xsub, Ly, Lx = transforms.make_tiles(
254+
IMG, ysub, xsub, Lyt, Lxt = transforms.make_tiles(
255255
imgb, bsize=bsize, augment=augment,
256256
tile_overlap=tile_overlap)
257257
IMGa[i * ntiles : (i+1) * ntiles] = np.reshape(IMG,
@@ -268,7 +268,7 @@ def run_net(net, imgi, batch_size=8, augment=False, tile_overlap=0.1, bsize=224,
268268
y = np.reshape(y, (ny, nx, 3, ly, lx))
269269
y = transforms.unaugment_tiles(y)
270270
y = np.reshape(y, (-1, 3, ly, lx))
271-
yfi = transforms.average_tiles(y, ysub, xsub, Ly, Lx)
271+
yfi = transforms.average_tiles(y, ysub, xsub, Lyt, Lxt)
272272
yf[b] = yfi[:, :imgb.shape[-2], :imgb.shape[-1]]
273273
stylei = stylea[i * ntiles:(i + 1) * ntiles].sum(axis=0)
274274
stylei /= (stylei**2).sum()**0.5

0 commit comments

Comments
 (0)