Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL broken for ResNet50, 101, 152 #155

Open
XZLeo opened this issue Aug 30, 2023 · 1 comment
Open

URL broken for ResNet50, 101, 152 #155

XZLeo opened this issue Aug 30, 2023 · 1 comment

Comments

@XZLeo
Copy link

XZLeo commented Aug 30, 2023

First of all, thank authors for the neat repo!

When I tested "type": "UNetResnet" and "backbone": "resnet50", there is a bug caused by bad url in this line
I got this error.

python train.py --config config.json
python train.py --config config.json
Downloading: "https://s3.us-west-1.wasabisys.com/encoding/models/resnet50s-a75c83cf.zip" to ./pretrained/resnet50s-a75c83cf.zip
Traceback (most recent call last):
  File "/usr/lib/python3.8/urllib/request.py", line 1354, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.8/http/client.py", line 1256, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1302, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1251, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1011, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 951, in send
    self.connect()
  File "/usr/lib/python3.8/http/client.py", line 1425, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "/usr/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 's3.us-west-1.wasabisys.com'. (_ssl.c:1131)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train.py", line 60, in <module>
    main(config, args.resume)
  File "train.py", line 25, in main
    model = get_instance(models, 'arch', config, train_loader.dataset.num_classes)
  File "train.py", line 15, in get_instance
    return getattr(module, config[name]['type'])(*args, **config[name]['args'])
  File "/home/zilxi06/teaching/tsbb19_semantic_segmentation/models/unet.py", line 129, in __init__
    model = getattr(resnet, backbone)(pretrained, norm_layer=nn.BatchNorm2d)
  File "/home/zilxi06/teaching/tsbb19_semantic_segmentation/models/resnet.py", line 264, in resnet50
    model.load_state_dict(load_url(model_urls['resnet50'], model_dir=root))
  File "/home/zilxi06/teaching/tsbb19_semantic_segmentation/models/resnet.py", line 300, in load_url
    urlretrieve(url, cached_file)
  File "/usr/lib/python3.8/urllib/request.py", line 247, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 1397, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib/python3.8/urllib/request.py", line 1357, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 's3.us-west-1.wasabisys.com'. (_ssl.c:1131)>

Apparently, the link is broken. I tried to replace it with this link found in this page. However, I got another error. How to fix this? Thank you.

python train.py --config config.json
Downloading: "https://download.pytorch.org/models/resnet50-19c8e357.pth" to ./pretrained/resnet50-19c8e357.zip
Traceback (most recent call last):
  File "train.py", line 60, in <module>
    main(config, args.resume)
  File "train.py", line 25, in main
    model = get_instance(models, 'arch', config, train_loader.dataset.num_classes)
  File "train.py", line 15, in get_instance
    return getattr(module, config[name]['type'])(*args, **config[name]['args'])
  File "/home/zilxi06/teaching/tsbb19_semantic_segmentation/models/unet.py", line 129, in __init__
    model = getattr(resnet, backbone)(pretrained, norm_layer=nn.BatchNorm2d)
  File "/home/zilxi06/teaching/tsbb19_semantic_segmentation/models/resnet.py", line 264, in resnet50
    model.load_state_dict(load_url(model_urls['resnet50'], model_dir=root))
  File "/home/zilxi06/teaching/tsbb19_semantic_segmentation/models/resnet.py", line 301, in load_url
    zip_ref = zipfile.ZipFile(cached_file, 'r')
  File "/usr/lib/python3.8/zipfile.py", line 1269, in __init__
    self._RealGetContents()
  File "/usr/lib/python3.8/zipfile.py", line 1336, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
@yassouali
Copy link
Owner

Just checked, the links seem to work, can you please double check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants