qinnzou / DeepCrack

DeepCrack: Learning Hierarchical Convolutional Features for Crack Detection
253 stars 60 forks source link

I encountered a problem about socket connection failure. #7

Closed JasonChenhx closed 1 year ago

JasonChenhx commented 4 years ago

I don't know why I encountered this kind of problem. I checked the code and found that there is no code related to socket. Is it because the communication between multiple GPUs requires socket?

qinnzou commented 4 years ago

We do not use the socket in our codes. Is it the problem when you are using cloud computing resources?

ake020675 commented 3 years ago

I think i meet the same problem when i run test.py, and the error message is like :

Setting up a new session... Exception in user code:

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 141, in _new_conn (self.host, self.port), self.timeout, **extra_kw) File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 83, in create_connection raise err File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen chunked=chunked) File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 357, in _make_request conn.request(method, url, **httplib_request_kw) File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1285, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1234, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1026, in _send_output self.send(msg) File "C:\ProgramData\Anaconda3\lib\http\client.py", line 964, in send self.connect() File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 166, in connect conn = self._new_conn() File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 150, in _new_conn self, "Failed to establish a new connection: %s" % e) urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000024A9250D160>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 440, in send timeout=timeout File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen _stacktrace=sys.exc_info()[2]) File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\retry.py", line 388, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8097): Max retries exceeded with url: /env/DeepCrack (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000024A9250D160>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\visdom__init.py", line 711, in _send data=json.dumps(msg), File "C:\ProgramData\Anaconda3\lib\site-packages\visdom__init__.py", line 677, in _handle_post r = self.session.post(url, data=data) File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 555, in post return self.request('POST', url, data=data, json=json, kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 508, in request resp = self.send(prep, send_kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 618, in send r = adapter.send(request, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 508, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8097): Max retries exceeded with url: /env/DeepCrack (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000024A9250D160>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',)) Without the incoming socket you cannot receive events from the server or register event handlers to your Visdom client. Loaded checkpoint: checkpoints/DeepCrack_CT260_FT1.pth 0it [00:00, ?it/s] Traceback (most recent call last): File "D:/火眼智能/裂缝检测/DeepCrack-master/codes/test.py", line 58, in test() File "D:/火眼智能/裂缝检测/DeepCrack-master/codes/test.py", line 44, in test for names, (img, lab) in tqdm(zip(test_list, test_loader)): File "C:\ProgramData\Anaconda3\lib\site-packages\tqdm\std.py", line 1178, in iter for obj in iterable: File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 345, in next data = self._next_data() File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 856, in _next_data return self._process_data(data) File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 881, in _process_data data.reraise() File "C:\ProgramData\Anaconda3\lib\site-packages\torch_utils.py", line 395, in reraise raise self.exc_type(msg) IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data_utils\worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "D:\火眼智能\裂缝检测\DeepCrack-master\codes\data\dataset.py", line 80, in getitem return self.preprocess(self.dataset[index]) File "D:\火眼智能\裂缝检测\DeepCrack-master\codes\data\dataset.py", line 30, in call__ lab = cv2.imread(item[1]) IndexError: list index out of range

ake020675 commented 3 years ago

SOLVED. The problem is caused by visdom which is used for visualization. You need to type "python -m visdom.server" in Terminal and visit http://localhost:8097/ before you run test.py or train.py

ywx980615 commented 2 years ago

I have tried a piece of code from Zhihu to solve this problem https://zhuanlan.zhihu.com/p/54389036?tdsourcetag=s_pctim_aiomsg The full code block is :

! npm install -g localtunnel get_ipython().system_raw('python3 -m pip install visdom') get_ipython().system_raw('python3 -m visdom.server -port 8097 >> visdomlog.txt 2>&1 &')
get_ipython().system_raw('lt --port 8097 >> url.txt 2>&1 &')
import time time.sleep(5) ! cat url.txt import visdom time.sleep(5) vis = visdom.Visdom(port='8097')
print(vis) time.sleep(3) vis.text('testing') ! cat visdomlog.txt

I try this code in colab and insert it before test.py. It solve the problem of socket connection error.

qinnzou commented 1 year ago

@ywx980615 thanks

tamimdnan6240 commented 1 year ago

SOLVED. The problem is caused by visdom which is used for visualization. You need to type "python -m visdom.server" in Terminal and visit http://localhost:8097/ before you run test.py or train.py

Hi, I did this. First, I called python -m visdom.server, then I clicked the http://localhost:8097/.

Then I kept this open and then opened another anaconda command prompt. It was running but gave one error message "ERROR:tornado.general:Could not open static file 'C:\Users\tamim\anaconda3\envs\DeepCrack_Master\lib\site-package". But it was running.

so, by keeping this on, I called train.py in the another anaconda command prompt. Then the message was that "Without the incoming socket you cannot receive events from the server or register event handlers to your Visdom client."

Can you please explain where I made the mistakes?

ake020675 commented 1 year ago

SOLVED. The problem is caused by visdom which is used for visualization. You need to type "python -m visdom.server" in Terminal and visit http://localhost:8097/ before you run test.py or train.py

Hi, I did this. First, I called python -m visdom.server, then I clicked the http://localhost:8097/.

Then I kept this open and then opened another anaconda command prompt. It was running but gave one error message "ERROR:tornado.general:Could not open static file 'C:\Users\tamim\anaconda3\envs\DeepCrack_Master\lib\site-package". But it was running.

so, by keeping this on, I called train.py in the another anaconda command prompt. Then the message was that "Without the incoming socket you cannot receive events from the server or register event handlers to your Visdom client."

Can you please explain where I made the mistakes?

I've no idea. Sorry it was a long time ago when i answered. Basically you need to run and visit visdom server before u train or test the model.