Skip to content

Commit b9d3842

Browse files
authored
Merge pull request #1259 from MouseLand/diam_niter_scaling
scale niter based on image scaling
2 parents 992d7b4 + 5e533b2 commit b9d3842

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cellpose/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,10 @@ def eval(self, x, batch_size=8, resample=True, channels=None, channel_axis=None,
331331
dP = self._resize_gradients(dP, to_y_size=Ly_0, to_x_size=Lx_0, to_z_size=Lz_0)
332332
cellprob = self._resize_cellprob(cellprob, to_x_size=Lx_0, to_y_size=Ly_0, to_z_size=Lz_0)
333333

334-
335334
if compute_masks:
336-
niter0 = 200
337-
niter = niter0 if niter is None or niter == 0 else niter
335+
# use user niter if specified, otherwise scale niter (200) with diameter
336+
niter_scale = 1 if image_scaling is None else image_scaling
337+
niter = int(200/niter_scale) if niter is None or niter == 0 else niter
338338
masks = self._compute_masks(x.shape, dP, cellprob, flow_threshold=flow_threshold,
339339
cellprob_threshold=cellprob_threshold, min_size=min_size,
340340
max_size_fraction=max_size_fraction, niter=niter,

0 commit comments

Comments
 (0)