cheind / py-motmetrics

:bar_chart: Benchmark multiple object trackers (MOT) in Python
MIT License
1.36k stars 258 forks source link

AttributeError for `np.bool` in Numpy `1.24.0` #172

Closed facundo-lezama closed 1 year ago

facundo-lezama commented 1 year ago

The new release of Numpy 1.24.0 has some expired deprecations among which there is np.bool. This is causing the following error:

/home/runner/work/norfair/norfair/.tox/mot-py39/lib/python3.9/site-packages/motmetrics/mot.py:178: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar. (This may have returned Python scalars in past versions.
  oids_masked = np.zeros_like(oids, dtype=np.bool)
Traceback (most recent call last):
  File "/home/runner/work/norfair/norfair/tests/mot_metrics.py", line 89, in <module>
    mot_metrics()
  File "/home/runner/work/norfair/norfair/tests/mot_metrics.py", line 70, in mot_metrics
    accumulator.compute_metrics()
  File "/home/runner/work/norfair/norfair/.tox/mot-py39/lib/python3.9/site-packages/norfair/metrics.py", line 225, in compute_metrics
    self.summary_text, self.summary_dataframe = eval_motChallenge(
  File "/home/runner/work/norfair/norfair/.tox/mot-py39/lib/python3.9/site-packages/norfair/metrics.py", line 334, in eval_motChallenge
    accs, names = compare_dataframes(gt, ts)
  File "/home/runner/work/norfair/norfair/.tox/mot-py39/lib/python3.9/site-packages/norfair/metrics.py", line 305, in compare_dataframes
    mm.utils.compare_to_groundtruth(gts[k], tsacc, "iou", distth=0.5)
  File "/home/runner/work/norfair/norfair/.tox/mot-py39/lib/python3.9/site-packages/motmetrics/utils.py", line 82, in compare_to_groundtruth
    acc.update(oids, hids, dists, frameid=fid)
  File "/home/runner/work/norfair/norfair/.tox/mot-py39/lib/python3.9/site-packages/motmetrics/mot.py", line 178, in update
    oids_masked = np.zeros_like(oids, dtype=np.bool)
  File "/home/runner/work/norfair/norfair/.tox/mot-py39/lib/python3.9/site-packages/numpy/__init__.py", line 284, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'bool'

Is it possible to do a release fixing this? I believe https://github.com/cheind/py-motmetrics/pull/155 already addresses this issue.

cheind commented 1 year ago

@facundo-lezama thanks for noting. I've merged #155 to develop and it passes as expected https://github.com/cheind/py-motmetrics/actions/runs/3766789221

facundo-lezama commented 1 year ago

Thanks for the quick response! Is it possible to release these changes to PyPI?

cheind commented 1 year ago

yes, after the holidays. In the mean time you can install via

pip install git+https://github.com/cheind/py-motmetrics.git

Happy holidays!

cheind commented 1 year ago

I've uploaded v1.4.0 to PyPi

facundo-lezama commented 1 year ago

That's great! Thanks for being so quick, that really helped us.