-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error for images that have completely black background #4
Comments
please help me |
I have same errors and it is very critical, your module would be very useful but we cannot use your work until this is fixed. ################ versions ########################## python 3.5.2 ################ codes ########################## image_path = "chem.png" # also tried with jpg version : image_path = "chem.jpg" mbd = psal.get_saliency_mbd(image_path).astype('uint8') ######################## image ################# ########## error ######################## --> 513 ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj) LinAlgError: Singular matrix |
A simple work-around that worked for me is to use the pseudo inverse in these cases. I.e., for each one:
|
Is normal to have errors in flat color image with saliency methods due to the need to calculate the inverse matrix of image pieces, is something discussed even in literature, a solid fix is to add some noise to the image :
this should do the work. |
Both cases are about mdb.
(1)
Traceback (most recent call last):
File ".../demo.py", line 54, in
mbd = psal.get_saliency_mbd(filename).astype('uint8')
File ".../saliency_mbd.py", line 169, in get_saliency_mbd
cov_bottom = np.linalg.inv(cov_bottom)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 526, in inv
ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 90, in _raise_linalgerror_singular
raise LinAlgError("Singular matrix")
numpy.linalg.linalg.LinAlgError: Singular matrix
(2)
Another example is a white background image:
raises warning
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/skimage/io/_io.py:132: UserWarning: sushi6-ST copy-mbd.png is a low contrast image
warn('%s is a low contrast image' % fname)
The saliency map is also strange (completely black).
However, if I add some elements to its background, it works fine and results in a good saliency map.
The text was updated successfully, but these errors were encountered: