layout-parser
layout-parser copied to clipboard
urllib.error.URLError: <urlopen error [Errno 101] Network is unreachable>
There is something wrong with running this code. Could you please help to check? Thanks very much.
`import cv2 import layoutparser as lp
model = lp.Detectron2LayoutModel('lp://PubLayNet/faster_rcnn_R_50_FPN_3x/config', extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.8], label_map={0: "text", 1: "title", 2: "list", 3:"table", 4:"figure"})
image = cv2.imread("./examples/data/paper-image.jpg") layout = model.detect(image)`
Traceback (most recent call last): File "test_detection.py", line 6, in <module> model = lp.Detectron2LayoutModel('lp://PubLayNet/faster_rcnn_R_50_FPN_3x/config', File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/layoutparser/models/detectron2/layoutmodel.py", line 91, in __init__ config_path = PathManager.get_local_path(config_path) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/iopath/common/file_io.py", line 1197, in get_local_path bret = handler._get_local_path(path, force=force, **kwargs) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/layoutparser/models/detectron2/catalog.py", line 136, in _get_local_path return PathManager.get_local_path(model_url, **kwargs) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/iopath/common/file_io.py", line 1197, in get_local_path bret = handler._get_local_path(path, force=force, **kwargs) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/iopath/common/file_io.py", line 797, in _get_local_path cached = download(path, dirname, filename=filename) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/iopath/common/download.py", line 58, in download tmp, _ = request.urlretrieve(url, filename=tmp, reporthook=hook(t)) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 247, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 525, in open response = self._open(req, data) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 542, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 502, in _call_chain result = func(*args) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 1397, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 1357, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 101] Network is unreachable>
I think it's related to #119
I am also facing same error
There is something wrong with running this code. Could you please help to check? Thanks very much.
`import cv2 import layoutparser as lp
model = lp.Detectron2LayoutModel('lp://PubLayNet/faster_rcnn_R_50_FPN_3x/config', extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.8], label_map={0: "text", 1: "title", 2: "list", 3:"table", 4:"figure"})
image = cv2.imread("./examples/data/paper-image.jpg") layout = model.detect(image)`
Traceback (most recent call last): File "test_detection.py", line 6, in <module> model = lp.Detectron2LayoutModel('lp://PubLayNet/faster_rcnn_R_50_FPN_3x/config', File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/layoutparser/models/detectron2/layoutmodel.py", line 91, in __init__ config_path = PathManager.get_local_path(config_path) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/iopath/common/file_io.py", line 1197, in get_local_path bret = handler._get_local_path(path, force=force, **kwargs) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/layoutparser/models/detectron2/catalog.py", line 136, in _get_local_path return PathManager.get_local_path(model_url, **kwargs) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/iopath/common/file_io.py", line 1197, in get_local_path bret = handler._get_local_path(path, force=force, **kwargs) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/iopath/common/file_io.py", line 797, in _get_local_path cached = download(path, dirname, filename=filename) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/site-packages/iopath/common/download.py", line 58, in download tmp, _ = request.urlretrieve(url, filename=tmp, reporthook=hook(t)) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 247, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 525, in open response = self._open(req, data) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 542, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 502, in _call_chain result = func(*args) File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 1397, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/home/ubuntu/anaconda3/envs/layout-parser/lib/python3.8/urllib/request.py", line 1357, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 101] Network is unreachable>
I am also facing same error. Please tell me how you solved this problem.