Python resnet.ResNet101() Examples
The following are 2
code examples of resnet.ResNet101().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
resnet
, or try the search function
.
Example #1
Source File: JPU.py From TF.Keras-Commonly-used-models with Apache License 2.0 | 5 votes |
def JPU_DeepLab(img_height=1024, img_width=1024, nclasses=19): base_model = ResNet101(include_top=False, input_shape=[img_height, img_width, 3], weights=None)#'imagenet' endpoint_names = ['conv2_block3_out', 'conv3_block4_out', 'conv4_block23_out', 'conv5_block3_out'] endpoints = [base_model.get_layer(x).output for x in endpoint_names] _, image_features = JPU(endpoints) x_a = ASPP(image_features) h_t, w_t = x_a.shape.as_list()[1:3] scale = (img_height / 4) // h_t, (img_width / 4) // w_t x_a = tf.keras.layers.UpSampling2D( size=scale, interpolation='bilinear')(x_a) x_b = base_model.get_layer('conv2_block3_out').output x_b = conv_block(x_b, num_filters=48, kernel_size=1) x = tf.keras.layers.Concatenate(axis=-1)([x_a, x_b]) x = conv_block(x, num_filters=256, kernel_size=3) x = conv_block(x, num_filters=256, kernel_size=3) h_t, w_t = x.shape.as_list()[1:3] scale = img_height // h_t, img_width // w_t x = tf.keras.layers.UpSampling2D(size=scale, interpolation='bilinear')(x) x = tf.keras.layers.Conv2D(nclasses, (1, 1), name='output_layer')(x) model = tf.keras.Model(inputs=base_model.input, outputs=x, name='JPU') return model
Example #2
Source File: model_factory_dict.py From mixed-precision-pytorch with Do What The F*ck You Want To Public License | 4 votes |
def model_factory(model_name, **params): model_dict = { 'densenet121': DenseNet121, 'densenet169': DenseNet169, 'densenet201': DenseNet201, 'densenet161': DenseNet161, 'densenet-cifar': densenet_cifar, 'dual-path-net-26': DPN26, 'dual-path-net-92': DPN92, 'googlenet': GoogLeNet, 'lenet': LeNet, 'mobilenet': MobileNet, 'mobilenetv2': MobileNetV2, 'pnasneta': PNASNetA, 'pnasnetb': PNASNetB, 'preact-resnet18': PreActResNet18, 'preact-resnet34': PreActResNet34, 'preact-resnet50': PreActResNet50, 'preact-resnet101': PreActResNet101, 'preact-resnet152': PreActResNet152, 'resnet18': ResNet18, 'resnet34': ResNet34, 'resnet50': ResNet50, 'resnet101': ResNet101, 'resnet152': ResNet152, 'resnext29_2x64d': ResNeXt29_2x64d, 'resnext29_4x64d': ResNeXt29_4x64d, 'resnext29_8x64d': ResNeXt29_8x64d, 'resnext29_32x64d': ResNeXt29_32x4d, 'senet18': SENet18, 'shufflenetg2': ShuffleNetG2, 'shufflenetg3': ShuffleNetG3, 'shufflenetv2_0.5': ShuffleNetV2, 'shufflenetv2_1.0': ShuffleNetV2, 'shufflenetv2_1.5': ShuffleNetV2, 'shufflenetv2_2.0': ShuffleNetV2, 'vgg11': VGG, 'vgg13': VGG, 'vgg16': VGG, 'vgg19': VGG, } if 'vgg' in model_name: return model_dict[model_name](model_name) elif 'shufflenetv2' in model_name: return model_dict[model_name](float(model_name[-3:])) elif model_name in model_dict.keys(): return model_dict[model_name]() else: raise AttributeError('Model doesn\'t exist')