remydubois / lsnms

Large Scale Non maximum Suppression. This project implements a O(nlog(n)) approach for non max suppression, useful for object detection ran on very large images such as satellite or histology, when the number of instances to prune becomes very large.
65 stars 6 forks source link

numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) #2

Closed fanweiya closed 3 years ago

fanweiya commented 3 years ago

I run Example case,but it remind fail.

Traceback (most recent call last):
  File "G:/detect/openvino_pyinstaller/detection_taipanlan2_newYOLOv5/sahi_test.py", line 33, in <module>
    keep = nms(boxes, scores, iou_threshold=0.5, score_threshold=0.1, cutoff_distance=64)
  File "F:\Anaconda\envs\tf2\lib\site-packages\numba\core\dispatcher.py", line 420, in _compile_for_args
    error_rewrite(e, 'typing')
  File "F:\Anaconda\envs\tf2\lib\site-packages\numba\core\dispatcher.py", line 361, in error_rewrite
    raise e.with_traceback(None)
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
- Resolution failure for literal arguments:
Failed in nopython mode pipeline (step: nopython frontend)
- Resolution failure for literal arguments:
Failed in nopython mode pipeline (step: nopython frontend)
Unknown attribute 'dimensionality' of type instance.jitclass.Node#1759266fe08<data:array(float64, 2d, A),centroid:array(float64, 1d, A),indices:OptionalType(array(int64, 1d, A)) i.e. the type 'array(int64, 1d, A) or None',radius:float64,is_leaf:bool,leaf_size:int64,left:OptionalType(DeferredType#1604478947656) i.e. the type 'DeferredType#1604478947656 or None',right:OptionalType(DeferredType#1604478947656) i.e. the type 'DeferredType#1604478947656 or None'>

File "C:\Users\wolf\AppData\Roaming\Python\Python37\site-packages\lsnms\balltree.py", line 145:
    def query_radius(self, X, max_radius):
        <source elided>
            raise ValueError("query_radius only works on single query point.")
        if X.shape[-1] != self.dimensionality:
        ^

During: typing of get attribute at C:\Users\wolf\AppData\Roaming\Python\Python37\site-packages\lsnms\balltree.py (145)

File "C:\Users\wolf\AppData\Roaming\Python\Python37\site-packages\lsnms\balltree.py", line 145:
    def query_radius(self, X, max_radius):
        <source elided>
            raise ValueError("query_radius only works on single query point.")
        if X.shape[-1] != self.dimensionality:
        ^

- Resolution failure for non-literal arguments:
None

During: resolving callee type: BoundFunction((<class 'numba.core.types.misc.ClassInstanceType'>, 'query_radius') for instance.jitclass.Node#1759266fe08<data:array(float64, 2d, A),centroid:array(float64, 1d, A),indices:OptionalType(array(int64, 1d, A)) i.e. the type 'array(int64, 1d, A) or None',radius:float64,is_leaf:bool,leaf_size:int64,left:OptionalType(DeferredType#1604478947656) i.e. the type 'DeferredType#1604478947656 or None',right:OptionalType(DeferredType#1604478947656) i.e. the type 'DeferredType#1604478947656 or None'>)
During: typing of call at C:\Users\wolf\AppData\Roaming\Python\Python37\site-packages\lsnms\balltree.py (272)

File "C:\Users\wolf\AppData\Roaming\Python\Python37\site-packages\lsnms\balltree.py", line 272:
    def query_radius(self, X, radius):
        <source elided>
        """
        return self._root.query_radius(X, radius)
        ^

- Resolution failure for non-literal arguments:
None

During: resolving callee type: BoundFunction((<class 'numba.core.types.misc.ClassInstanceType'>, 'query_radius') for instance.jitclass.BallTree#175926866c8<_root:DeferredType#1604478947656,data:array(float64, 2d, A)>)
During: typing of call at C:\Users\wolf\AppData\Roaming\Python\Python37\site-packages\lsnms\nms.py (84)

File "C:\Users\wolf\AppData\Roaming\Python\Python37\site-packages\lsnms\nms.py", line 84:
def nms(boxes, scores, iou_threshold=0.5, score_threshold=0.1, cutoff_distance=-1, tree="kdtree"):
    <source elided>
            else:
                query = balltree.query_radius(boxA[:2], cutoff_distance)
                ^

Process finished with exit code 1
remydubois commented 3 years ago

Hey, thanks for reporting this error. It is now fixed with the new version (0.1.2) I pushed to pip, and this repo.