so bascially i changed panda.frame to polars.frame for better speed in yolov5 but when i run the code, it works fine till some point (i dont exactly know when error occurs) and it gives me TypeError: must be real number, not str. running it with panda works great without any errors but only with polars. i know it must be using wrong type of data type but i dont really know where i should look for since i've just started python. so i would really appreciate it if someone could help me with this! thanx for reading and have a nice day!
Traceback (most recent call last):File "C:\yolov5\test.py", line 61, in <module>boxes = results.polars().xywh[0]File "c:\yolov5\.\models\common.py", line 684, in polarssetattr(new, k, [pl.DataFrame(x, columns=c) for x in a])File "c:\yolov5\.\models\common.py", line 684, in <listcomp>setattr(new, k, [pl.DataFrame(x, columns=c) for x in a])File "C:\Users\jojow\AppData\Local\Programs\Python\Python39\lib\site- packages\polars\internals\frame.py", line 311, in __init__
self._df = sequence_to_pydf(data, columns=columns, orient=orient)File
"C:\Users\jojow\AppData\Local\Programs\Python\Python39\lib\site-
packages\polars\internals\construction.py", line 495, in
sequence_to_pydf
data_series = [
File
"C:\Users\jojow\AppData\Local\Programs\Python\Python39\lib\site- packages\polars\internals\construction.py", line 496, in <listcomp>
pli.Series(columns[i], data[i], dtypes.get(columns[i])).inner()File
"C:\Users\jojow\AppData\Local\Programs\Python\Python39\lib\site- packages\polars\internals\series.py", line 227, in __init__
self._s = sequence_to_pyseries(name, values, dtype=dtype,
strict=strict)File "C:\Users\jojow\AppData\Local\Programs\Python\Python39\lib\site-
packages\polars\internals\construction.py", line 239, in
sequence_to_pyseries
return constructor(name, values, strict)
TypeError: must be real number, not str
heres my code (edited)
import polars as pl
import pandas as pdclass new:xyxy = 0a = [[[370.01605224609375, 346.4305114746094, 398.3968811035156,
384.5684814453125, 0.9011853933334351, 0, 'corn'],
[415.436767578125, 279.4227294921875, 433.930419921875,
305.5151672363281, 0.8829901814460754, 0, 'corn'],
[383.8118896484375, 268.781494140625, 402.35479736328125,
292.4585266113281, 0.8579609394073486, 0, 'corn'],
[431.42791748046875, 570.9154663085938, 476.672119140625, 600.0,
0.810459554195404, 0, 'corn'], [414.912841796875,
257.7676086425781, 427.7708740234375, 274.69635009765625,
0.7384995818138123, 0, 'corn'], [391.22821044921875,
250.48876953125, 403.9199523925781, 268.1374816894531,
0.6828912496566772, 0, 'corn'], [414.2362060546875,
250.18174743652344, 423.82537841796875, 264.02667236328125,
0.517136812210083, 0, 'corn']]]ca = 'xmin', 'ymin', 'xmax', 'ymax', 'confidence', 'class', 'name' # xyxy columns
cb = 'xcenter', 'ycenter', 'width', 'height', 'confidence', 'class', 'name' # xywh columnsfor k, c in zip(['xyxy', 'xyxyn', 'xywh', 'xywhn'], [ca, ca, cb,
cb]):setattr(new, k, [pl.DataFrame(x, columns=c) for x in a])print (new.xyxy[0])