python - ValueError:无法将字符串转换为浮点数 - 在 google colab 中
问题描述
得到如下所示的错误。“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")
解决方案
推荐阅读
- render - 在 show-hint.js 中更改 codemirror 渲染功能
- python - 如果其他列不等于特定字符串,则 Pandas 更新列,否则什么都没有
- typescript - 我该如何开玩笑地测试这段代码?
- ios - 从 pdf 数据在 iOS 中显示 PDF
- python - 获取错误 7 参数列表太长而无法获得更多选项?
- javascript - 正则表达式匹配从字符串 _ JavaScript 返回第一个匹配
- php - 无法打开流:tcpdf_static.php 中没有这样的文件或目录
- javascript - 如何通过使用按钮同时单击锚链接上的事件来提交表单?
- c - 如何用 C 转储 PE 导出函数名称?
- javascript - 选择和取消选择在角度 7 中不起作用?