ConnectionRefusedError: [Errno 111] Connection refused

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

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

Traceback (most recent call last):
  File "train.py", line 90, in <module>
    train(opt, data_loader, model, visualizer)
  File "train.py", line 34, in train
    for i, data in enumerate(dataset):
  File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 267, in __next__
    return self._process_next_batch(batch)
  File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 301, in _process_next_batch
    raise batch.exc_type(batch.exc_msg)
OSError: Traceback (most recent call last):
  File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 55, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 55, in <listcomp>
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/********/DeepLearningLCT/DeblurGAN-master/self_data_multitask_1024/data/aligned_dataset.py", line 31, in __getitem__
    AB = Image.open(AB_path).convert('L')
  File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/PIL/Image.py", line 2687, in open
    % (filename if filename else fp))
OSError: cannot identify image file './data/data_1024/AB/train/31636_7.png'

Exception ignored in: <bound method DataLoaderIter.__del__ of <torch.utils.data.dataloader.DataLoaderIter object at 0x7fdfd12f43c8>>
Traceback (most recent call last):
  File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 333, in __del__
    self._shutdown_workers()
  File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 319, in _shutdown_workers
    self.data_queue.get()
  File "/********anaconda3/envs/python36/lib/python3.6/multiprocessing/queues.py", line 337, in get
    return _ForkingPickler.loads(res)
  File "/********/anaconda3/envs/python36/lib/python3.6/site-packages/torch/multiprocessing/reductions.py", line 70, in rebuild_storage_fd
    fd = df.detach()
  File "/********/anaconda3/envs/python36/lib/python3.6/multiprocessing/resource_sharer.py", line 57, in detach
    with _resource_sharer.get_connection(self._id) as conn:
  File "/********/anaconda3/envs/python36/lib/python3.6/multiprocessing/resource_sharer.py", line 87, in get_connection
    c = Client(address, authkey=process.current_process().authkey)
  File "/********/anaconda3/envs/python36/lib/python3.6/multiprocessing/connection.py", line 487, in Client
    c = SocketClient(address)
  File "/********/anaconda3/envs/python36/lib/python3.6/multiprocessing/connection.py", line 614, in SocketClient
    s.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused

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

 

例如:

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

 

解决方法:

重新生成训练数据。

 

成功解决

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不再更新,请勿购买!!

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值