利用pandas加载txt文本时,
gt = pandas.read_csv(bb_anno_file, delimiter=',', header=None, dtype=np.float32, na_filter=False, low_memory=False).values
遇到如下报错:
TypeError: Cannot cast array data from dtype('O') to dtype('float32') according to the rule 'safe'
ValueError: cannot safely convert passed user dtype of float32 for object dtyped data in column 0
个人解决办法:
gt = pandas.read_csv(bb_anno_file, delimiter=',', header=None, na_filter=False, low_memory=False).values
gt = gt.astype(np.float32)