本文整理汇总了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')