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 empt
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
ValueError: With n_samples=0, test_size=0.2 and train_size=None, the resulting train set will be empty. Adjust any of the aforementioned parameters.
問(wèn)題描述:
在使用Unet++訓(xùn)練自己的數(shù)據(jù)集時(shí)出現(xiàn)ValueError: With n_samples=0, test_size=0.2 and train_size=None, the resulting train set will be empty. Adjust any of the aforementioned parameters.
原因分析:
原數(shù)據(jù)集訓(xùn)練圖片使用的是png格式,自己的數(shù)據(jù)集圖片為jpg格式。
解決方案:
將訓(xùn)練圖片從jpg格式轉(zhuǎn)成png格式。
import os import cv2def transform(input_path, output_path):for root, dirs, files in os.walk(input_path):for name in files:file = os.path.join(root, name)print('transform' + name)im = cv2.imread(file)if output_path:cv2.imwrite(os.path.join(output_path, name.replace('jpg', 'png')), im)else:cv2.imwrite(file.replace('jpg', 'png'), im)if __name__ == '__main__':input_path = input("請(qǐng)輸入目標(biāo)文件夾: ")output_path = input("請(qǐng)輸入輸出文件夾: (回車(chē)則輸出到原地址)")if not os.path.exists(input_path):print("文件夾不存在!")else:print("Start to transform!")transform(input_path, output_path)print("Transform end!")總結(jié)
以上是生活随笔為你收集整理的ValueError With n_samples=0, test_size=0.2 and train_size=None, the resulting train set will be empt的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: (转)SwitchyOmega规则列表
- 下一篇: HUE下载提示The number of