一个顶会论文的复现,这个问题周日第一次出现,RuntimeError: output with shape [1, 256, 256] doesn't match the broadcast shape [3, 256, 256]
。
aug 25,21:32,测试单元可以运行,此处记录一下解决办法和工作总结,很小的一个数据流的问题.
修改aligned_dataset文件:
transform_list2 = [transforms.Normalize((0.5, ), (0.5, ))]
即可,当然,后面还有很多东西。
反射出自己的在代码上的几个问题:
首先, 知行合一,hand & mind。手还是不能生的,还是可以比较熟练的去完成好的idea,嫁接自己的框架。要手脑并用。
或许是太久不看代码,自己一直觉这个coding这个东西实在没有什么可看的,流程控制,模块化思维,以及借助相关工具实现相关内容,仅仅是一个工具。有点东西的估计就是面对项目的逻辑思维能力。而自己再次回头不为花田月下,而是用着几千块来深耕自己,如果花大量的时间在上面而不是一些思维和意识的培养,感觉未来也只是高学历码农,重复别人的idea,而不是自己的想法部署。不过前些天看到一个书,书名忘记了,大体就是早些年微软研究员和Google研究员的区别,最大的就是Microsoft的研究员会配个程序员,而Google的可以自己直接上手,不能说自己的是那个配备的程序员,但至少最好是手脑可以并用,而不是缺条腿。
其次, 需要进一步 加大交流,引入负熵,打破自我认知的瓶颈。仅仅停留在身边人是不够的,用好Google和各种社交平台,提高自己的见识和意识。注重培养自己的全局化思维。要和高手在一起。《诗》有之:高山仰止,景行行止。虽不能至,然心向往之。感悟来源,向一个师弟讨论问题,聊了一会儿,说到解决方案,“顶会复现代码,一个月能搞出来就已经很厉害了”;“啥?!我这边无论什么代码从来没超过一周过~”;当然我也从他那里需要一些计算机的思维,比如删除文件可以写个shell脚步来进行,可以极大的提高相关的效率。说实话我TM遇到多余的文件,即使批量的依旧是手欠手动删除,说出来汗颜啊。
最后,既然已经是信息时代了,自己还是接受自己一开始的专业-computer science。我依旧不是个manager,不过,心胸还是要宽阔的,这决定的着以后 的高度,可以接受别人 的意见,采纳听取别人的匹配。
附录,其实进入七月自己对数学相关方面的痴迷有点多,贝叶斯是大体打通了,而且动态思维也有了相关理论的支撑,决策思维感谢博弈论。
高斯,冯诺依曼,纳什,拉普拉斯,维特比,费曼,傅立叶,笛卡尔,柯尔莫哥洛夫,维纳,卡尔曼等等吧,当然最感谢的估计是牛顿和爱因斯坦,一个构建起物理学的基层,后面相对论也在近期有所启示。有机会最后月总结再写,但面对动态世界应用好动态思维模式和相关数理知识的确可以在某些方面和纬度,看到一些不一样的东西,可以更好对一般性问题进行抽象。欧拉不能忘。七夕表白的话,我向你们这些人致敬。
Traceback (most recent call last):
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/urllib3/connection.py", line 187, in connect
conn = self._new_conn()
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/urllib3/connection.py", line 172, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: .connection.HTTPConnection object at 0x7ff13439c4d0>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/urllib3/util/retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8091): Max retries exceeded with url: /env/main (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused' ))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/visdom/__init__.py", line 711, in _send
data=json.dumps(msg),
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/visdom/__init__.py", line 677, in _handle_post
r = self.session.post(url, data=data)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8091): Max retries exceeded with url: /env/main (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused' ))
[Errno 111] Connection refused
#training images = 10
Traceback (most recent call last):
File "train.py", line 86, in
train(opt, data_loader, model, visualizer)
File "train.py", line 23, in train
for i, data in enumerate(dataset):
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 582, in __next__
return self._process_next_batch(batch)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
RuntimeError: Traceback (most recent call last):
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/sata1/lifei/project/DA/data/aligned_dataset.py", line 111, in __getitem__
D = self.transform2(D)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 61, in __call__
img = t(img)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 164, in __call__
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/home/lifei/anaconda3/envs/pytorch/lib/python3.7/site-packages/torchvision/transforms/functional.py", line 208, in normalize
tensor.sub_(mean[:, None, None]).div_(std[:, None, None])
RuntimeError: output with shape [1, 256, 256] doesn't match the broadcast shape [3, 256, 256]