ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be empty. Adjust any of the aforementioned parameters.


错误原因:

看报错信息及目标文件目录可知,是生成数量为空,其实是因为文件路径不对

#这两处更改为你指定的路径
#一定要注意是path的末尾是否带上/,路径是拼接出来的,如果没有调整好,仍然会报上面的错误
labelme_path = "C:/Users/Administrator/Desktop/sss/"              #原始labelme标注数据路径
saved_path = "C:/Users/Administrator/Desktop/ccc/"                #保存路径

注意: 通过阅读源码

json_filename = labelme_path + json_file_ + ".json"
height, width, channels = cv2.imread(labelme_path + json_file_ +".jpg").shape

可知,我们转换的jpg图片和.json文件要放在同一个目录下:

然后又报错
Traceback (most recent call last):
File “json_to_xml.py”, line 28, in
json_file = json.load(open(json_filename,“r”,encoding=“utf-8”))
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/Administrator/Desktop/sss/sss\\000000.json'

从报错信息来看,本以为是\的问题,其实不然,而是多了一个层级的目录

阅读源码

files = [i.split("/")[-1].split(".json")[0] for i in files] #其分割的是"/",而Windows返回路径为"\"

打印发现

for i in files:print(i.split("/")[-1])


故应该修改为

files = [i.split("\\")[-1].split(".json")[0] for i in files]

打印印证

for i in files:print(i.split("\\")[-1])


运行成功


ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em相关推荐

  1. ValueError: With n_samples=1, test_size=0.2 and train_size=None, the resulting train set will be

    ValueError: With n_samples=1, test_size=0.2 and train_size=None, the resulting train set will be emp ...

  2. ValueError: With n_samples=1, test_size=0.2 and train_size=None, the resulting train set will be emp

    原因:scikit-learn版本为0.20+,改为安装0.19.1 查看scikit-learn版本方法 python >>import sklearn >>sklearn. ...

  3. alueError: With n_samples=1, test_size=0.2 and train_size=None, the resulting train set will be

    ValueError: With n_samples=1, test_size=0.2 and train_size=None, the resulting train set will be emp ...

  4. 成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be

    成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be ...

  5. ValueError: With n_samples=0, test_size=0.2 and train_size=None, the resulting train set will be emp

    今天写代码labelmetovoc,即将labelme标注的转化为voc标准格式参考的这篇文章时遇到了如下问题: ValueError: With n_samples=0, test_size=0.2 ...

  6. ValueError With n_samples=0, test_size=0.2 and train_size=None, the resulting train set will be empt

    ValueError: With n_samples=0, test_size=0.2 and train_size=None, the resulting train set will be emp ...

  7. ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be emp

    ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be emp ...

  8. 关于x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.3, random_state=0)

    X_train,X_test, y_train, y_test =sklearn.model_selection.train_test_split(train_data,train_target,te ...

  9. python报错 ValueError: dictionary update sequence element #0 has length 1; 2 is require

    原文链接地址: https://blog.csdn.net/weixin_40894428/article/details/80683137 字符串转字典要用eval(),这个方法很多书上都没有介绍, ...

最新文章

  1. getchar getche getch的区别
  2. Hyperledger Fabric 核心模块(4)orderer 共识
  3. 解决MVN install一直处于下载jar包等待问题
  4. [SDWC2018 Day1]网格
  5. LeetCode刷题(17)
  6. Dynamics CRM2016 Update or Create parentcustomerid in Contact using web api
  7. 通俗易懂的monteCarlo积分方法(八)
  8. UAC1.0和UAC2.0区别(八)
  9. java put请求_计算机毕业设计中用java实现小程序推送(springboot实现)
  10. rehat 出现GDB debuginfo-install 问题处理
  11. iOS:Tagged Pointer
  12. 【PHP代码审计】RIPS代码审计工具
  13. 关于使用NLPIR-ICTCLAS分词系统
  14. 阿里销售铁军:阿里巴巴客户跟进流程
  15. php5.3.3 xhprof,给CentOS6.3 + PHP5.3 安装PHP性能测试工具 XHProf-0.9.2
  16. 微信个人赞赏码怎么用?微信赞赏码使用教程详解
  17. ros服务器打开网页变慢了,解决ros 在计算机没有限速情况下,有几个网站打开很慢,或者打不开。...
  18. 重装系统后mysql不用重新安装
  19. 基于VNPY实现网格策略实盘(币圈)
  20. 阿里云服务器与本地不能复制粘贴

热门文章

  1. 游戏中提高抽卡概率外挂分析及原理
  2. 计算机鼠标左键不起作用,为什么电脑的左键点了不起作用
  3. 英特尔的指令集体系结构_INTEL 体系结构 MMX™ 技术开发者手册
  4. 打扰一下计算机房在哪里用英语怎么写,打扰用英语怎么说例句翻译
  5. 对未来的打算和本专业的认识
  6. 看完代码回首看论文:YOLOv3重读
  7. oracle 10231事件,Oracle数据块损坏篇之10231内部事件
  8. rtx3060ti参数配置
  9. python sendkeys用法_selenium sendkeys方法总结
  10. An internal error occurred during: Add Deployment.