Dear ZeroCostDL4Mic team, Dear @Guillaume_Jacquemet
I’m testing the Cellpose - collab notebook. Running it went very smoothly. I had only two minor issues, 1) with the model folder (see at the end for more details), 2) my labels/masks images were 32-bit and it expects them to be 8/16-bit (might be worth mentioning it in the already detailed section about data )
My main question is about the prediction I got, see below:
I guess the main issue here is coming from the “incomplete annotations” of the ground truth that confused the training process? (not my annotations , just some existing ones that we try to make a “good” use of )
Another hypothesis is the input data. As I downloaded the cellpose dataset I realized that “grayscale” training images are all “green.png”. Shall I resave my 8-bit gray tif as green.png?
Thank you again for making this notebook available and for your suggestions to improve the training!
Best,
Romain
NOTE about the minor issue with model folder:
When running the step 4.2 ‘Star training’ , I got the error
** MXNET CUDA version installed and working. **
>>>> using GPU
>>>> pretrained model /root/.cellpose/models/cyto_0 is being used
>>>> during training rescaling images to fixed diameter of 30.0 pixels
NOTE: computing flows for labels (could be done before to save time)
0% 0/20 [00:00<?, ?it/s]Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.7/dist-packages/cellpose/__main__.py", line 258, in <module>
main()
File "/usr/local/lib/python3.7/dist-packages/cellpose/__main__.py", line 237, in main
batch_size=args.batch_size)
File "/usr/local/lib/python3.7/dist-packages/cellpose/models.py", line 633, in train
train_flows = dynamics.labels_to_flows(train_labels, files=train_files)
File "/usr/local/lib/python3.7/dist-packages/cellpose/dynamics.py", line 90, in labels_to_flows
veci = [masks_to_flows(labels[n][0])[0] for n in trange(nimg)]
File "/usr/local/lib/python3.7/dist-packages/cellpose/dynamics.py", line 90, in <listcomp>
veci = [masks_to_flows(labels[n][0])[0] for n in trange(nimg)]
File "/usr/local/lib/python3.7/dist-packages/cellpose/dynamics.py", line 148, in masks_to_flows
slices = scipy.ndimage.find_objects(masks)
File "/usr/local/lib/python3.7/dist-packages/scipy/ndimage/measurements.py", line 305, in find_objects
return _nd_image.find_objects(input, max_label)
TypeError: 'numpy.float32' object cannot be interpreted as an integer
0% 0/20 [00:00<?, ?it/s]
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-18-e83cc56c5829> in <module>()
43 shutil.rmtree(model_path+'/'+model_name)
44
---> 45 destination = shutil.copytree(Saving_path+"/train_folder/models", model_path+"/"+model_name)
46
47 # Displaying the time elapsed for training
/usr/lib/python3.7/shutil.py in copytree(src, dst, symlinks, ignore, copy_function, ignore_dangling_symlinks)
316
317 """
--> 318 names = os.listdir(src)
319 if ignore is not None:
320 ignored_names = ignore(src, names)
FileNotFoundError: [Errno 2] No such file or directory: '/content/first_test/train_folder/models'
After entering into the cell of the step 4.2, I had a look to
destination = shutil.copytree(Saving_path+"/train_folder/models", model_path+"/"+model_name)
before going to the cell at step 4 ‘Create the model and dataset objects’ and I added 2 lines :
model_folder = train_folder+"/models"
os.makedirs(model_folder)`
After this modification training was able to start!
Cheers