本文整理匯總了Python中keras.applications.densenet.py方法的典型用法代碼示例。如果您正苦於以下問題:Python densenet.py方法的具體用法?Python densenet.py怎麽用?Python densenet.py使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類keras.applications.densenet
的用法示例。
在下文中一共展示了densenet.py方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: download_imagenet
# 需要導入模塊: from keras.applications import densenet [as 別名]
# 或者: from keras.applications.densenet import py [as 別名]
def download_imagenet(self):
""" Download pre-trained weights for the specified backbone name.
This name is in the format {backbone}_weights_tf_dim_ordering_tf_
kernels_notop
where backbone is the densenet + number of layers (e.g. densenet121).
For more info check the explanation from the keras densenet script
itself:
https://github.com/keras-team/keras/blob/master/keras/applications
/densenet.py
"""
origin = 'https://github.com/fchollet/deep-learning-models/releases/'\
'download/v0.8/'
file_name = '{}_weights_tf_dim_ordering_tf_kernels_notop.h5'
# load weights
if keras.backend.image_data_format() == 'channels_first':
raise ValueError(
'Weights for "channels_first" format are not available.')
weights_url = origin + file_name.format(self.backbone)
return get_file(file_name.format(self.backbone),
weights_url, cache_subdir='models')
示例2: download_imagenet
# 需要導入模塊: from keras.applications import densenet [as 別名]
# 或者: from keras.applications.densenet import py [as 別名]
def download_imagenet(self):
""" Download pre-trained weights for the specified backbone name.
This name is in the format {backbone}_weights_tf_dim_ordering_tf_kernels_notop
where backbone is the densenet + number of layers (e.g. densenet121).
For more info check the explanation from the keras densenet script itself:
https://github.com/keras-team/keras/blob/master/keras/applications/densenet.py
"""
origin = 'https://github.com/fchollet/deep-learning-models/releases/download/v0.8/'
file_name = '{}_weights_tf_dim_ordering_tf_kernels_notop.h5'
# load weights
if keras.backend.image_data_format() == 'channels_first':
raise ValueError('Weights for "channels_first" format are not available.')
weights_url = origin + file_name.format(self.backbone)
return get_file(file_name.format(self.backbone), weights_url, cache_subdir='models')