bmvandoren / Nighthawk

Nighthawk is a machine learning model for acoustic monitoring of nocturnal bird migration.
Other
21 stars 4 forks source link

Crash while running: numpy.core._exceptions._UFuncNoLoopError: ufunc 'add' did not contain a loop with signature matching types (dtype('float64'), dtype('<U2')) -> None #11

Closed ses4j closed 1 month ago

ses4j commented 1 year ago

idk what caused this but it happened on a file. I can send the file if you want it, it's a 40MB recording. It's probably in your Box account.

It never generated the audacity file, but it had generated a CSV, which was empty. So maybe this is just 'what happens when you have no detections and try to generate an audacity file'?

Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\wc\nfc-tools\.venv\Scripts\nighthawk.exe\__main__.py", line 7, in <module>
  File "C:\wc\nfc-tools\.venv\lib\site-packages\nighthawk\run_nighthawk.py", line 14, in main
    nh.run_detector_on_files(
  File "C:\wc\nfc-tools\.venv\lib\site-packages\nighthawk\detector.py", line 82, in run_detector_on_files
    _write_detection_audacity_label_file(output_file_path, detections)
  File "C:\wc\nfc-tools\.venv\lib\site-packages\nighthawk\detector.py", line 275, in _write_detection_audacity_label_file
    detections['pred_cat_prob'] = detections['predicted_category'] + ' (' + detections['prob'].astype(float).round(3).astype(str) + ')'
  File "C:\wc\nfc-tools\.venv\lib\site-packages\pandas\core\ops\common.py", line 81, in new_method
    return method(self, other)
  File "C:\wc\nfc-tools\.venv\lib\site-packages\pandas\core\arraylike.py", line 186, in __add__
    return self._arith_method(other, operator.add)
  File "C:\wc\nfc-tools\.venv\lib\site-packages\pandas\core\series.py", line 6108, in _arith_method
    return base.IndexOpsMixin._arith_method(self, other, op)
  File "C:\wc\nfc-tools\.venv\lib\site-packages\pandas\core\base.py", line 1348, in _arith_method
    result = ops.arithmetic_op(lvalues, rvalues, op)
  File "C:\wc\nfc-tools\.venv\lib\site-packages\pandas\core\ops\array_ops.py", line 232, in arithmetic_op
    res_values = _na_arithmetic_op(left, right, op)  # type: ignore[arg-type]
  File "C:\wc\nfc-tools\.venv\lib\site-packages\pandas\core\ops\array_ops.py", line 171, in _na_arithmetic_op
    result = func(left, right)
numpy.core._exceptions._UFuncNoLoopError: ufunc 'add' did not contain a loop with signature matching types (dtype('float64'), dtype('<U2')) -> None
wyoerger commented 1 month ago

Is there a way to solve this error? I need guidance on this if possible.

bmvandoren commented 1 month ago

Thank you, I have merged the pull request.