question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
DmitriySidnevcommented, Feb 7, 2020

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

0reactions
mattiasegucommented, Jul 21, 2021

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - "ValueError: could not convert string to float" when ...
That error is caused by calling float() on a value that cannot be converted to a float. If you look closely at the...
Read more >
How to Fix in Pandas: could not convert string to float
This error usually occurs when you attempt to convert a string to a float in pandas, yet the string contains one or more...
Read more >
ValueError: could not convert string to float: 'test' #785
Checklist I have searched related issues but cannot get the expected help. The bug has not been fixed in the latest version.
Read more >
Python valueerror: could not convert string to float Solution
You can solve this error by adding a handler that makes sure your code does not continue running if the user inserts an...
Read more >
How To Convert a String to a Float in Python
This tutorial was tested with Python 3.9.6. Using the float() function. We can convert a string to float in Python using the float()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found