I run my code and it throw a error in line 79:
numpy.core._exceptions.UFuncTypeError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U21'), dtype('<U21')) -> dtype('<U21').
Everybody know how to fix please help me. Thank you so much. My code:
68 multi_df = pd.read_csv(FLAGS.VoTT_csv)
69 labels = multi_df["label"].unique()
70 labeldict = dict(zip(labels, range(len(labels))))
71 multi_df.drop_duplicates(subset=None, keep="first", inplace=True)
72 train_path = FLAGS.VoTT_Folder
73 convert_vott_csv_to_yolo(
74 multi_df, labeldict, path=train_path, target_name=FLAGS.YOLO_filename
75 )
76 file = open(classes_filename, "w")
77 SortedLabelDict = sorted(labeldict.items(), key=lambda x: x[1])
78 for elem in SortedLabelDict:
79 file.write(elem[0] + "\n")
80 file.close()
The likely situation is that elem[0] in line 79 isn't a string, but rather is a numeric type from deep in numpy.
Try changing lines 78 and 79 to this instead:
for elem in SortedLabelDict:
file.write(str(elem[0]) + "\n")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With