diff --git a/cellpose/core.py b/cellpose/core.py index 1d36891c..0505f464 100644 --- a/cellpose/core.py +++ b/cellpose/core.py @@ -247,9 +247,9 @@ def run_net(net, imgi, batch_size=8, augment=False, tile_overlap=0.1, bsize=224, y = np.reshape(y, (-1, 3, ly, lx)) yfi = transforms.average_tiles(y, ysub, xsub, Lyt, Lxt) yf[b] = yfi[:, :imgb.shape[-2], :imgb.shape[-1]] - stylei = stylea[i * ntiles:(i + 1) * ntiles].sum(axis=0) - stylei /= (stylei**2).sum()**0.5 - styles[b] = stylei + # stylei = stylea[i * ntiles:(i + 1) * ntiles].sum(axis=0) + # stylei /= (stylei**2).sum()**0.5 + # styles[b] = stylei # slices from padding yf = yf[:, :, ypad1 : Ly-ypad2, xpad1 : Lx-xpad2] yf = yf.transpose(0,2,3,1) diff --git a/cellpose/vit_sam.py b/cellpose/vit_sam.py index 32c2267d..7e82bd18 100644 --- a/cellpose/vit_sam.py +++ b/cellpose/vit_sam.py @@ -50,6 +50,8 @@ def __init__(self, backbone="vit_l", ps=8, nout=3, bsize=256, rdrop=0.4, blk.window_size = 0 self.dtype = dtype + if self.dtype != torch.float32: + self = self.to(self.dtype) def forward(self, x): # same progression as SAM until readout