toandaominh1997 / EfficientDet.Pytorch

Implementation EfficientDet: Scalable and Efficient Object Detection in PyTorch
MIT License
1.44k stars 306 forks source link

EfficientNet backbones are not reachable #106

Open hodgka opened 4 years ago

hodgka commented 4 years ago

When I try to train the EfficientNet-D0 model, I run into an issue when it hits the load_pretrained_weights function in models/utils.py. The code returns a HTTP 403 when trying to access the models on the google storage api. When I try to manually download the models, I also receive a 403 in the browser. This seems like a permission setting may have gotten changed somehow.

As a workaround I found the url map from lukemelas' implementation of EfficientNet, found here.

The actual traceback is below:

Downloading: "http://storage.googleapis.com/public-models/efficientnet/efficientnet-b0-355c32eb.pth" to /u/home/hodgkinsona/.cache/torch/checkpoints/efficientnet-b0-355c32eb.pth
Traceback (most recent call last):
  File "train.py", line 334, in <module>
    main()
  File "train.py", line 330, in main
    main_worker(args.gpu, ngpus_per_node, args)
  File "train.py", line 233, in main_worker
    D_class=EFFICIENTDET[args.network]['D_class']
  File "/u/big/workspace_hodgkinsona/EfficientDet.Pytorch/models/efficientdet.py", line 33, in __init__
    self.backbone = EfficientNet.from_pretrained(MODEL_MAP[network])
  File "/u/big/workspace_hodgkinsona/EfficientDet.Pytorch/models/efficientnet.py", line 243, in from_pretrained
    model, model_name, load_fc=(num_classes == 1000))
  File "/u/big/workspace_hodgkinsona/EfficientDet.Pytorch/models/utils.py", line 319, in load_pretrained_weights
    state_dict = model_zoo.load_url(url_map[model_name])
  File "/u/home/hodgkinsona/.local/lib/python3.6/site-packages/torch/hub.py", line 492, in load_state_dict_from_url
    download_url_to_file(url, cached_file, hash_prefix, progress=progress)
  File "/u/home/hodgkinsona/.local/lib/python3.6/site-packages/torch/hub.py", line 391, in download_url_to_file
    u = urlopen(url)
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
NAcvat commented 4 years ago

The url map from lukemelas' worked for you?

hodgka commented 4 years ago

Yes. I used the one on line 298 rather than the one on line 310

Cyril9227 commented 4 years ago

Need to update the code base according to : https://github.com/toandaominh1997/EfficientDet.Pytorch/pull/111