cheind / py-motmetrics

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

Runtime error in new release 1.2.0 `could not convert string to float`. #91

Closed DmitriySidnev closed 4 years ago

DmitriySidnev commented 4 years ago

Hello!

I have faced with the next error in new version 1.2.0 of motmetrics:

Traceback (most recent call last):
  File "tools/run_evaluate.py", line 154, in <module>
    main()
  File "tools/run_evaluate.py", line 145, in main
    names=['video ' + str(i) for i in range(len(accs))])
  File "/home/dmitry/virtualenv/mcmt_env/lib/python3.5/site-packages/motmetrics/metrics.py", line 285, in compute_many
    for acc, analysis, name in zip(dfs, anas, names)]
  File "/home/dmitry/virtualenv/mcmt_env/lib/python3.5/site-packages/motmetrics/metrics.py", line 285, in <listcomp>
    for acc, analysis, name in zip(dfs, anas, names)]
  File "/home/dmitry/virtualenv/mcmt_env/lib/python3.5/site-packages/motmetrics/metrics.py", line 173, in compute
    df = df.events
  File "/home/dmitry/virtualenv/mcmt_env/lib/python3.5/site-packages/motmetrics/mot.py", line 320, in events
    self.cached_events_df = MOTAccumulator.new_event_dataframe_with_data(self._indices, self._events)
  File "/home/dmitry/virtualenv/mcmt_env/lib/python3.5/site-packages/motmetrics/mot.py", line 366, in new_event_dataframe_with_data
    pd.Series(events['OId'], dtype=float, name='OId'),
  File "/home/dmitry/virtualenv/mcmt_env/lib/python3.5/site-packages/pandas/core/series.py", line 262, in __init__
    raise_cast_failure=True)
  File "/home/dmitry/virtualenv/mcmt_env/lib/python3.5/site-packages/pandas/core/internals/construction.py", line 607, in sanitize_array
    raise_cast_failure)
  File "/home/dmitry/virtualenv/mcmt_env/lib/python3.5/site-packages/pandas/core/internals/construction.py", line 706, in _try_cast
    copy=copy)
  File "/home/dmitry/virtualenv/mcmt_env/lib/python3.5/site-packages/pandas/core/dtypes/cast.py", line 1243, in construct_1d_ndarray_preserving_na
    subarr = np.array(values, dtype=dtype, copy=copy)
ValueError: could not convert string to float: 'ID 3'

The source code is here multi_camera_multi_person_tracking. With the previous version it works OK.

jvlmdr commented 4 years ago

Hi Dmitriy,

We discontinued support for using strings as IDs in v1.2.0 because it was slowing things down significantly. The object and hypothesis IDs must now be integers (but do not need to be consecutive). Maybe you could use track['id'] instead of 'ID ' + str(track['id']) in that code.

Cheers, Jack

jvlmdr commented 4 years ago

c.f. issue https://github.com/cheind/py-motmetrics/issues/20#issuecomment-575362329

DmitriySidnev commented 4 years ago

Yes, it works. Thank you very much! Closed.

jvlmdr commented 4 years ago

For future reference, here is the permalink to the code in question: https://github.com/DmitriySidnev/open_model_zoo/blob/ccdfe87ceaaf1f84d8317d0e5ce21aa2bbbaf23e/demos/python_demos/multi_camera_multi_person_tracking/tools/run_evaluate.py

mattiasegu commented 3 years ago

Hey @jvlmdr, actually I think there might be some reasons for keep using strings instead of integers as IDs. This is an example of label ID in the Waymo dataset: 'fc684759-bbe2-4341-83b0-249b3b5d3c1e'. You can see how this is incompatible with the current implementation using integers.

Can you think of any workaround, or the solution would be to revert to using strings?