当前位置: 首页 > 知识库问答 >
问题:

在kaggle上导入预训练vgg模型时的Gaierror

芮立果
2023-03-14
initial_model = VGG19(weights='imagenet', pooling = max)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

请求中得/opt/conda/lib/python3.6/http/client.py(自,方法,url,正文,头,encode_chunked)1238“”“向服务器发送完整得请求.”“”->1239 self._send_request(方法、url、正文、标头、encode_chunked)1240

/opt/conda/lib/python3.6/http/client.py in_send_request(self,method,url,body,headers,encode_chunked)1284 body=_encode(body,'body')->1285 self.endheaders(body,encode_chunked=encode_chunked)1286

/opt/conda/lib/python3.6/http/client.py in endheaders(self,message_body,encode_chunked)1233 Rise CannotSendHeader()->1234 self._send_output(message_body,encode_chunked=encode_chunked)1235

/opt/conda/lib/python3.6/http/client.py in_send_output(self,message_body,encode_chunked)1025 del self._buffer[:]->1026 self.send(msg)1027

send(self,data)963中的/opt/conda/lib/python3.6/http/client.py if self.auto_open:-->964 self.connect()965 else:

connect(self)1391中的/opt/conda/lib/python3.6/http/client.py->1392 super().connect()1393

connect(self)中的/opt/conda/lib/python3.6/http/client.py 935 self.sock=self._create_connection(-->936(self.host,self.port),self.timeout,self.source_address)937 self.sock.setsockopt(socket.ipproto_tcp,socket.tcp_nodelay,1)

/opt/conda/lib/python3.6/socket.py in create_connection(address,timeout,source_address)703 err=none->704对于getaddrinfo(主机,端口,0,SOCK_STREAM)中的res:705 af,socktype,proto,canonname,sa=res

/opt/conda/lib/python3.6/socket.py in getaddrinfo(host,port,family,type,proto,flags)744 addrlist=[]-->745 for res in_socket.getaddrinfo(host,port,family,type,proto,canonname,sa=res

GaiError:[errno-3]名称解析暂时失败

在处理上述异常时,又发生了一个异常:

URLError Traceback(最近一次调用)/opt/conda/lib/python3.6/site-packages/keras/utils/data_utils.py in get_file(fname,origin,untar,md5_hash,file_hash,cache_subdir,hash_algorithm,extract,archive_format,cache_dir)221 try:-->222 urlretrieve(origin,fpath,dl_progress)223除HTTPError为e:

/opt/conda/lib/python3.6/urllib/request.py在urlretrieve(url,filename,reporthook,data)247中-->248 with contextlib.closing(urlopen(url,data))作为fp:249 headers=fp.info()

/opt/conda/lib/python3.6/urllib/request.py in urlopen(url,data,timeout,cafile,capath,cadefault,context)222 opener=_opener-->223 return opener.open(url,data,timeout)224

/opt/conda/lib/python3.6/urllib/request.py在open(self,fullurl,data,timeout)525中-->526响应=self._open(req,data)527

/opt/conda/lib/python3.6/urllib/request.py in_open(self,req,data)543 result=self._call_chain(self.handle_open,protocol,protocol+-->544“_open”,req)545如果结果:

/opt/conda/lib/python3.6/urllib/request.py in_call_chain(self,chain,kind,meth_name,*args)503 func=getattr(handler,meth_name)-->504 result=func(*args)505如果结果不是none:

/opt/conda/lib/python3.6/urllib/request.py in https_open(self,req)
1360 return self.do_open(http.client.httpsconnection,req,->1361 context=self._context,check_hostname=self._check_hostname)1362

do_open(self,http_class,req,**http_conn_args)1319中的/opt/conda/lib/python3.6/urllib/request.py除OSError为err:#timeout error->1320引发URLError(err)1321 r=h.getresponse()

URLERROR:

在处理上述异常时,又发生了一个异常:

/opt/conda/lib/python3.6/site-packages/keras_applications/VGG19.py在VGG19中(include_top,weights,input_tensor,input_shape,pooling,classes,**kwargs)219WEIGHTS_PATH_NO_TOP,220 cache_subdir='model',-->221 file_hash='253f8cb515780f3b799900260a226db6')222 model.load_weights(weights_path)223 if

/opt/conda/lib/python3.6/site-packages/keras/utils/data_utils.py在get_file(fname,origin,untar,md5_hash,file_hash,cache_subdir,hash_algorithm,extract,archive_format,cache_algorithm,extract,archive_format,cache_dir)224引发异常(Error_msg.format(origin,e.code,e.msg))225除URLError为e:-->226引发异常

异常:https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg19_weights_tf_dim_ordering_tf_kernels_notop上的URL提取失败。h5:无--[errno-3]名称解析暂时失败

共有1个答案

齐向笛
2023-03-14

看起来您可能没有在内核中启用internet访问。您可以在右侧的面板中这样做。一旦您添加了internet连接,您就可以下载文件了。

我们实际上也已经有VGG-19重量上传到Kaggle。如果您愿意,您可以将这个现有的数据集添加到内核中,而不是下载它,这对您来说可能会稍微快一点。

希望有帮助!:)

 类似资料:
  • 错误为: 谁能帮帮我吗?

  • 问题内容: 我正在使用PyCaffe来实现受VGG 16层网络启发的神经网络。我想使用可从其GitHub页面上获得的预训练模型。通常,这通过匹配图层名称来起作用。 对于我的图层,我的train.prototxt文件中具有以下定义: 这是VGG-16部署体系结构的prototxt文件。请注意,他们的原型中的与我的相同(除了学习率,但这无关紧要)。还值得注意的是,输入在我的模型中也都是相同大小的:3通

  • 本文向大家介绍Keras使用ImageNet上预训练的模型方式,包括了Keras使用ImageNet上预训练的模型方式的使用技巧和注意事项,需要的朋友参考一下 我就废话不多说了,大家还是直接看代码吧! 在以上代码中,我们首先import各种模型对应的module,然后load模型,并用ImageNet的参数初始化模型的参数。 如果不想使用ImageNet上预训练到的权重初始话模型,可以将各语句的中

  • 在之前的描述中,我们通常把机器学习模型和训练算法当作黑箱子来处理。如果你实践过前几章的一些示例,你惊奇的发现你可以优化回归系统,改进数字图像的分类器,你甚至可以零基础搭建一个垃圾邮件的分类器,但是你却对它们内部的工作流程一无所知。事实上,许多场合你都不需要知道这些黑箱子的内部有什么,干了什么。 然而,如果你对其内部的工作流程有一定了解的话,当面对一个机器学习任务时候,这些理论可以帮助你快速的找到恰

  • 在之前的描述中,我们通常把机器学习模型和训练算法当作黑箱子来处理。如果你实践过前几章的一些示例,你惊奇的发现你可以优化回归系统,改进数字图像的分类器,你甚至可以零基础搭建一个垃圾邮件的分类器,但是你却对它们内部的工作流程一无所知。事实上,许多场合你都不需要知道这些黑箱子的内部有什么,干了什么。 然而,如果你对其内部的工作流程有一定了解的话,当面对一个机器学习任务时候,这些理论可以帮助你快速的找到恰

  • 文章信息 通过本教程,你可以掌握技能:使用预先训练的词向量和卷积神经网络解决一个文本分类问题 本文代码已上传到Github 本文地址:http://blog.keras.io/using-pre-trained-word-embeddings-in-a-keras-model.html 本文作者:Francois Chollet 什么是词向量? ”词向量”(词嵌入)是将一类将词的语义映射到向量空间