当前位置:   article > 正文

ConnectionRefusedError: [Errno 111] Connection refused_spyder connectionrefusederror: [errno 111] connect

spyder connectionrefusederror: [errno 111] connection refused

在网络连接良好的情况下训练网络,训练的时候突然出现ConnectionRefusedError: [Errno 111] Connection refused,而且此时第一个Epoch还没有运行完成!

有可能是训练数据出了问题。比如,如下报错信息:

  1. Traceback (most recent call last):
  2. File "train.py", line 90, in <module>
  3. train(opt, data_loader, model, visualizer)
  4. File "train.py", line 34, in train
  5. for i, data in enumerate(dataset):
  6. File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 267, in __next__
  7. return self._process_next_batch(batch)
  8. File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 301, in _process_next_batch
  9. raise batch.exc_type(batch.exc_msg)
  10. OSError: Traceback (most recent call last):
  11. File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 55, in _worker_loop
  12. samples = collate_fn([dataset[i] for i in batch_indices])
  13. File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 55, in <listcomp>
  14. samples = collate_fn([dataset[i] for i in batch_indices])
  15. File "/********/DeepLearningLCT/DeblurGAN-master/self_data_multitask_1024/data/aligned_dataset.py", line 31, in __getitem__
  16. AB = Image.open(AB_path).convert('L')
  17. File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/PIL/Image.py", line 2687, in open
  18. % (filename if filename else fp))
  19. OSError: cannot identify image file './data/data_1024/AB/train/31636_7.png'
  20. Exception ignored in: <bound method DataLoaderIter.__del__ of <torch.utils.data.dataloader.DataLoaderIter object at 0x7fdfd12f43c8>>
  21. Traceback (most recent call last):
  22. File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 333, in __del__
  23. self._shutdown_workers()
  24. File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 319, in _shutdown_workers
  25. self.data_queue.get()
  26. File "/********anaconda3/envs/python36/lib/python3.6/multiprocessing/queues.py", line 337, in get
  27. return _ForkingPickler.loads(res)
  28. File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/multiprocessing/reductions.py", line 70, in rebuild_storage_fd
  29. fd = df.detach()
  30. File "/********/anaconda3/envs/python36/lib/python3.6/multiprocessing/resource_sharer.py", line 57, in detach
  31. with _resource_sharer.get_connection(self._id) as conn:
  32. File "/********/anaconda3/envs/python36/lib/python3.6/multiprocessing/resource_sharer.py", line 87, in get_connection
  33. c = Client(address, authkey=process.current_process().authkey)
  34. File "/********/anaconda3/envs/python36/lib/python3.6/multiprocessing/connection.py", line 487, in Client
  35. c = SocketClient(address)
  36. File "/********/anaconda3/envs/python36/lib/python3.6/multiprocessing/connection.py", line 614, in SocketClient
  37. s.connect(address)
  38. ConnectionRefusedError: [Errno 111] Connection refused

问题并不出在服务器的网络连接上,而是出在训练集中的 './data/data_1024/AB/train/31636_7.png'上。

 

例如:

生成该图像的代码错误中止导致该图像无法正常读取。

 

解决方法:

重新生成训练数据。

 

成功解决

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/148348?site
推荐阅读
相关标签
  

闽ICP备14008679号