pprp / captcha_identify.pytorch

基于torch进行验证码识别,识别率达94%
MIT License
113 stars 24 forks source link

请教一下 这个 num_samples 设置多少呀 #1

Closed hk8090150 closed 4 years ago

hk8090150 commented 5 years ago

File "D:/Program Files/pycharm-professional-2018.1/project/captcha_identify.torch-master/train.py", line 51, in main acc = test.testdata("./weights/cnn%03g.pt" % epoch) File "D:\Program Files\pycharm-professional-2018.1\project\captcha_identify.torch-master\test.py", line 56, in test_data test_dataloader = datasets.get_test_data_loader() File "D:\Program Files\pycharm-professional-2018.1\project\captcha_identify.torch-master\datasets.py", line 47, in get_test_data_loader return DataLoader(dataset, batch_size=1, shuffle=True) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 213, in init sampler = RandomSampler(dataset) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\sampler.py", line 94, in init "value, but got num_samples={}".format(self.num_samples)) ValueError: num_samples should be a positive integer value, but got num_samples=0

请教一下 这个 num_samples 设置多少呀

if not isinstance(self.num_samples, int) or self.num_samples <= 0:

pprp commented 5 years ago

这是因为你的训练集中没有图片,并不是设置出来的,应该先运行captchaGenerator.py进行生成图片,然后再进行训练,才能通过。