pytorch-captcha-recognition icon indicating copy to clipboard operation
pytorch-captcha-recognition copied to clipboard

run captcha_predict.py got an error after change the png photo in predict

Open jamesfyp opened this issue 4 years ago • 0 comments

Traceback (most recent call last): File "/Users/james/pythonproject/pytorch-captcha-recognition/captcha_predict.py", line 34, in main() File "/Users/james/pythonproject/pytorch-captcha-recognition/captcha_predict.py", line 19, in main for i, (images, labels) in enumerate(predict_dataloader): File "/Users/james/pythonproject/airasiago/venv/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/Users/james/pythonproject/airasiago/venv/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/Users/james/pythonproject/airasiago/venv/lib/python2.7/site-packages/torch/utils/data/utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/Users/james/pythonproject/pytorch-captcha-recognition/my_dataset.py", line 24, in getitem label = ohe.encode(image_name.split('')[0]) # 为了方便,在生成图片的时候,图片文件的命名格式 "4个数字或者数字_时间戳.PNG", 4个字母或者即是图片的验证码的值,字母大写,同时对该值做 one-hot 处理 File "/Users/james/pythonproject/pytorch-captcha-recognition/one_hot_encoding.py", line 22, in encode vector[idx] = 1.0 IndexError: index 152 is out of bounds for axis 0 with size 144

jamesfyp avatar Sep 29 '20 12:09 jamesfyp