ypwhs / DogBreed_gluon

kaggle Dog Breed Identification
https://www.kaggle.com/c/dog-breed-identification
126 stars 41 forks source link

error: BadZipFile File is not a zip file #6

Open lisili opened 5 years ago

lisili commented 5 years ago

当我运行get_features.ipynb中的下面这一行: features_vgg, labels = get_features(models.vgg16_bn(pretrained=True, ctx=ctx), data) 程序会运行很久之后便会出现错误BadZipFile File is not a zip file。程序运行时显示是从一个网址下载vgg16_bn-7f01cf05.zip文件,点开这个网址提示说这个xml网址并未包含关联信息,请问这个错误应该如何解决呢?

ypwhs commented 5 years ago

可能是网络问题,你可以参考这个链接里的教程,切换为国内服务器:https://zh.gluon.ai/chapter_prerequisite/install.html

set MXNET_GLUON_REPO=https://apache-mxnet.s3.cn-north-1.amazonaws.com.cn
lisili commented 5 years ago

多谢您的方法,但是设置成了国内服务器以后还是出现了相同错误。想问一下如果想要手动下载的话是要去哪个网站下载呢?

ypwhs commented 5 years ago

mxnet.gluon.model_zoo 中的模型下载链接的计算方法参考:https://github.com/apache/incubator-mxnet/blob/master/python/mxnet/gluon/model_zoo/model_store.py

我们可以写一个简单的程序来计算:

import os
from mxnet.gluon.model_zoo import model_store

def get_model_url(name):
    file_name = '{name}-{short_hash}'.format(name=name, short_hash=model_store.short_hash(name))
    repo_url = os.environ.get('MXNET_GLUON_REPO', model_store.apache_repo_url)
    if repo_url[-1] != '/':
        repo_url = repo_url + '/'
    url = model_store._url_format.format(repo_url=repo_url, file_name=file_name)
    return url

那么就可以得到下面两个下载地址:

lisili commented 5 years ago

我知道啦,十分感谢您的帮助!