Closed mayishazn closed 2 years ago
Here I copy the notebook for your convenience. Maybe I overlooked something. You can change the path folder to anything appropriate:
import numpy as np import time, os, sys from urllib.parse import urlparse import skimage.io import matplotlib.pyplot as plt import matplotlib as mpl %matplotlib inline mpl.rcParams['figure.dpi'] = 300 from cellpose import utils from cellpose import plot
import re
def list_files(dir): r = [] all_data = list() for root, dirs, files in os.walk(dir): for name in files: if name.endswith('.tif'): r0=os.path.join(root,name) r.append(r0) all_data.append(skimage.io.imread(r0, as_gray=True)) return all_data, r
folders = 'C:/Users/mayis/Documents/2DCells/11062020week4/32X'
diam = 50 minarea = 100 imgs, names = list_files(folders) nimg = len(imgs)
from cellpose import models, io
model = models.Cellpose(gpu=False, model_type='cyto') channels = [0,0] # IF YOU HAVE GRAYSCALE
masks, flows, styles, diams = model.eval(imgs, diameter=diam, channels=channels, do_3D=False, min_size=minarea,... resample=True)
io.masks_flows_to_seg(imgs, masks, flows, diams, names, channels)
for file in names: name = re.sub('.tif$','_seg.npy',file) dat = np.load(name, fix_imports=True,allow_pickle=True).item()
from scipy.io import savemat
name = re.sub('npy$', 'mat', name)
savemat(name, dat)
can you please try the latest version of cellpose? pip install cellpose --upgrade
; I think this is fixed. also to show messages see the readme for details, the logging messages are no longer on by default. if the upgrade doesn't work let me know and I'll reopen the issue
Hi! I'm trying to run cellpose2 for the first time and having the same issue while trying to use the model zoo:
2022-04-21 11:52:26,013 [INFO] >> LC4 << model set to be used
2022-04-21 11:52:26,014 [INFO] >>>> using CPU
2022-04-21 11:52:26,174 [INFO] >>>> model diam_mean = 30.000 (ROIs rescaled to this size during training)
NET ERROR: expected dtype object, got 'numpy.dtype[float64]'
I've tried updating using the pip install cellpose --upgrade
but it's still happening. Any help is appreciated!
Thanks!
Hello,
Thank you for creating this useful tool! I do have a new issue- I have run this same notebook several times successfully. Lately, I tried it on two different computers. The first finishes running but there is no output, no progress bar, nothing new in the folders it should save to. The second outputs an error about dtype objects. Any help is appreciated!
Here is the notebook:
And here is the error:
TypeError Traceback (most recent call last)