Closed NeelKanwal closed 2 years ago
Hi,
Can you try to follow this example instead https://github.com/histocartography/histocartography/blob/main/examples/stain_normalization.py. Let me know if you still get the same error.
Guillaume
Thanks for a quick reply. I am also using png files but they are RGBA(32bit).
In order to make it similar to example dataset, I load then and convert to RGB (24bit). While running it on two other datasets, I am getting different errors from linalg.
Here are both traces.
Traceback (most recent call last):
File "", line 1, in
Traceback (most recent call last):
File "", line 1, in
I have changed NumPy version also. Note: I am not using the target image and leaving the default stain matrix. (I do not know a reference for that particular stain concentration.)
Neel
Hi,
I am trying to run Macenko and Vahadane stain normalizer on my datasets.
The dataset has separate folders for I am trying to make the list of files, initialize the VahadaneStainNormalizer instance and call the _normalize_image(img) method. It works in the beginning but stops suddenly after some time and leaves this error. I have tried on different datasets but the error is the same.
Images are in PNG, I am loading them using PIL, converting them to RGB, and making ndarray. I do not understand where NaN or inf values might be appearing.
Traceback (most recent call last): File "normalizer.py", line 58, in
norm_img = normalization._normalize_image(target)
File "/home/neel/miniconda3/envs/DKL/lib/python3.6/site-packages/histocartography/preprocessing/stain_normalizers.py", line 498, in _normalize_image
input_image, stain_matrix_source
File "/home/neel/miniconda3/envs/DKL/lib/python3.6/site-packages/histocartography/preprocessing/stain_normalizers.py", line 103, in _get_concentrations
stain_matrix.T, optical_density.T, rcond=-1)[0].T
File "<__array_function__ internals>", line 6, in lstsq
File "/home/neel/miniconda3/envs/DKL/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 2306, in lstsq
x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj)
File "/home/neel/miniconda3/envs/DKL/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 100, in _raise_linalgerror_lstsq
raise LinAlgError("SVD did not converge in Linear Least Squares")
numpy.linalg.LinAlgError: SVD did not converge in Linear Least Squares
Can someone please suggest here?