VisibleDeprecationWarning: boolean index did not match indexed array along dimension 1; dimension is 2 but corresponding boolean dimension is 1

前端 未结 1 859
滥情空心
滥情空心 2021-01-02 15:08

After an update of Macports, that I think updated numpy, I\'m getting the warning:

VisibleDeprecationWarning: boolean index did not match indexed array alon         


        
相关标签:
1条回答
  • 2021-01-02 15:47

    I started getting a similar error after going up to numpy 1.10.1. I think you can get rid of the warning just by wrapping the boolean array in a numpy.where().

    inliers = n.size(pixels[n.where(distances <= self.dst)])
    

    Since you're just taking the size, there's no need to use the pixels array, so this should work:

    inliers = n.size(n.where(distances <= self.dst])[0])
    
    0 讨论(0)
提交回复
热议问题