megvii-research / video_analyst

A series of basic algorithms that are useful for video understanding, including Single Object Tracking (SOT), Video Object Segmentation (VOS) and so on.
MIT License
832 stars 176 forks source link

Numba error during evaluation #51

Closed meetdave06 closed 4 years ago

meetdave06 commented 4 years ago

Hi, I am trying to evaluate the existing models on VOT 2018 and VOT2019. I get the metrics but after that immediately it throws the following error

Traceback (most recent call last):

File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/errors.py", line 662, in new_error_context yield File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/lowering.py", line 258, in lower_block self.lower_inst(inst) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/lowering.py", line 301, in lower_inst val = self.lower_assign(ty, inst) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/lowering.py", line 459, in lower_assign return self.lower_expr(ty, value) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/lowering.py", line 919, in lower_expr res = self.lower_call(resty, expr) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/lowering.py", line 711, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/lowering.py", line 890, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/targets/base.py", line 1132, in call res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/targets/arrayobj.py", line 3375, in numpy_zeros_nd _zero_fill_array(context, builder, ary) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/targets/arrayobj.py", line 3305, in _zero_fill_array cgutils.memset(builder, ary.data, builder.mul(ary.itemsize, ary.nitems), 0) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/cgutils.py", line 866, in memset builder.call(fn, [ptr, value, size, int32_t(0), bool_t(0)]) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/llvmlite/ir/builder.py", line 841, in call cconv=cconv, tail=tail, fastmath=fastmath) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/llvmlite/ir/instructions.py", line 84, in init raise TypeError(msg) TypeError: Type of #4 arg mismatch: i1 != i32

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "./main/test.py", line 51, in tester.test() File "/home/meetkirankum/AdaTrack/video_analyst/videoanalyst/engine/tester/tester_impl/vot.py", line 91, in test self.evaluation() File "/home/meetkirankum/AdaTrack/video_analyst/videoanalyst/engine/tester/tester_impl/vot.py", line 197, in evaluation ret = benchmark.eval(self.tracker_name) File "/home/meetkirankum/AdaTrack/video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/evaluation/eao_benchmark.py", line 53, in eval eao = self._calculate_eao(tracker_name, self.tags) File "/home/meetkirankum/AdaTrack/video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/evaluation/eao_benchmark.py", line 245, in _calculate_eao expected_overlaps = calculate_expected_overlap(fragments, fweights) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/dispatcher.py", line 395, in _compile_for_args raise e File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/dispatcher.py", line 352, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, *kwargs) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/dispatcher.py", line 693, in compile cres = self._compiler.compile(args, return_type) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/dispatcher.py", line 76, in compile status, retval = self._compile_cached(args, return_type) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/dispatcher.py", line 90, in _compile_cached retval = self._compile_core(args, return_type) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/dispatcher.py", line 108, in _compile_core pipeline_class=self.pipeline_class) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler.py", line 972, in compile_extra return pipeline.compile_extra(func) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler.py", line 390, in compile_extra return self._compile_bytecode() File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler.py", line 903, in _compile_bytecode return self._compile_core() File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler.py", line 890, in _compile_core res = pm.run(self.status) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(args, **kwargs) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler.py", line 266, in run raise patched_exception File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler.py", line 257, in run stage() File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler.py", line 764, in stage_nopython_backend self._backend(lowerfn, objectmode=False) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler.py", line 703, in _backend lowered = lowerfn() File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler.py", line 690, in backend_nopython_mode self.metadata) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/compiler.py", line 1143, in native_lowering_stage lower.lower() File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/lowering.py", line 177, in lower self.lower_normal_function(self.fndesc) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/lowering.py", line 218, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/lowering.py", line 243, in lower_function_body self.lower_block(block) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/lowering.py", line 258, in lower_block self.lower_inst(inst) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/contextlib.py", line 99, in exit self.gen.throw(type, value, traceback) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/errors.py", line 670, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/meetkirankum/anaconda3/envs/SOT/lib/python3.6/site-packages/numba/six.py", line 659, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Type of #4 arg mismatch: i1 != i32

File "videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py", line 166: def calculate_expected_overlap(fragments, fweights):

max_len = fragments.shape[1]
expected_overlaps = np.zeros((max_len), np.float32)
^

[1] During: lowering "$0.10 = call $0.6(max_len, $0.9, func=$0.6, args=[Var(max_len, /home/meetkirankum/AdaTrack/video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py (165)), Var($0.9, /home/meetkirankum/AdaTrack/video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py (166))], kws=(), vararg=None)" at /home/meetkirankum/AdaTrack/video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py (166)

lzx1413 commented 4 years ago

You can comment the jit(nopython=True) line 166 in videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py to avoid this error.

sherlockedlee commented 4 years ago

You can comment the jit(nopython=True) line 166 in videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py to avoid this error.

In line163 I already set the decorator @jit(nopython=True),the error occurs as well,the metric shows without eao and .csv is empty.If set nopython=False,it shows:


NumbaWarning:Compilation is falling back to object mode WITH looplifting enabled because Function calculate_expected_overlap failed at nopython mode lowering due to: Type of #4 arg mismatch: i1 != i32
 NumbaWarning: 
Compilation is falling back to object mode WITH looplifting enabled because Function calculate_expected_overlap failed at nopython mode lowering due to: Type of #4 arg mismatch: i1 != i32

File "../videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py", line 166:
def calculate_expected_overlap(fragments, fweights):
    <source elided>
    max_len = fragments.shape[1]
    expected_overlaps = np.zeros((max_len), np.float32)
    ^

[1] During: lowering "$0.10 = call $0.6(max_len, $0.9, func=$0.6, args=[Var(max_len, /video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py (165)), Var($0.9,/video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py (166))], kws=(), vararg=None)" at /video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py (166)
  @jit(nopython=False)
/video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py:163: NumbaWarning: 
Compilation is falling back to object mode WITHOUT looplifting enabled because Function "calculate_expected_overlap" failed type inference due to: cannot determine Numba type of <class 'numba.dispatcher.LiftedLoop'>

File "../videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py", line 170:
def calculate_expected_overlap(fragments, fweights):
    <source elided>
    # TODO Speed Up
    for i in range(1, max_len):
    ^

  @jit(nopython=False)
/.conda/envs/pysot/lib/python3.7/site-packages/numba/compiler.py:742: NumbaWarning: Function "calculate_expected_overlap" was compiled in object mode without forceobj=True, but has lifted loops.

File "../videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py", line 164:
@jit(nopython=False)
def calculate_expected_overlap(fragments, fweights):
^

  self.func_ir.loc))
/.conda/envs/pysot/lib/python3.7/site-packages/numba/compiler.py:751: NumbaDeprecationWarning: 
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.

For more information visit http://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit

File "../videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py", line 164:
@jit(nopython=False)
def calculate_expected_overlap(fragments, fweights):
^

  warnings.warn(errors.NumbaDeprecationWarning(msg, self.func_ir.loc))
/video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py:163: NumbaWarning: 
Compilation is falling back to object mode WITHOUT looplifting enabled because Function calculate_expected_overlap failed at nopython mode lowering due to: Failed in nopython mode pipeline (step: nopython mode backend)
Failed in nopython mode pipeline (step: nopython mode backend)
Type of #4 arg mismatch: i1 != i32

File "../../../../../../.conda/envs/pysot/lib/python3.7/site-packages/numba/targets/listobj.py", line 464:
    def list_impl(iterable):
        res = []
        ^

[1] During: lowering "$0.1 = build_list(items=[])" at /.conda/envs/pysot/lib/python3.7/site-packages/numba/targets/listobj.py (464)
[2] During: lowering "$50.4 = call $50.1($50.3, func=$50.1, args=[Var($50.3, /.conda/envs/pysot/lib/python3.7/site-packages/numba/targets/arraymath.py (232))], kws=(), vararg=None)" at /.conda/envs/pysot/lib/python3.7/site-packages/numba/targets/arraymath.py (232)
[3] During: lowering "$86.15 = call $86.12(fragment, $const86.14, func=$86.12, args=[Var(fragment, /video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py (173)), Var($const86.14, /video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py (174))], kws=(), vararg=None)" at /video_analyst/videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py (174)
  @jit(nopython=False)
/.conda/envs/pysot/lib/python3.7/site-packages/numba/compiler.py:742: NumbaWarning: Function "calculate_expected_overlap" was compiled in object mode without forceobj=True.

File "../videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py", line 170:
def calculate_expected_overlap(fragments, fweights):
    <source elided>
    # TODO Speed Up
    for i in range(1, max_len):
    ^

  self.func_ir.loc))
/.conda/envs/pysot/lib/python3.7/site-packages/numba/compiler.py:751: NumbaDeprecationWarning: 
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.

For more information visit http://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit

File "../videoanalyst/evaluation/vot_benchmark/pysot/utils/statistics.py", line 170:
def calculate_expected_overlap(fragments, fweights):
    <source elided>
    # TODO Speed Up
    for i in range(1, max_len):
    ^

  warnings.warn(errors.NumbaDeprecationWarning(msg, self.func_ir.loc))

But in this case,eao can be showed,but much lower than the model zoo.What should I do,thank you alot. @lzx1413

lzx1413 commented 4 years ago

I suggest reinstalling the numba and try again. Besides, what's the version of your python, numba and pytorch @sherlockedlee

MARMOTatZJU commented 4 years ago

@sherlockedlee should have been fixed with our newest commit in the master branch. Please check it out.

sherlockedlee commented 4 years ago

@sherlockedlee should have been fixed with our newest commit in the master branch. Please check it out.

Yes it solved.Thank you very much.

MARMOTatZJU commented 4 years ago

Closed seeing that case closed.