ValueError:无法将字符串转换为浮点数-Google Colab中

时间:2019-04-04 07:02:06

标签: python

获取错误,如下所示。 “ ValueError:无法将字符串转换为浮点数:”

文件有数字

0.57273,0.677385,1.87446,2.06253,3.33843,5.47434,7.88282,3.52778,9.77052,9.16828



def read_anchors(anchors_path):
    with open(anchors_path) as f:
        anchors = f.readline()
        anchors = [float(x) for x in anchors.split(',')]
        anchors = np.array(anchors).reshape(-1, 2)
    return anchors



!wget  http://upscfever.com/upsc-fever/en/data/deeplearning4/images/yolo_anchors.txt  -P drive/app
anchors = read_anchors("drive/app/yolo_anchors.txt")

0 个答案:

没有答案