Numpy deprecated operations
Closed this issue · 3 comments
Awesome project. You should add your dependencies as numpy has deprecated some of your operators
Thanks Gabriel,
Would you mind providing a log of the numpy errors you're seeing?
I haven't used this project in a while, so I don't have a updated dependencies list I can dump, but I'll look into fixing the root issue
@goncalopp I can reproduce the issues with numpy==1.14.0
. The specific error traceback is:
Traceback (most recent call last):
File "/home/.../Source/simple-ocr-opencv/tests/test_grounding.py", line 14, in setUp
self.segments = ContourSegmenter().process(self.img.image)
File "/home/.../Source/simple-ocr-opencv/simpleocr/processor.py", line 100, in process
output = self._process(arguments)
File "/home/.../Source/simple-ocr-opencv/simpleocr/processor.py", line 149, in _process
arguments = p.process(arguments)
File "/home/.../Source/simple-ocr-opencv/simpleocr/processor.py", line 100, in process
output = self._process(arguments)
File "/home/.../Source/simple-ocr-opencv/simpleocr/segmentation_filters.py", line 34, in _process
good = self._good_segments(segments)
File "/home/.../Source/simple-ocr-opencv/simpleocr/segmentation_filters.py", line 75, in _good_segments
return (True - numpy.max(m, axis=1))
TypeError: numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead.
I went back a few versions of numpy
, but the issue occurs in all of them. I think it might have been deprecated when they went to 1.0.0
?
In any case, the issue can can be easily resolved by replacing the -
in line 75
of simpleocr/segmentation_filters.py
by a ^
.
I pushed my fix to branch numpy
. The issue occurs on my personal machine, Ubuntu 17.10 with Python 3.6 and Python 2.7.
Thanks for reproducing and fixiing this RedFantom! I've cherry-picked your fix :)
With the fix in there's no need to recommend specific dependency versions, everything should work with latest versions out-of-the-box