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 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])
故應該修改為
打印印證
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的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 手机搜狐概念版 html,概念版来了 手
- 下一篇: CCD的驱动程序