class AlexNet(Model): """Original AlexNet weights ported to TF. AlexNet is the breakthrough vision model from Krizhevsky, et al (2012): https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf This implementation is a caffe re-implementation: http://www.cs.toronto.edu/~guerzhoy/tf_alexnet/ It was converted to TensorFlow by this GitHub project: https://github.com/huanzhang12/tensorflow-alexnet-model It appears the parameters are the actual original parameters. """ # The authors of code to convert AlexNet to TF host weights at # http://jaina.cs.ucdavis.edu/datasets/adv/imagenet/alexnet_frozen.pb # but it seems more polite and reliable to host our own. model_path = 'gs://modelzoo/vision/other_models/AlexNet.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard.txt' dataset = 'ImageNet' image_shape = [227, 227, 3] is_BGR = True image_value_range = (-IMAGENET_MEAN_BGR, 255-IMAGENET_MEAN_BGR) input_name = 'Placeholder' # TODO - Sanity check this graph and layers layers = _layers_from_list_of_dicts([ {'tags': ['conv'], 'name': 'concat_2', 'depth': 256}, {'tags': ['conv'], 'name': 'conv5_1', 'depth': 256}, {'tags': ['dense'], 'name': 'Relu', 'depth': 4096}, {'tags': ['dense'], 'name': 'Relu_1', 'depth': 4096}, {'tags': ['dense'], 'name': 'Softmax', 'depth': 1000}, ])
class InceptionV1_caffe(Model): """InceptionV1 (or 'GoogLeNet') as reimplemented in caffe. This model is a reimplementation of GoogLeNet: https://www.cs.unc.edu/~wliu/papers/GoogLeNet.pdf reimplemented in caffe by BVLC / Sergio Guadarrama: https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet and then ported to TensorFlow using caffe-tensorflow. """ model_path = 'gs://modelzoo/vision/caffe_models/InceptionV1.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard.txt' dataset = 'ImageNet' image_shape = [224, 224, 3] is_BGR = True image_value_range = (-IMAGENET_MEAN_BGR, 255-IMAGENET_MEAN_BGR) input_name = 'data' layers = _layers_from_list_of_dicts([ {'tags': ['conv'], 'name': 'conv1_7x7_s2/conv1_7x7_s2', 'depth': 64}, {'tags': ['conv'], 'name': 'conv2_3x3_reduce/conv2_3x3_reduce', 'depth': 64}, {'tags': ['conv'], 'name': 'conv2_3x3/conv2_3x3', 'depth': 192}, {'tags': ['conv'], 'name': 'inception_3a_output', 'depth': 256}, {'tags': ['conv'], 'name': 'inception_3b_output', 'depth': 480}, {'tags': ['conv'], 'name': 'inception_4a_output', 'depth': 512}, {'tags': ['conv'], 'name': 'inception_4b_output', 'depth': 512}, {'tags': ['conv'], 'name': 'inception_4c_output', 'depth': 512}, {'tags': ['conv'], 'name': 'inception_4d_output', 'depth': 528}, {'tags': ['conv'], 'name': 'inception_4e_output', 'depth': 832}, {'tags': ['conv'], 'name': 'inception_5a_output', 'depth': 832}, {'tags': ['conv'], 'name': 'inception_5b_output', 'depth': 1024}, {'tags': ['dense'], 'name': 'prob', 'depth': 1000}, ])
class ResnetV2_101_slim(Model): """ResnetV2_101 as implemented by the TensorFlow slim framework. ResnetV2_101 was introduced by He, et al (2016): https://arxiv.org/pdf/1603.05027.pdf This function provides the pre-trained reimplementation from TF slim: https://github.com/tensorflow/models/tree/master/research/slim corresponding to the name "resnet_v2_101". """ model_path = 'gs://modelzoo/vision/slim_models/ResnetV2_101.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard_with_dummy.txt' dataset = 'ImageNet' image_shape = [224, 224, 3] # inpute range taken from: # https://github.com/tensorflow/models/blob/master/research/slim/preprocessing/inception_preprocessing.py#L280 image_value_range = (-1, 1) input_name = 'input' layers = _layers_from_list_of_dicts([ {'tags': ['conv'], 'name': 'resnet_v2_101/block1/unit_1/bottleneck_v2/preact/Relu', 'depth': 64}, {'tags': ['conv'], 'name': 'resnet_v2_101/block1/unit_1/bottleneck_v2/add', 'depth': 256}, {'tags': ['conv'], 'name': 'resnet_v2_101/block1/unit_2/bottleneck_v2/add', 'depth': 256}, {'tags': ['conv'], 'name': 'resnet_v2_101/block1/unit_3/bottleneck_v2/add', 'depth': 256}, {'tags': ['conv'], 'name': 'resnet_v2_101/block2/unit_1/bottleneck_v2/preact/Relu', 'depth': 256}, {'tags': ['conv'], 'name': 'resnet_v2_101/block2/unit_1/bottleneck_v2/add', 'depth': 512}, {'tags': ['conv'], 'name': 'resnet_v2_101/block2/unit_2/bottleneck_v2/add', 'depth': 512}, {'tags': ['conv'], 'name': 'resnet_v2_101/block2/unit_3/bottleneck_v2/add', 'depth': 512}, {'tags': ['conv'], 'name': 'resnet_v2_101/block2/unit_4/bottleneck_v2/add', 'depth': 512}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_1/bottleneck_v2/preact/Relu', 'depth': 512}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_1/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_2/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_3/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_4/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_5/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_6/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_7/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_8/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_9/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_10/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_11/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_12/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_13/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_14/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_15/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_16/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_17/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_18/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_19/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_20/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_21/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_22/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block3/unit_23/bottleneck_v2/add', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block4/unit_1/bottleneck_v2/preact/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v2_101/block4/unit_1/bottleneck_v2/add', 'depth': 2048}, {'tags': ['conv'], 'name': 'resnet_v2_101/block4/unit_2/bottleneck_v2/add', 'depth': 2048}, {'tags': ['conv'], 'name': 'resnet_v2_101/block4/unit_3/bottleneck_v2/add', 'depth': 2048}, {'tags': ['conv'], 'name': 'resnet_v2_101/postnorm/Relu', 'depth': 2048}, {'tags': ['dense'], 'name': 'resnet_v2_101/predictions/Softmax', 'depth': 1001}, ])
class InceptionV1_caffe_Places365(Model): """InceptionV1 (or 'GoogLeNet') trained on Places365. This model is a caffe reimplementation of GoogLeNet: https://www.cs.unc.edu/~wliu/papers/GoogLeNet.pdf trained on the MIT Places365 dataset, retrieved here: https://github.com/CSAILVision/places365 and then ported to TensorFlow using caffe-tensorflow. """ model_path = 'gs://modelzoo/vision/caffe_models/InceptionV1_places365.pb' labels_path = 'gs://modelzoo/labels/Places365.txt' dataset = 'Places365' image_shape = [224, 224, 3] # What is the correct input range??? is_BGR = True image_value_range = (-IMAGENET_MEAN_BGR, 255-IMAGENET_MEAN_BGR) input_name = 'data' layers = _layers_from_list_of_dicts([ {'tags': ['conv'], 'name': 'conv1_7x7_s2/conv1_7x7_s2', 'depth': 64}, {'tags': ['conv'], 'name': 'conv2_3x3_reduce/conv2_3x3_reduce', 'depth': 64}, {'tags': ['conv'], 'name': 'conv2_3x3/conv2_3x3', 'depth': 192}, {'tags': ['conv'], 'name': 'inception_3a_output', 'depth': 256}, {'tags': ['conv'], 'name': 'inception_3b_output', 'depth': 480}, {'tags': ['conv'], 'name': 'inception_4a_output', 'depth': 512}, {'tags': ['conv'], 'name': 'inception_4b_output', 'depth': 512}, {'tags': ['conv'], 'name': 'inception_4c_output', 'depth': 512}, {'tags': ['conv'], 'name': 'inception_4d_output', 'depth': 528}, {'tags': ['conv'], 'name': 'inception_4e_output', 'depth': 832}, {'tags': ['conv'], 'name': 'inception_5a_output', 'depth': 832}, {'tags': ['conv'], 'name': 'inception_5b_output', 'depth': 1024}, {'tags': ['dense'], 'name': 'prob', 'depth': 365}, ])
class ResnetV1_101_slim(Model): """ResnetV1101 as implemented by the TensorFlow slim framework. This function provides the pre-trained reimplementation from TF slim: https://github.com/tensorflow/models/tree/master/research/slim """ model_path = 'gs://modelzoo/vision/slim_models/ResnetV1_101.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard.txt' dataset = 'ImageNet' image_shape = [224, 224, 3] image_value_range = (-117, 255-117) # Inferred by testing, may not be exactly right input_name = 'input' # In ResNetV1, each add (joining the residual branch) is followed by a Relu # this seems to be the natural "layer" position layers = _layers_from_list_of_dicts([ {'tags': ['conv'], 'name': 'resnet_v1_101/conv1/Relu', 'depth': 64}, {'tags': ['conv'], 'name': 'resnet_v1_101/block1/unit_1/bottleneck_v1/Relu', 'depth': 256}, {'tags': ['conv'], 'name': 'resnet_v1_101/block1/unit_2/bottleneck_v1/Relu', 'depth': 256}, {'tags': ['conv'], 'name': 'resnet_v1_101/block1/unit_3/bottleneck_v1/Relu', 'depth': 256}, {'tags': ['conv'], 'name': 'resnet_v1_101/block2/unit_1/bottleneck_v1/Relu', 'depth': 512}, {'tags': ['conv'], 'name': 'resnet_v1_101/block2/unit_2/bottleneck_v1/Relu', 'depth': 512}, {'tags': ['conv'], 'name': 'resnet_v1_101/block2/unit_3/bottleneck_v1/Relu', 'depth': 512}, {'tags': ['conv'], 'name': 'resnet_v1_101/block2/unit_4/bottleneck_v1/Relu', 'depth': 512}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_1/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_2/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_3/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_4/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_5/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_6/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_7/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_8/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_9/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_10/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_11/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_12/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_13/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_14/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_15/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_16/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_17/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_18/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_19/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_20/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_21/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_22/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block3/unit_23/bottleneck_v1/Relu', 'depth': 1024}, {'tags': ['conv'], 'name': 'resnet_v1_101/block4/unit_1/bottleneck_v1/Relu', 'depth': 2048}, {'tags': ['conv'], 'name': 'resnet_v1_101/block4/unit_2/bottleneck_v1/Relu', 'depth': 2048}, {'tags': ['conv'], 'name': 'resnet_v1_101/block4/unit_3/bottleneck_v1/Relu', 'depth': 2048}, {'tags': ['dense'], 'name': 'resnet_v1_101/predictions/Softmax', 'depth': 1000}, ])
class AlexNet_caffe_Places365(Model): """AlexNet re-implementation trained on Places365. This model is a reimplementation of AlexNet https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf trained on the MIT Places365 dataset, retrieved here: https://github.com/CSAILVision/places365 and then ported to TensorFlow using caffe-tensorflow. """ model_path = 'gs://modelzoo/vision/caffe_models/AlexNet_places365.pb' labels_path = 'gs://modelzoo/labels/Places365.txt' dataset = 'Places365' image_shape = [227, 227, 3] is_BGR = True image_value_range = (-IMAGENET_MEAN_BGR, 255 - IMAGENET_MEAN_BGR) input_name = 'input' # TODO - Sanity check this graph and layers layers = _layers_from_list_of_dicts([ { 'tags': ['conv'], 'name': 'conv5/concat', 'depth': 256 }, { 'tags': ['conv'], 'name': 'conv5/conv5', 'depth': 256 }, { 'tags': ['dense'], 'name': 'fc6/fc6', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'fc7/fc7', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'prob', 'depth': 365 }, ])
class CaffeNet_caffe(Model): """CaffeNet (AlexNet variant included in Caffe) CaffeNet is a slight variant on AlexNet, described here: https://github.com/BVLC/caffe/tree/master/models/bvlc_reference_caffenet """ model_path = 'gs://modelzoo/vision/caffe_models/CaffeNet.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard.txt' dataset = 'ImageNet' image_shape = [227, 227, 3] is_BGR = True image_value_range = (-IMAGENET_MEAN_BGR, 255 - IMAGENET_MEAN_BGR) input_name = 'data' layers = _layers_from_list_of_dicts([ { 'tags': ['conv'], 'name': 'conv5/concat', 'depth': 256 }, { 'tags': ['conv'], 'name': 'conv5/conv5', 'depth': 256 }, { 'tags': ['dense'], 'name': 'fc6/fc6', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'fc7/fc7', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'prob', 'depth': 1000 }, ])
ResnetV2_50_slim.layers = _layers_from_list_of_dicts(ResnetV2_50_slim(), [ { 'tags': ['conv'], 'name': 'resnet_v2_50/block1/unit_1/bottleneck_v2/preact/Relu', 'depth': 64 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block1/unit_1/bottleneck_v2/add', 'depth': 256 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block1/unit_2/bottleneck_v2/add', 'depth': 256 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block1/unit_3/bottleneck_v2/add', 'depth': 256 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block2/unit_1/bottleneck_v2/preact/Relu', 'depth': 256 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block2/unit_1/bottleneck_v2/add', 'depth': 512 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block2/unit_2/bottleneck_v2/add', 'depth': 512 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block2/unit_3/bottleneck_v2/add', 'depth': 512 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block2/unit_4/bottleneck_v2/add', 'depth': 512 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block3/unit_1/bottleneck_v2/preact/Relu', 'depth': 512 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block3/unit_1/bottleneck_v2/add', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block3/unit_2/bottleneck_v2/add', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block3/unit_3/bottleneck_v2/add', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block3/unit_4/bottleneck_v2/add', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block3/unit_5/bottleneck_v2/add', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block3/unit_6/bottleneck_v2/add', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block4/unit_1/bottleneck_v2/preact/Relu', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block4/unit_1/bottleneck_v2/add', 'depth': 2048 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block4/unit_2/bottleneck_v2/add', 'depth': 2048 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/block4/unit_3/bottleneck_v2/add', 'depth': 2048 }, { 'tags': ['conv'], 'name': 'resnet_v2_50/postnorm/Relu', 'depth': 2048 }, { 'tags': ['dense'], 'name': 'resnet_v2_50/predictions/Softmax', 'depth': 1001 }, ])
CovidNetB.layers = _layers_from_list_of_dicts(CovidNetB(), [ { 'tags': ['conv'], 'name': 'conv5_block3_out/add', 'depth': 2048 }, { 'tags': ['conv'], 'name': 'conv5_block2_out/add', 'depth': 2048 }, { 'tags': ['conv'], 'name': 'conv5_block1_out/add', 'depth': 2048 }, { 'tags': ['conv'], 'name': 'conv4_block6_out/add', 'depth': 824 }, { 'tags': ['conv'], 'name': 'conv4_block5_out/add', 'depth': 824 }, { 'tags': ['conv'], 'name': 'conv4_block4_out/add', 'depth': 824 }, { 'tags': ['conv'], 'name': 'conv4_block3_out/add', 'depth': 824 }, { 'tags': ['conv'], 'name': 'conv4_block2_out/add', 'depth': 824 }, { 'tags': ['conv'], 'name': 'conv4_block1_out/add', 'depth': 824 }, { 'tags': ['conv'], 'name': 'conv3_block4_out/add', 'depth': 416 }, { 'tags': ['conv'], 'name': 'conv3_block3_out/add', 'depth': 416 }, { 'tags': ['conv'], 'name': 'conv3_block2_out/add', 'depth': 416 }, { 'tags': ['conv'], 'name': 'conv3_block1_out/add', 'depth': 416 }, { 'tags': ['conv'], 'name': 'conv2_block3_out/add', 'depth': 200 }, { 'tags': ['conv'], 'name': 'conv2_block2_out/add', 'depth': 200 }, { 'tags': ['conv'], 'name': 'conv2_block1_out/add', 'depth': 200 }, { 'tags': ['dense'], 'name': 'norm_dense_1/Softmax', 'depth': 3 }, ])
InceptionV1_slim.layers = _layers_from_list_of_dicts(InceptionV1_slim, [ { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Conv2d_1a_7x7/Relu', 'depth': 64 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Conv2d_2b_1x1/Relu', 'depth': 64 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Conv2d_2c_3x3/Relu', 'depth': 192 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_3b/concat', 'depth': 256 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_3c/concat', 'depth': 480 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_4b/concat', 'depth': 512 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_4c/concat', 'depth': 512 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_4d/concat', 'depth': 512 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_4e/concat', 'depth': 528 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_4f/concat', 'depth': 832 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_5b/concat', 'depth': 832 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_5c/concat', 'depth': 1024 }, { 'tags': ['dense'], 'name': 'InceptionV1/Logits/Predictions/Softmax', 'depth': 1001 }, ])
class InceptionV1_slim(Model): """InceptionV1 as implemented by the TensorFlow slim framework. InceptionV1 was introduced by Szegedy, et al (2014): https://arxiv.org/pdf/1409.4842v1.pdf This function provides the pre-trained reimplementation from TF slim: https://github.com/tensorflow/models/tree/master/research/slim corresponding to the name "inception_v1". """ model_path = 'gs://modelzoo/vision/slim_models/InceptionV1.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard_with_dummy.txt' dataset = 'ImageNet' image_shape = [224, 224, 3] # inpute range taken from: # https://github.com/tensorflow/models/blob/master/research/slim/preprocessing/inception_preprocessing.py#L280 image_value_range = (-1, 1) input_name = 'input' layers = _layers_from_list_of_dicts([ { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Conv2d_1a_7x7/Relu', 'depth': 64 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Conv2d_2b_1x1/Relu', 'depth': 64 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Conv2d_2c_3x3/Relu', 'depth': 192 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_3b/concat', 'depth': 256 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_3c/concat', 'depth': 480 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_4b/concat', 'depth': 512 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_4c/concat', 'depth': 512 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_4d/concat', 'depth': 512 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_4e/concat', 'depth': 528 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_4f/concat', 'depth': 832 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_5b/concat', 'depth': 832 }, { 'tags': ['conv'], 'name': 'InceptionV1/InceptionV1/Mixed_5c/concat', 'depth': 1024 }, { 'tags': ['dense'], 'name': 'InceptionV1/Logits/Predictions/Softmax', 'depth': 1001 }, ])
class MobilenetV1_025_slim(Model): """MobilenetV1025 as implemented by the TensorFlow slim framework. This function provides the pre-trained reimplementation from TF slim: https://github.com/tensorflow/models/tree/master/research/slim """ model_path = 'gs://modelzoo/vision/slim_models/MobilenetV1025.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard_with_dummy.txt' #TODO dataset = 'ImageNet' image_shape = [224, 224, 3] # inpute range taken from: # https://github.com/tensorflow/models/blob/master/research/slim/preprocessing/inception_preprocessing.py#L280 image_value_range = (-1, 1) input_name = 'input' layers = _layers_from_list_of_dicts([ { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_0/Relu6', 'depth': 8 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_1_pointwise/Relu6', 'depth': 16 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_2_pointwise/Relu6', 'depth': 32 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_3_pointwise/Relu6', 'depth': 32 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_4_pointwise/Relu6', 'depth': 64 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_5_pointwise/Relu6', 'depth': 64 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_6_pointwise/Relu6', 'depth': 128 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_7_pointwise/Relu6', 'depth': 128 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_8_pointwise/Relu6', 'depth': 128 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_9_pointwise/Relu6', 'depth': 128 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_10_pointwise/Relu6', 'depth': 128 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_11_pointwise/Relu6', 'depth': 128 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_12_pointwise/Relu6', 'depth': 256 }, { 'tags': ['conv'], 'name': 'MobilenetV1/MobilenetV1/Conv2d_13_pointwise/Relu6', 'depth': 256 }, # {'tags': 'avgpool', 'name': 'MobilenetV1/Logits/AvgPool_1a/AvgPool', 'depth': 256}, # {'tags': ['conv'], 'name': 'MobilenetV1/Logits/Conv2d_1c_1x1/Conv2D', 'depth': 1001}, { 'tags': ['dense'], 'name': 'MobilenetV1/Predictions/Softmax', 'depth': 1001 }, ])
class InceptionV1(Model): """InceptionV1 (or 'GoogLeNet') This is a (re?)implementation of InceptionV1 https://www.cs.unc.edu/~wliu/papers/GoogLeNet.pdf The weights were trained at Google and released in an early TensorFlow tutorial. It is possible the parameters are the original weights (trained in TensorFlow's predecessor), but we haven't been able to confirm this. As far as we can tell, it is exactly the same as the model described in the original paper, where as the slim and caffe implementations have minor implementation differences (such as eliding the heads). """ model_path = 'gs://modelzoo/vision/other_models/InceptionV1.pb' labels_path = 'gs://modelzoo/labels/ImageNet_alternate.txt' dataset = 'ImageNet' image_shape = [224, 224, 3] image_value_range = (-117, 255 - 117) input_name = 'input:0' def post_import(self, scope): _populate_inception_bottlenecks(scope) layers = _layers_from_list_of_dicts([ { 'tags': ['conv'], 'name': 'conv2d0', 'depth': 64 }, { 'tags': ['conv'], 'name': 'conv2d1', 'depth': 64 }, { 'tags': ['conv'], 'name': 'conv2d2', 'depth': 192 }, { 'tags': ['conv'], 'name': 'mixed3a', 'depth': 256 }, { 'tags': ['conv'], 'name': 'mixed3b', 'depth': 480 }, { 'tags': ['conv'], 'name': 'mixed4a', 'depth': 508 }, { 'tags': ['conv'], 'name': 'mixed4b', 'depth': 512 }, { 'tags': ['conv'], 'name': 'mixed4c', 'depth': 512 }, { 'tags': ['conv'], 'name': 'mixed4d', 'depth': 528 }, { 'tags': ['conv'], 'name': 'mixed4e', 'depth': 832 }, { 'tags': ['conv'], 'name': 'mixed5a', 'depth': 832 }, { 'tags': ['conv'], 'name': 'mixed5b', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'head0_bottleneck', 'depth': 128 }, { 'tags': ['dense'], 'name': 'nn0', 'depth': 1024 }, { 'tags': ['dense'], 'name': 'softmax0', 'depth': 1008 }, { 'tags': ['conv'], 'name': 'head1_bottleneck', 'depth': 128 }, { 'tags': ['dense'], 'name': 'nn1', 'depth': 1024 }, { 'tags': ['dense'], 'name': 'softmax1', 'depth': 1008 }, { 'tags': ['dense'], 'name': 'softmax2', 'depth': 1008 }, ])
class VGG16_caffe(Model): """VGG16 model used in ImageNet ILSVRC-2014, ported from caffe. VGG16 was introduced by Simonyan & Zisserman (2014): https://arxiv.org/pdf/1409.1556.pdf http://www.robots.ox.ac.uk/~vgg/research/very_deep/ as the Oxford Visual Geometry Group's submission for the ImageNet ILSVRC-2014 contest. We download their caffe trained model from https://gist.github.com/ksimonyan/211839e770f7b538e2d8#file-readme-md and convert it with caffe-tensorflow. """ model_path = 'gs://modelzoo/vision/caffe_models/VGG16.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard.txt' dataset = 'ImageNet' image_shape = [224, 224, 3] is_BGR = True image_value_range = (-IMAGENET_MEAN_BGR, 255 - IMAGENET_MEAN_BGR) input_name = 'input' layers = _layers_from_list_of_dicts([ { 'tags': ['conv'], 'name': 'conv1_1/conv1_1', 'depth': 64 }, { 'tags': ['conv'], 'name': 'conv1_2/conv1_2', 'depth': 64 }, { 'tags': ['conv'], 'name': 'conv2_1/conv2_1', 'depth': 128 }, { 'tags': ['conv'], 'name': 'conv2_2/conv2_2', 'depth': 128 }, { 'tags': ['conv'], 'name': 'conv3_1/conv3_1', 'depth': 256 }, { 'tags': ['conv'], 'name': 'conv3_2/conv3_2', 'depth': 256 }, { 'tags': ['conv'], 'name': 'conv3_3/conv3_3', 'depth': 256 }, { 'tags': ['conv'], 'name': 'conv4_1/conv4_1', 'depth': 512 }, { 'tags': ['conv'], 'name': 'conv4_2/conv4_2', 'depth': 512 }, { 'tags': ['conv'], 'name': 'conv4_3/conv4_3', 'depth': 512 }, { 'tags': ['conv'], 'name': 'conv5_1/conv5_1', 'depth': 512 }, { 'tags': ['conv'], 'name': 'conv5_2/conv5_2', 'depth': 512 }, { 'tags': ['conv'], 'name': 'conv5_3/conv5_3', 'depth': 512 }, { 'tags': ['dense'], 'name': 'fc6/fc6', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'fc7/fc7', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'prob', 'depth': 1000 }, ])
class MobilenetV2_14_slim(Model): """MobilenetV2 1.4 as implemented by the TensorFlow slim framework. This function provides the pre-trained reimplementation from TF slim: https://github.com/tensorflow/models/tree/master/research/slim """ model_path = 'gs://modelzoo/vision/slim_models/MobilenetV2_14.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard_with_dummy.txt' dataset = 'ImageNet' image_shape = [224, 224, 3] # inpute range taken from: # https://github.com/tensorflow/models/blob/master/research/slim/preprocessing/inception_preprocessing.py#L280 image_value_range = (-1, 1) input_name = 'input' layers = _layers_from_list_of_dicts([ { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_2/add', 'depth': 32 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_4/add', 'depth': 48 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_5/add', 'depth': 48 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_7/add', 'depth': 88 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_8/add', 'depth': 88 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_9/add', 'depth': 88 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_11/add', 'depth': 136 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_12/add', 'depth': 136 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_14/add', 'depth': 224 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_15/add', 'depth': 224 }, { 'tags': ['dense'], 'name': 'MobilenetV2/Predictions/Softmax', 'depth': 1001 }, ])
MobilenetV2_10_slim.layers = _layers_from_list_of_dicts( MobilenetV2_10_slim(), [ { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_2/add', 'depth': 24 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_4/add', 'depth': 32 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_5/add', 'depth': 32 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_7/add', 'depth': 64 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_8/add', 'depth': 64 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_9/add', 'depth': 64 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_11/add', 'depth': 96 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_12/add', 'depth': 96 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_14/add', 'depth': 160 }, { 'tags': ['conv'], 'name': 'MobilenetV2/expanded_conv_15/add', 'depth': 160 }, { 'tags': ['dense'], 'name': 'MobilenetV2/Predictions/Softmax', 'depth': 1001 }, ])
image_shape = [224, 224, 3] # inpute range taken from: # https://github.com/tensorflow/models/blob/master/research/slim/preprocessing/inception_preprocessing.py#L280 image_value_range = (-1, 1) input_name = 'input' MobilenetV1_slim.layers = _layers_from_list_of_dicts(MobilenetV1_slim, [ {'name': 'MobilenetV1/MobilenetV1/Conv2d_0/Relu6', 'depth': 32, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_1_pointwise/Relu6', 'depth': 64, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_2_pointwise/Relu6', 'depth': 128, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_3_pointwise/Relu6', 'depth': 128, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_4_pointwise/Relu6', 'depth': 256, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_5_pointwise/Relu6', 'depth': 256, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_6_pointwise/Relu6', 'depth': 512, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_7_pointwise/Relu6', 'depth': 512, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_8_pointwise/Relu6', 'depth': 512, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_9_pointwise/Relu6', 'depth': 512, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_10_pointwise/Relu6', 'depth': 512, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_11_pointwise/Relu6', 'depth': 512, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_12_pointwise/Relu6', 'depth': 1024, 'tags': ['conv']}, {'name': 'MobilenetV1/MobilenetV1/Conv2d_13_pointwise/Relu6', 'depth': 1024, 'tags': ['conv']}, # {'name': 'MobilenetV1/Logits/AvgPool_1a/AvgPool', 'depth': 1024, 'type': 'avgpool'}, # {'name': 'MobilenetV1/Logits/Conv2d_1c_1x1/Conv2D', 'depth': 1001, 'tags': ['conv']}, {'name': 'MobilenetV1/Predictions/Softmax', 'depth': 1001, 'tags': ['dense']}, ]) class MobilenetV1_050_slim(Model): """MobilenetV1050 as implemented by the TensorFlow slim framework. This function provides the pre-trained reimplementation from TF slim:
class InceptionV4_slim(Model): """InceptionV4 as implemented by the TensorFlow slim framework. InceptionV4 was introduced by Szegedy, et al (2016): https://arxiv.org/pdf/1602.07261.pdf This function provides the pre-trained reimplementation from TF slim: https://github.com/tensorflow/models/tree/master/research/slim corresponding to the name "inception_v4". """ model_path = 'gs://modelzoo/vision/slim_models/InceptionV4.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard_with_dummy.txt' dataset = 'ImageNet' image_shape = [299, 299, 3] # inpute range taken from: # https://github.com/tensorflow/models/blob/master/research/slim/preprocessing/inception_preprocessing.py#L280 image_value_range = (-1, 1) input_name = 'input' layers = _layers_from_list_of_dicts([ { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Conv2d_1a_3x3/Relu', 'depth': 32 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Conv2d_2a_3x3/Relu', 'depth': 32 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Conv2d_2b_3x3/Relu', 'depth': 64 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_3a/concat', 'depth': 160 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_4a/concat', 'depth': 192 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_5a/concat', 'depth': 384 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_5b/concat', 'depth': 384 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_5c/concat', 'depth': 384 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_5d/concat', 'depth': 384 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_5e/concat', 'depth': 384 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_6a/concat', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_6b/concat', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_6c/concat', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_6d/concat', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_6e/concat', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_6f/concat', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_6g/concat', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_6h/concat', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_7a/concat', 'depth': 1536 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_7b/concat', 'depth': 1536 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_7c/concat', 'depth': 1536 }, { 'tags': ['conv'], 'name': 'InceptionV4/InceptionV4/Mixed_7d/concat', 'depth': 1536 }, { 'tags': ['dense'], 'name': 'InceptionV4/Logits/Predictions', 'depth': 1001 }, ])
# TODO - Sanity check this graph and layers AlexNet.layers = _layers_from_list_of_dicts(AlexNet, [ { 'tags': ['conv'], 'name': 'concat_2', 'depth': 256 }, { 'tags': ['conv'], 'name': 'conv5_1', 'depth': 256 }, { 'tags': ['dense'], 'name': 'Relu', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'Relu_1', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'Softmax', 'depth': 1000 }, ])
I3D.layers = _layers_from_list_of_dicts( I3D, [ { 'tags': ['conv'], 'name': 'inceptioni3d/Conv3d_1a_7x7/Relu', 'depth': 64 }, { 'tags': ['conv'], 'name': 'inceptioni3d/Conv3d_2b_1x1/Relu', 'depth': 64 }, { 'tags': ['conv'], 'name': 'inceptioni3d/Conv3d_2c_3x3/Relu', 'depth': 192 }, { 'tags': ['conv'], 'name': 'inceptioni3d/Mixed_3b/concat', 'depth': 256 }, { 'tags': ['conv'], 'name': 'inceptioni3d/Mixed_3c/concat', 'depth': 480 }, { 'tags': ['conv'], 'name': 'inceptioni3d/Mixed_4b/concat', 'depth': 512 }, { 'tags': ['conv'], 'name': 'inceptioni3d/Mixed_4c/concat', 'depth': 512 }, { 'tags': ['conv'], 'name': 'inceptioni3d/Mixed_4d/concat', 'depth': 512 }, { 'tags': ['conv'], 'name': 'inceptioni3d/Mixed_4e/concat', 'depth': 528 }, { 'tags': ['conv'], 'name': 'inceptioni3d/Mixed_4f/concat', 'depth': 832 }, { 'tags': ['conv'], 'name': 'inceptioni3d/Mixed_5b/concat', 'depth': 832 }, { 'tags': ['conv'], 'name': 'inceptioni3d/Mixed_5c/concat', 'depth': 1024 }, { 'tags': ['conv'], # 'name' : 'inceptioni3d/Logits/Conv3d_0c_1x1/conv_3d/add', # 'inceptioni3d/Logits/Conv3d_0c_1x1', 'name': 'inceptioni3d/Logits/SpatialSqueeze', 'depth': 400 } ])
model_path = 'gs://modelzoo/vision/caffe_models/InceptionV1.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard.txt' dataset = 'ImageNet' image_shape = [224, 224, 3] is_BGR = True image_value_range = (-IMAGENET_MEAN_BGR, 255-IMAGENET_MEAN_BGR) input_name = 'data' InceptionV1_caffe.layers = _layers_from_list_of_dicts(InceptionV1_caffe, [ {'tags': ['conv'], 'name': 'conv1_7x7_s2/conv1_7x7_s2', 'depth': 64}, {'tags': ['conv'], 'name': 'conv2_3x3_reduce/conv2_3x3_reduce', 'depth': 64}, {'tags': ['conv'], 'name': 'conv2_3x3/conv2_3x3', 'depth': 192}, {'tags': ['conv'], 'name': 'inception_3a_output', 'depth': 256}, {'tags': ['conv'], 'name': 'inception_3b_output', 'depth': 480}, {'tags': ['conv'], 'name': 'inception_4a_output', 'depth': 512}, {'tags': ['conv'], 'name': 'inception_4b_output', 'depth': 512}, {'tags': ['conv'], 'name': 'inception_4c_output', 'depth': 512}, {'tags': ['conv'], 'name': 'inception_4d_output', 'depth': 528}, {'tags': ['conv'], 'name': 'inception_4e_output', 'depth': 832}, {'tags': ['conv'], 'name': 'inception_5a_output', 'depth': 832}, {'tags': ['conv'], 'name': 'inception_5b_output', 'depth': 1024}, {'tags': ['dense'], 'name': 'prob', 'depth': 1000}, ]) class InceptionV1_caffe_Places205(Model): """InceptionV1 (or 'GoogLeNet') trained on Places205. This model is a caffe reimplementation of GoogLeNet: https://www.cs.unc.edu/~wliu/papers/GoogLeNet.pdf trained on the MIT Places205 dataset, retrieved here:
AlexNet.layers = _layers_from_list_of_dicts(AlexNet, [ { 'tags': ['pre_relu', 'conv'], 'name': 'Conv2D', 'depth': 96 }, { 'tags': ['pre_relu', 'conv'], 'name': 'Conv2D_1', 'depth': 128 }, { 'tags': ['pre_relu', 'conv'], 'name': 'Conv2D_2', 'depth': 128 }, { 'tags': ['pre_relu', 'conv'], 'name': 'Conv2D_3', 'depth': 384 }, { 'tags': ['pre_relu', 'conv'], 'name': 'Conv2D_4', 'depth': 192 }, { 'tags': ['pre_relu', 'conv'], 'name': 'Conv2D_5', 'depth': 192 }, { 'tags': ['pre_relu', 'conv'], 'name': 'Conv2D_6', 'depth': 128 }, { 'tags': ['pre_relu', 'conv'], 'name': 'Conv2D_7', 'depth': 128 }, { 'tags': ['dense'], 'name': 'Relu', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'Relu_1', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'Softmax', 'depth': 1000 }, ])
InceptionV1.layers = _layers_from_list_of_dicts(InceptionV1, [ { 'tags': ['conv'], 'name': 'conv2d0', 'depth': 64 }, { 'tags': ['conv'], 'name': 'conv2d1', 'depth': 64 }, { 'tags': ['conv'], 'name': 'conv2d2', 'depth': 192 }, { 'tags': ['conv'], 'name': 'mixed3a', 'depth': 256 }, { 'tags': ['conv'], 'name': 'mixed3b', 'depth': 480 }, { 'tags': ['conv'], 'name': 'mixed4a', 'depth': 508 }, { 'tags': ['conv'], 'name': 'mixed4b', 'depth': 512 }, { 'tags': ['conv'], 'name': 'mixed4c', 'depth': 512 }, { 'tags': ['conv'], 'name': 'mixed4d', 'depth': 528 }, { 'tags': ['conv'], 'name': 'mixed4e', 'depth': 832 }, { 'tags': ['conv'], 'name': 'mixed5a', 'depth': 832 }, { 'tags': ['conv'], 'name': 'mixed5b', 'depth': 1024 }, { 'tags': ['conv'], 'name': 'head0_bottleneck', 'depth': 128 }, { 'tags': ['dense'], 'name': 'nn0', 'depth': 1024 }, { 'tags': ['dense'], 'name': 'softmax0', 'depth': 1008 }, { 'tags': ['conv'], 'name': 'head1_bottleneck', 'depth': 128 }, { 'tags': ['dense'], 'name': 'nn1', 'depth': 1024 }, { 'tags': ['dense'], 'name': 'softmax1', 'depth': 1008 }, { 'tags': ['dense'], 'name': 'softmax2', 'depth': 1008 }, ])
CaffeNet_caffe.layers = _layers_from_list_of_dicts(CaffeNet_caffe, [ { 'tags': ['conv'], 'name': 'conv5/concat', 'depth': 256 }, { 'tags': ['conv'], 'name': 'conv5/conv5', 'depth': 256 }, { 'tags': ['dense'], 'name': 'fc6/fc6', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'fc7/fc7', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'prob', 'depth': 1000 }, ])
# TODO - Sanity check this graph and layers AlexNet_caffe_Places365.layers = _layers_from_list_of_dicts( AlexNet_caffe_Places365(), [ { 'tags': ['conv'], 'name': 'conv5/concat', 'depth': 256 }, { 'tags': ['conv'], 'name': 'conv5/conv5', 'depth': 256 }, { 'tags': ['dense'], 'name': 'fc6/fc6', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'fc7/fc7', 'depth': 4096 }, { 'tags': ['dense'], 'name': 'prob', 'depth': 365 }, ])
NasnetMobile_slim.layers = _layers_from_list_of_dicts( NasnetMobile_slim(), [ { 'tags': ['conv'], 'name': 'conv0/Conv2D', 'depth': 32 }, { 'tags': ['conv'], 'name': 'cell_stem_0/cell_output/concat', 'depth': 44 }, { 'tags': ['conv'], 'name': 'cell_stem_1/cell_output/concat', 'depth': 88 }, { 'tags': ['conv'], 'name': 'cell_0/cell_output/concat', 'depth': 264 }, { 'tags': ['conv'], 'name': 'cell_1/cell_output/concat', 'depth': 264 }, { 'tags': ['conv'], 'name': 'cell_2/cell_output/concat', 'depth': 264 }, { 'tags': ['conv'], 'name': 'cell_3/cell_output/concat', 'depth': 264 }, { 'tags': ['conv'], 'name': 'reduction_cell_0/cell_output/concat', 'depth': 352 }, { 'tags': ['conv'], 'name': 'cell_4/cell_output/concat', 'depth': 528 }, { 'tags': ['conv'], 'name': 'cell_5/cell_output/concat', 'depth': 528 }, { 'tags': ['conv'], 'name': 'cell_6/cell_output/concat', 'depth': 528 }, { 'tags': ['conv'], 'name': 'cell_7/cell_output/concat', 'depth': 528 }, { 'tags': ['conv'], 'name': 'reduction_cell_1/cell_output/concat', 'depth': 704 }, { 'tags': ['conv'], 'name': 'cell_8/cell_output/concat', 'depth': 1056 }, { 'tags': ['conv'], 'name': 'cell_9/cell_output/concat', 'depth': 1056 }, { 'tags': ['conv'], 'name': 'cell_10/cell_output/concat', 'depth': 1056 }, { 'tags': ['conv'], 'name': 'cell_11/cell_output/concat', 'depth': 1056 }, # {'tags': ['dense'], 'name': 'final_layer/FC/BiasAdd', 'depth': 1001}, { 'tags': ['dense'], 'name': 'final_layer/predictions', 'depth': 1001 }, ])
class PnasnetLarge_slim(Model): """PnasnetLarge as implemented by the TensorFlow slim framework. This function provides the pre-trained reimplementation from TF slim: https://github.com/tensorflow/models/tree/master/research/slim """ model_path = 'gs://modelzoo/vision/slim_models/PnasnetLarge.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard_with_dummy.txt' #TODO dataset = 'ImageNet' image_shape = [331, 331, 3] # inpute range taken from: # https://github.com/tensorflow/models/blob/master/research/slim/preprocessing/inception_preprocessing.py#L280 image_value_range = (-1, 1) input_name = 'input' layers = _layers_from_list_of_dicts([{ 'tags': ['conv'], 'name': 'conv0/Conv2D', 'depth': 96 }, { 'tags': ['conv'], 'name': 'cell_stem_0/cell_output/concat', 'depth': 270 }, { 'tags': ['conv'], 'name': 'cell_stem_1/cell_output/concat', 'depth': 540 }, { 'tags': ['conv'], 'name': 'cell_0/cell_output/concat', 'depth': 1080 }, { 'tags': ['conv'], 'name': 'cell_1/cell_output/concat', 'depth': 1080 }, { 'tags': ['conv'], 'name': 'cell_2/cell_output/concat', 'depth': 1080 }, { 'tags': ['conv'], 'name': 'cell_3/cell_output/concat', 'depth': 1080 }, { 'tags': ['conv'], 'name': 'cell_4/cell_output/concat', 'depth': 2160 }, { 'tags': ['conv'], 'name': 'cell_5/cell_output/concat', 'depth': 2160 }, { 'tags': ['conv'], 'name': 'cell_6/cell_output/concat', 'depth': 2160 }, { 'tags': ['conv'], 'name': 'cell_7/cell_output/concat', 'depth': 2160 }, { 'tags': ['conv'], 'name': 'cell_8/cell_output/concat', 'depth': 4320 }, { 'tags': ['conv'], 'name': 'cell_9/cell_output/concat', 'depth': 4320 }, { 'tags': ['conv'], 'name': 'cell_10/cell_output/concat', 'depth': 4320 }, { 'tags': ['conv'], 'name': 'cell_11/cell_output/concat', 'depth': 4320 }, { 'tags': ['dense'], 'name': 'final_layer/predictions', 'depth': 1001 }])
class InceptionResnetV2_slim(Model): """InceptionResnetV2 as implemented by the TensorFlow slim framework. InceptionResnetV2 was introduced in this paper by Szegedy, et al (2016): https://arxiv.org/pdf/1602.07261.pdf This function provides the pre-trained reimplementation from TF slim: https://github.com/tensorflow/models/tree/master/research/slim corresponding to the name "inception_resnet_v2". """ model_path = 'gs://modelzoo/vision/slim_models/InceptionResnetV2.pb' labels_path = 'gs://modelzoo/labels/ImageNet_standard_with_dummy.txt' dataset = 'ImageNet' image_shape = [299, 299, 3] # inpute range taken from: # https://github.com/tensorflow/models/blob/master/research/slim/preprocessing/inception_preprocessing.py#L280 image_value_range = (-1, 1) input_name = 'input' # TODO: understand this graph, see if we can delete some add or relu nodes from layers layers = _layers_from_list_of_dicts([ { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Conv2d_1a_3x3/Relu', 'depth': 32 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Conv2d_2a_3x3/Relu', 'depth': 32 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Conv2d_2b_3x3/Relu', 'depth': 64 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Conv2d_3b_1x1/Relu', 'depth': 80 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Conv2d_4a_3x3/Relu', 'depth': 192 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Mixed_5b/concat', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_1/add', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_1/Relu', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_2/add', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_2/Relu', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_3/add', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_3/Relu', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_4/add', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_4/Relu', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_5/add', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_5/Relu', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_6/add', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_6/Relu', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_7/add', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_7/Relu', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_8/add', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_8/Relu', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_9/add', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_9/Relu', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_10/add', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat/block35_10/Relu', 'depth': 320 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Mixed_6a/concat', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_1/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_1/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_2/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_2/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_3/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_3/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_4/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_4/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_5/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_5/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_6/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_6/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_7/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_7/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_8/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_8/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_9/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_9/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_10/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_10/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_11/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_11/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_12/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_12/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_13/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_13/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_14/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_14/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_15/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_15/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_16/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_16/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_17/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_17/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_18/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_18/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_19/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_19/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_20/add', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_1/block17_20/Relu', 'depth': 1088 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Mixed_7a/concat', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_1/add', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_1/Relu', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_2/add', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_2/Relu', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_3/add', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_3/Relu', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_4/add', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_4/Relu', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_5/add', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_5/Relu', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_6/add', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_6/Relu', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_7/add', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_7/Relu', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_8/add', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_8/Relu', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_9/add', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Repeat_2/block8_9/Relu', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Block8/add', 'depth': 2080 }, { 'tags': ['conv'], 'name': 'InceptionResnetV2/InceptionResnetV2/Conv2d_7b_1x1/Relu', 'depth': 1536 }, { 'tags': ['dense'], 'name': 'InceptionResnetV2/Logits/Predictions', 'depth': 1001 }, ])