日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發布時間:2023/12/8 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。