Giter Site home page Giter Site logo

win10直接运行train.py 报错。微信nlanguage ForkingPickler(file, protocol).dump(obj) TypeError: cannot pickle 'Font' object about crnn.pytorch HOT 1 OPEN

yizt avatar yizt commented on May 28, 2024
win10直接运行train.py 报错。微信nlanguage ForkingPickler(file, protocol).dump(obj) TypeError: cannot pickle 'Font' object

from crnn.pytorch.

Comments (1)

nissansz avatar nissansz commented on May 28, 2024

这个错误,可以解决 # num_workers=args.workers
改为num_workers = 0

但是然后转到generator.py,又在这个类报错了
C:\Users\Ni\AppData\Local\Programs\Python\Python38\python.exe F:/pycharm2020.2/crnn.pytorch_generator/train.py
Namespace(batch_size=64, device='cuda', direction='horizontal', dist_backend='nccl', dist_url='env://', distributed=False, epochs=90, init_epoch=0, local_rank=0, lr=0.01, lr_gamma=0.1, lr_step_size=30, momentum=0.9, output_dir='./output', sync_bn=False, weight_decay=1e-05, workers=4, world_size=1)
0%| | 0/18 [00:00<?, ?it/s]
Traceback (most recent call last):
File "F:/pycharm2020.2/crnn.pytorch_generator/train.py", line 195, in
train(arguments)
File "F:/pycharm2020.2/crnn.pytorch_generator/train.py", line 140, in train
loss = train_one_epoch(model, criterion, optimizer, data_loader, device, epoch, args)
File "F:/pycharm2020.2/crnn.pytorch_generator/train.py", line 65, in train_one_epoch
for image, target, input_len, target_len in tqdm(data_loader):
File "C:\Users\Ni\AppData\Local\Programs\Python\Python38\lib\site-packages\tqdm\std.py", line 1165, in iter
for obj in iterable:
File "C:\Users\Ni\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next
data = self._next_data()
File "C:\Users\Ni\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "C:\Users\Ni\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Users\Ni\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "F:\pycharm2020.2\crnn.pytorch_generator\generator.py", line 181, in getitem
image, indices, target_len = self.gen_image()
File "F:\pycharm2020.2\crnn.pytorch_generator\generator.py", line 158, in gen_image
text = np.random.choice(FONT_CHARS_DICT[font_path], target_len)
File "mtrand.pyx", line 908, in numpy.random.mtrand.RandomState.choice
ValueError: 'a' cannot be empty unless no samples are taken

Process finished with exit code 1

from crnn.pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.