Closed gatoniel closed 2 years ago
@gatoniel, I just tried training on my own data using the same code as above (with minor tweaks) and I cannot reproduce the issue. In my case, my images are also mono-channel, and the training works whether or not we use [np.newaxis]
to give it an explicit channel axis. In other words, the training does work with shape output (thanks for including that in your debugging!) (1,Ly,Lx)
for images and (Ly,Lx)
for masks. So I can only think of the following: do you have the latest github version of Omnipose? And what version of python and numpy do you have?
I ran into this problem as well, when I tried this command with my own data
python -m omnipose --train --verbose --use_gpu --dir "~/data" --pretrained_model bact_fluor_omni --learning_rate 0.1 --n_epochs 100 --mask_filter _masks --img_filter _img --min_train_masks 5
In the "__main__.py"
file here (https://github.com/kevinjohncutler/cellpose-omni/blob/4507c365aee6417bc6546c93698a181693f69612/cellpose/__main__.py#L434)
else:
rescale = True
args.diameter = szmean
logger.info('pretrained model %s is being used'%cpmodel_path)
args.residual_on = 1
args.style_on = 1
args.concatenation = 0
if rescale and args.train:
logger.info('during training rescaling images to fixed diameter of %0.1f pixels'%args.diameter)
I think the problem seems to be the rescale=True when diam_mean=0 which causes the rsc matrix to be inf. If I train any bacteria model, rescale=True the when szmean=0. When I change rescale to False. The training works normally.
Please have a look into it @kevinjohncutler Thanks
Hi, I am trying to train my own Omnipose model diretly in python. However, I get a
LinAlgError: Singular matrix
error. Here is my code:My output is:
I wonder why there is a divide by zero warning and why the
Singular matrix
error occurs. Am I initializing the model wrongly? Best, Niklas