eamid/trimap

Trimap hangs forever

Rodolphe2005 opened this issue · 3 comments

The following code makes Trimap hang forever.

import numpy as np
import trimap
x = np.array([[ 3.18987876e-01,  5.87170608e-02, -5.35221584e-02,
        -2.12370202e-01,  1.44289479e-01,  1.15213081e-01,
        -3.49550992e-01, -8.56188014e-02,  7.67039582e-02,
        -7.87917897e-02, -2.89615601e-01, -2.38374388e-03,
        -6.07468300e-02, -1.53473644e-02,  9.19963419e-02,
        -1.14370733e-01,  1.21543720e-01,  1.16481416e-01,
        -2.94296652e-01, -1.43486544e-01, -3.29958886e-01,
         1.34309351e-01, -4.32708934e-02,  3.27159733e-01,
         1.35406721e-04,  2.15839192e-01, -2.31008962e-01,
        -1.53630883e-01,  1.70035616e-01, -1.03398576e-01,
        -7.83967040e-03, -1.48111418e-01,  7.08103701e-02,
         1.51507165e-02, -4.70302580e-03],
       [ 2.70511746e-01,  2.50944565e-03, -1.01266943e-01,
        -6.04593521e-03,  1.90846086e-01, -5.88433584e-03,
        -3.05718035e-01, -1.63746793e-02,  8.91139284e-02,
        -3.90956774e-02, -2.89017886e-01,  5.44876307e-02,
        -3.34294289e-02,  5.05351350e-02,  1.19450457e-01,
        -2.66644936e-02,  1.38987005e-01,  2.54748076e-01,
        -2.78318554e-01,  5.58482762e-03, -4.44619954e-01,
        -3.14005986e-02, -2.54096221e-02,  3.29968154e-01,
         4.54740152e-02,  1.45967603e-01, -1.36808544e-01,
        -1.10377215e-01,  1.64085761e-01, -2.38455474e-01,
        -1.35548353e-01, -1.64852977e-01,  1.17668778e-01,
        -4.60316762e-02,  4.73128930e-02],
       [ 3.17780316e-01, -7.81738758e-03, -6.44788519e-02,
         5.62540069e-02,  1.69442132e-01,  5.34028653e-03,
        -3.56567532e-01,  9.72701795e-03,  8.40950683e-02,
        -7.36852437e-02, -3.20505381e-01,  2.87447236e-02,
        -8.96242410e-02,  1.10711388e-01,  3.08006257e-02,
        -1.42246597e-02,  7.26564825e-02,  3.26128125e-01,
        -1.96420610e-01, -8.66924319e-03, -3.05779576e-01,
        -2.30795946e-02,  9.55938771e-02,  3.96909148e-01,
         7.82142058e-02,  1.47577658e-01, -9.03981999e-02,
        -4.88963164e-02,  1.18389614e-01, -2.15027452e-01,
        -6.54470399e-02, -1.75441504e-01,  1.87194660e-01,
        -5.08111436e-04,  1.35444716e-01],
       [ 2.58012921e-01, -8.77735093e-02, -1.28023893e-01,
         1.47463515e-01,  2.61107385e-01, -5.92785887e-02,
        -2.14058936e-01,  3.41764428e-02,  4.58676219e-02,
        -4.56911102e-02, -2.89655060e-01, -1.57761140e-04,
        -4.51611951e-02,  7.53968805e-02,  7.84260333e-02,
         5.99992424e-02,  1.10423878e-01,  3.26432049e-01,
        -2.62022614e-01,  2.30244398e-02, -3.76471043e-01,
        -1.13793373e-01,  1.96540896e-02,  2.30564684e-01,
         6.99499100e-02,  1.44859001e-01,  5.51677980e-02,
         2.79185660e-02,  7.44636357e-02, -2.78124183e-01,
        -1.65953085e-01, -1.10599346e-01,  2.63543546e-01,
        -8.91586766e-02,  1.93403229e-01],
       [ 3.32011819e-01, -1.40174493e-01, -5.28167412e-02,
         1.13800459e-01,  2.06157431e-01, -8.29892382e-02,
        -2.11161330e-01,  7.94143155e-02,  4.90802489e-02,
        -1.19306277e-02, -2.87060529e-01,  4.33459552e-03,
         8.65805820e-02,  3.03589255e-02,  1.73449665e-01,
         1.71231180e-02,  4.74411622e-02,  2.65454501e-01,
        -2.75403082e-01,  2.34591905e-02, -3.79175991e-01,
        -1.03660703e-01,  4.20364253e-02,  1.28694892e-01,
        -8.52392241e-03, -4.99439947e-02,  1.10806182e-01,
        -2.32070358e-03,  2.65163928e-02, -3.77998233e-01,
        -2.85796434e-01, -7.88480118e-02,  1.74133658e-01,
        -1.40881404e-01,  1.08900480e-01],
       [ 1.82337701e-01, -2.11179242e-01, -1.01714216e-01,
         1.31016269e-01,  4.99383882e-02, -1.59250170e-01,
        -1.29212305e-01, -3.32643799e-02,  1.20454393e-01,
         1.02800533e-01, -2.92455345e-01, -1.76530272e-01,
         2.09684089e-01,  1.33223221e-01,  1.39211901e-02,
         4.81586717e-03, -9.83966216e-02,  3.23559731e-01,
        -2.28622139e-01,  3.68424207e-02, -2.63355613e-01,
        -1.88473210e-01,  4.12943624e-02,  1.66466340e-01,
        -1.77660301e-01, -1.06210433e-01,  2.31963158e-01,
        -5.21184653e-02,  8.36717412e-02, -2.57204562e-01,
        -2.26933807e-01, -1.83641464e-01,  2.42122248e-01,
        -1.56716019e-01,  4.54310402e-02],
       [ 2.46496126e-02, -1.26516521e-01, -2.60583401e-01,
         2.04805687e-01,  1.16600819e-01, -2.23044977e-01,
        -1.97046809e-02, -8.16227198e-02,  7.48965740e-02,
         1.76039010e-01, -2.80806333e-01, -9.68108177e-02,
         1.12287454e-01,  1.50147453e-01, -7.96348378e-02,
         4.77459133e-02,  3.08816843e-02,  2.76006699e-01,
        -2.06872299e-01,  1.46334590e-02, -2.49763101e-01,
        -1.79324538e-01, -2.08251923e-02,  1.89528510e-01,
        -9.29871425e-02,  1.07009195e-01,  2.11045280e-01,
        -3.39877009e-02,  7.40684122e-02, -1.97052538e-01,
        -8.61336514e-02, -2.74793237e-01,  3.87020469e-01,
        -7.57661313e-02,  1.86928004e-01]], dtype=np.float32)
y = trimap.TRIMAP(verbose=True).fit_transform(x)
eamid commented

Hi Rodolphe,

Thanks for noticing this. Both parameters n_inliers and n_outliers should be < n-1. Since the shape of your input is (7, 37), you should try (n_inliers < 6, n_outliers < 6). I tried:

y = trimap.TRIMAP(n_inliers=5, n_outliers=5).fit_transform(x)

and it worked fine. I will add conditions to check for such cases.

eamid commented

Hi @Rodolphe2005,

I fixed the issue. It should work fine now. Thank you again for letting me know about the bug!