Last active
September 10, 2023 20:16
-
-
Save andreped/5bc4393b64dbfcfed4c87e5c6863f3df to your computer and use it in GitHub Desktop.
layerscale-mixed-precision-fix.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [], | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
}, | |
"accelerator": "TPU", | |
"gpuClass": "standard" | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/andreped/5bc4393b64dbfcfed4c87e5c6863f3df/layerscale-mixed-precision-fix.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"# Copyright 2022 The TensorFlow Authors. All Rights Reserved.\n", | |
"#\n", | |
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n", | |
"# you may not use this file except in compliance with the License.\n", | |
"# You may obtain a copy of the License at\n", | |
"#\n", | |
"# http://www.apache.org/licenses/LICENSE-2.0\n", | |
"#\n", | |
"# Unless required by applicable law or agreed to in writing, software\n", | |
"# distributed under the License is distributed on an \"AS IS\" BASIS,\n", | |
"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", | |
"# See the License for the specific language governing permissions and\n", | |
"# limitations under the License.\n", | |
"# ==============================================================================\n", | |
"\n", | |
"\n", | |
"\"\"\"ConvNeXt models for Keras.\n", | |
"\n", | |
"References:\n", | |
"\n", | |
"- [A ConvNet for the 2020s](https://arxiv.org/abs/2201.03545)\n", | |
" (CVPR 2022)\n", | |
"\"\"\"\n", | |
"\n", | |
"import numpy as np\n", | |
"import tensorflow.compat.v2 as tf\n", | |
"\n", | |
"from keras import backend\n", | |
"from keras import layers\n", | |
"from keras import utils\n", | |
"from keras import initializers\n", | |
"from keras.applications import imagenet_utils\n", | |
"from keras.engine import sequential\n", | |
"from keras.engine import training as training_lib\n", | |
"\n", | |
"# isort: off\n", | |
"from tensorflow.python.util.tf_export import keras_export\n", | |
"\n", | |
"BASE_WEIGHTS_PATH = (\n", | |
" \"https://storage.googleapis.com/tensorflow/keras-applications/convnext/\"\n", | |
")\n", | |
"\n", | |
"WEIGHTS_HASHES = {\n", | |
" \"convnext_tiny\": (\n", | |
" \"8ae6e78ce2933352b1ef4008e6dd2f17bc40771563877d156bc6426c7cf503ff\",\n", | |
" \"d547c096cabd03329d7be5562c5e14798aa39ed24b474157cef5e85ab9e49ef1\",\n", | |
" ),\n", | |
" \"convnext_small\": (\n", | |
" \"ce1277d8f1ee5a0ef0e171469089c18f5233860ceaf9b168049cb9263fd7483c\",\n", | |
" \"6fc8009faa2f00c1c1dfce59feea9b0745eb260a7dd11bee65c8e20843da6eab\",\n", | |
" ),\n", | |
" \"convnext_base\": (\n", | |
" \"52cbb006d3dadd03f6e095a8ca1aca47aecdd75acb4bc74bce1f5c695d0086e6\",\n", | |
" \"40a20c5548a5e9202f69735ecc06c990e6b7c9d2de39f0361e27baeb24cb7c45\",\n", | |
" ),\n", | |
" \"convnext_large\": (\n", | |
" \"070c5ed9ed289581e477741d3b34beffa920db8cf590899d6d2c67fba2a198a6\",\n", | |
" \"96f02b6f0753d4f543261bc9d09bed650f24dd6bc02ddde3066135b63d23a1cd\",\n", | |
" ),\n", | |
" \"convnext_xlarge\": (\n", | |
" \"c1f5ccab661354fc3a79a10fa99af82f0fbf10ec65cb894a3ae0815f17a889ee\",\n", | |
" \"de3f8a54174130e0cecdc71583354753d557fcf1f4487331558e2a16ba0cfe05\",\n", | |
" ),\n", | |
"}\n", | |
"\n", | |
"\n", | |
"MODEL_CONFIGS = {\n", | |
" \"tiny\": {\n", | |
" \"depths\": [3, 3, 9, 3],\n", | |
" \"projection_dims\": [96, 192, 384, 768],\n", | |
" \"default_size\": 224,\n", | |
" },\n", | |
" \"small\": {\n", | |
" \"depths\": [3, 3, 27, 3],\n", | |
" \"projection_dims\": [96, 192, 384, 768],\n", | |
" \"default_size\": 224,\n", | |
" },\n", | |
" \"base\": {\n", | |
" \"depths\": [3, 3, 27, 3],\n", | |
" \"projection_dims\": [128, 256, 512, 1024],\n", | |
" \"default_size\": 224,\n", | |
" },\n", | |
" \"large\": {\n", | |
" \"depths\": [3, 3, 27, 3],\n", | |
" \"projection_dims\": [192, 384, 768, 1536],\n", | |
" \"default_size\": 224,\n", | |
" },\n", | |
" \"xlarge\": {\n", | |
" \"depths\": [3, 3, 27, 3],\n", | |
" \"projection_dims\": [256, 512, 1024, 2048],\n", | |
" \"default_size\": 224,\n", | |
" },\n", | |
"}\n", | |
"\n", | |
"BASE_DOCSTRING = \"\"\"Instantiates the {name} architecture.\n", | |
"\n", | |
" References:\n", | |
" - [A ConvNet for the 2020s](https://arxiv.org/abs/2201.03545)\n", | |
" (CVPR 2022)\n", | |
"\n", | |
" For image classification use cases, see\n", | |
" [this page for detailed examples](\n", | |
" https://keras.io/api/applications/#usage-examples-for-image-classification-models).\n", | |
" For transfer learning use cases, make sure to read the\n", | |
" [guide to transfer learning & fine-tuning](\n", | |
" https://keras.io/guides/transfer_learning/).\n", | |
"\n", | |
" The `base`, `large`, and `xlarge` models were first pre-trained on the\n", | |
" ImageNet-21k dataset and then fine-tuned on the ImageNet-1k dataset. The\n", | |
" pre-trained parameters of the models were assembled from the\n", | |
" [official repository](https://github.com/facebookresearch/ConvNeXt). To get a\n", | |
" sense of how these parameters were converted to Keras compatible parameters,\n", | |
" please refer to\n", | |
" [this repository](https://github.com/sayakpaul/keras-convnext-conversion).\n", | |
"\n", | |
" Note: Each Keras Application expects a specific kind of input preprocessing.\n", | |
" For ConvNeXt, preprocessing is included in the model using a `Normalization`\n", | |
" layer. ConvNeXt models expect their inputs to be float or uint8 tensors of\n", | |
" pixels with values in the [0-255] range.\n", | |
"\n", | |
" When calling the `summary()` method after instantiating a ConvNeXt model,\n", | |
" prefer setting the `expand_nested` argument `summary()` to `True` to better\n", | |
" investigate the instantiated model.\n", | |
"\n", | |
" Args:\n", | |
" include_top: Whether to include the fully-connected\n", | |
" layer at the top of the network. Defaults to True.\n", | |
" weights: One of `None` (random initialization),\n", | |
" `\"imagenet\"` (pre-training on ImageNet-1k), or the path to the weights\n", | |
" file to be loaded. Defaults to `\"imagenet\"`.\n", | |
" input_tensor: Optional Keras tensor\n", | |
" (i.e. output of `layers.Input()`)\n", | |
" to use as image input for the model.\n", | |
" input_shape: Optional shape tuple, only to be specified\n", | |
" if `include_top` is False.\n", | |
" It should have exactly 3 inputs channels.\n", | |
" pooling: Optional pooling mode for feature extraction\n", | |
" when `include_top` is `False`. Defaults to None.\n", | |
" - `None` means that the output of the model will be\n", | |
" the 4D tensor output of the last convolutional layer.\n", | |
" - `avg` means that global average pooling\n", | |
" will be applied to the output of the\n", | |
" last convolutional layer, and thus\n", | |
" the output of the model will be a 2D tensor.\n", | |
" - `max` means that global max pooling will\n", | |
" be applied.\n", | |
" classes: Optional number of classes to classify images\n", | |
" into, only to be specified if `include_top` is True, and\n", | |
" if no `weights` argument is specified. Defaults to 1000 (number of\n", | |
" ImageNet classes).\n", | |
" classifier_activation: A `str` or callable. The activation function to use\n", | |
" on the \"top\" layer. Ignored unless `include_top=True`. Set\n", | |
" `classifier_activation=None` to return the logits of the \"top\" layer.\n", | |
" Defaults to `\"softmax\"`.\n", | |
" When loading pretrained weights, `classifier_activation` can only\n", | |
" be `None` or `\"softmax\"`.\n", | |
"\n", | |
" Returns:\n", | |
" A `keras.Model` instance.\n", | |
"\"\"\"\n", | |
"\n", | |
"\n", | |
"class StochasticDepth(layers.Layer):\n", | |
" \"\"\"Stochastic Depth module.\n", | |
"\n", | |
" It performs batch-wise dropping rather than sample-wise. In libraries like\n", | |
" `timm`, it's similar to `DropPath` layers that drops residual paths\n", | |
" sample-wise.\n", | |
"\n", | |
" References:\n", | |
" - https://github.com/rwightman/pytorch-image-models\n", | |
"\n", | |
" Args:\n", | |
" drop_path_rate (float): Probability of dropping paths. Should be within\n", | |
" [0, 1].\n", | |
"\n", | |
" Returns:\n", | |
" Tensor either with the residual path dropped or kept.\n", | |
" \"\"\"\n", | |
"\n", | |
" def __init__(self, drop_path_rate, **kwargs):\n", | |
" super().__init__(**kwargs)\n", | |
" self.drop_path_rate = drop_path_rate\n", | |
"\n", | |
" def call(self, x, training=None):\n", | |
" if training:\n", | |
" keep_prob = 1 - self.drop_path_rate\n", | |
" shape = (tf.shape(x)[0],) + (1,) * (len(tf.shape(x)) - 1)\n", | |
" random_tensor = keep_prob + tf.random.uniform(shape, 0, 1)\n", | |
" random_tensor = tf.floor(random_tensor)\n", | |
" return (x / keep_prob) * random_tensor\n", | |
" return x\n", | |
"\n", | |
" def get_config(self):\n", | |
" config = super().get_config()\n", | |
" config.update({\"drop_path_rate\": self.drop_path_rate})\n", | |
" return config\n", | |
"\n", | |
"\n", | |
"class LayerScale(layers.Layer):\n", | |
" \"\"\"Layer scale module.\n", | |
"\n", | |
" References:\n", | |
" - https://arxiv.org/abs/2103.17239\n", | |
"\n", | |
" Args:\n", | |
" init_values (float): Initial value for layer scale. Should be within\n", | |
" [0, 1].\n", | |
" projection_dim (int): Projection dimensionality.\n", | |
"\n", | |
" Returns:\n", | |
" Tensor multiplied to the scale.\n", | |
" \"\"\"\n", | |
"\n", | |
" def __init__(self, init_values, projection_dim, **kwargs):\n", | |
" super().__init__(**kwargs)\n", | |
" self.init_values = init_values\n", | |
" self.projection_dim = projection_dim\n", | |
"\n", | |
" def build(self, input_shape):\n", | |
" self.gamma = self.add_weight(\n", | |
" shape=(self.projection_dim,),\n", | |
" # dtype=self._compute_dtype_object,\n", | |
" initializer=initializers.Constant(self.init_values),\n", | |
" trainable=True,\n", | |
" )\n", | |
"\n", | |
" def call(self, x):\n", | |
" return x * self.gamma\n", | |
"\n", | |
" def get_config(self):\n", | |
" config = super().get_config()\n", | |
" config.update(\n", | |
" {\n", | |
" \"init_values\": self.init_values,\n", | |
" \"projection_dim\": self.projection_dim,\n", | |
" }\n", | |
" )\n", | |
" return config\n", | |
"\n", | |
"\n", | |
"def ConvNeXtBlock(\n", | |
" projection_dim, drop_path_rate=0.0, layer_scale_init_value=1e-6, name=None\n", | |
"):\n", | |
" \"\"\"ConvNeXt block.\n", | |
"\n", | |
" References:\n", | |
" - https://arxiv.org/abs/2201.03545\n", | |
" - https://github.com/facebookresearch/ConvNeXt/blob/main/models/convnext.py\n", | |
"\n", | |
" Notes:\n", | |
" In the original ConvNeXt implementation (linked above), the authors use\n", | |
" `Dense` layers for pointwise convolutions for increased efficiency.\n", | |
" Following that, this implementation also uses the same.\n", | |
"\n", | |
" Args:\n", | |
" projection_dim (int): Number of filters for convolution layers. In the\n", | |
" ConvNeXt paper, this is referred to as projection dimension.\n", | |
" drop_path_rate (float): Probability of dropping paths. Should be within\n", | |
" [0, 1].\n", | |
" layer_scale_init_value (float): Layer scale value. Should be a small float\n", | |
" number.\n", | |
" name: name to path to the keras layer.\n", | |
"\n", | |
" Returns:\n", | |
" A function representing a ConvNeXtBlock block.\n", | |
" \"\"\"\n", | |
" if name is None:\n", | |
" name = \"prestem\" + str(backend.get_uid(\"prestem\"))\n", | |
"\n", | |
" def apply(inputs):\n", | |
" x = inputs\n", | |
"\n", | |
" x = layers.Conv2D(\n", | |
" filters=projection_dim,\n", | |
" kernel_size=7,\n", | |
" padding=\"same\",\n", | |
" groups=projection_dim,\n", | |
" name=name + \"_depthwise_conv\",\n", | |
" )(x)\n", | |
" x = layers.LayerNormalization(epsilon=1e-6, name=name + \"_layernorm\")(x)\n", | |
" x = layers.Dense(4 * projection_dim, name=name + \"_pointwise_conv_1\")(x)\n", | |
" x = layers.Activation(\"gelu\", name=name + \"_gelu\")(x)\n", | |
" x = layers.Dense(projection_dim, name=name + \"_pointwise_conv_2\")(x)\n", | |
"\n", | |
" if layer_scale_init_value is not None:\n", | |
" x = LayerScale(\n", | |
" layer_scale_init_value,\n", | |
" projection_dim,\n", | |
" name=name + \"_layer_scale\",\n", | |
" )(x)\n", | |
" if drop_path_rate:\n", | |
" layer = StochasticDepth(\n", | |
" drop_path_rate, name=name + \"_stochastic_depth\"\n", | |
" )\n", | |
" else:\n", | |
" layer = layers.Activation(\"linear\", name=name + \"_identity\")\n", | |
"\n", | |
" return inputs + layer(x)\n", | |
"\n", | |
" return apply\n", | |
"\n", | |
"\n", | |
"def PreStem(name=None):\n", | |
" \"\"\"Normalizes inputs with ImageNet-1k mean and std.\n", | |
"\n", | |
" Args:\n", | |
" name (str): Name prefix.\n", | |
"\n", | |
" Returns:\n", | |
" A presemt function.\n", | |
" \"\"\"\n", | |
" if name is None:\n", | |
" name = \"prestem\" + str(backend.get_uid(\"prestem\"))\n", | |
"\n", | |
" def apply(x):\n", | |
" x = layers.Normalization(\n", | |
" mean=[0.485 * 255, 0.456 * 255, 0.406 * 255],\n", | |
" variance=[\n", | |
" (0.229 * 255) ** 2,\n", | |
" (0.224 * 255) ** 2,\n", | |
" (0.225 * 255) ** 2,\n", | |
" ],\n", | |
" name=name + \"_prestem_normalization\",\n", | |
" )(x)\n", | |
" return x\n", | |
"\n", | |
" return apply\n", | |
"\n", | |
"\n", | |
"def Head(num_classes=1000, name=None):\n", | |
" \"\"\"Implementation of classification head of RegNet.\n", | |
"\n", | |
" Args:\n", | |
" num_classes: number of classes for Dense layer\n", | |
" name: name prefix\n", | |
"\n", | |
" Returns:\n", | |
" Classification head function.\n", | |
" \"\"\"\n", | |
" if name is None:\n", | |
" name = str(backend.get_uid(\"head\"))\n", | |
"\n", | |
" def apply(x):\n", | |
" x = layers.GlobalAveragePooling2D(name=name + \"_head_gap\")(x)\n", | |
" x = layers.LayerNormalization(\n", | |
" epsilon=1e-6, name=name + \"_head_layernorm\"\n", | |
" )(x)\n", | |
" x = layers.Dense(num_classes, name=name + \"_head_dense\")(x)\n", | |
" return x\n", | |
"\n", | |
" return apply\n", | |
"\n", | |
"\n", | |
"def ConvNeXt(\n", | |
" depths,\n", | |
" projection_dims,\n", | |
" drop_path_rate=0.0,\n", | |
" layer_scale_init_value=1e-6,\n", | |
" default_size=224,\n", | |
" model_name=\"convnext\",\n", | |
" include_preprocessing=True,\n", | |
" include_top=True,\n", | |
" weights=None,\n", | |
" input_tensor=None,\n", | |
" input_shape=None,\n", | |
" pooling=None,\n", | |
" classes=1000,\n", | |
" classifier_activation=\"softmax\",\n", | |
"):\n", | |
" \"\"\"Instantiates ConvNeXt architecture given specific configuration.\n", | |
"\n", | |
" Args:\n", | |
" depths: An iterable containing depths for each individual stages.\n", | |
" projection_dims: An iterable containing output number of channels of\n", | |
" each individual stages.\n", | |
" drop_path_rate: Stochastic depth probability. If 0.0, then stochastic\n", | |
" depth won't be used.\n", | |
" layer_scale_init_value: Layer scale coefficient. If 0.0, layer scaling\n", | |
" won't be used.\n", | |
" default_size: Default input image size.\n", | |
" model_name: An optional name for the model.\n", | |
" include_preprocessing: boolean denoting whther to include preprocessing in\n", | |
" the model. When `weights=\"imagenet\"` this should be always set to True.\n", | |
" But for other models (e.g., randomly initialized) users should set it\n", | |
" to False and apply preprocessing to data accordingly.\n", | |
" include_top: Boolean denoting whether to include classification head to\n", | |
" the model.\n", | |
" weights: one of `None` (random initialization), `\"imagenet\"` (pre-training\n", | |
" on ImageNet-1k), or the path to the weights file to be loaded.\n", | |
" input_tensor: optional Keras tensor (i.e. output of `layers.Input()`) to\n", | |
" use as image input for the model.\n", | |
" input_shape: optional shape tuple, only to be specified if `include_top`\n", | |
" is False. It should have exactly 3 inputs channels.\n", | |
" pooling: optional pooling mode for feature extraction when `include_top`\n", | |
" is `False`.\n", | |
" - `None` means that the output of the model will be the 4D tensor output\n", | |
" of the last convolutional layer.\n", | |
" - `avg` means that global average pooling will be applied to the output\n", | |
" of the last convolutional layer, and thus the output of the model will\n", | |
" be a 2D tensor.\n", | |
" - `max` means that global max pooling will be applied.\n", | |
" classes: optional number of classes to classify images into, only to be\n", | |
" specified if `include_top` is True, and if no `weights` argument is\n", | |
" specified.\n", | |
" classifier_activation: A `str` or callable. The activation function to use\n", | |
" on the \"top\" layer. Ignored unless `include_top=True`. Set\n", | |
" `classifier_activation=None` to return the logits of the \"top\" layer.\n", | |
"\n", | |
" Returns:\n", | |
" A `keras.Model` instance.\n", | |
"\n", | |
" Raises:\n", | |
" ValueError: in case of invalid argument for `weights`,\n", | |
" or invalid input shape.\n", | |
" ValueError: if `classifier_activation` is not `softmax`, or `None`\n", | |
" when using a pretrained top layer.\n", | |
" ValueError: if `include_top` is True but `num_classes` is not 1000\n", | |
" when using ImageNet.\n", | |
" \"\"\"\n", | |
" if not (weights in {\"imagenet\", None} or tf.io.gfile.exists(weights)):\n", | |
" raise ValueError(\n", | |
" \"The `weights` argument should be either \"\n", | |
" \"`None` (random initialization), `imagenet` \"\n", | |
" \"(pre-training on ImageNet), \"\n", | |
" \"or the path to the weights file to be loaded.\"\n", | |
" )\n", | |
"\n", | |
" if weights == \"imagenet\" and include_top and classes != 1000:\n", | |
" raise ValueError(\n", | |
" \"If using `weights` as `'imagenet'` with `include_top`\"\n", | |
" \" as true, `classes` should be 1000\"\n", | |
" )\n", | |
"\n", | |
" # Determine proper input shape.\n", | |
" input_shape = imagenet_utils.obtain_input_shape(\n", | |
" input_shape,\n", | |
" default_size=default_size,\n", | |
" min_size=32,\n", | |
" data_format=backend.image_data_format(),\n", | |
" require_flatten=include_top,\n", | |
" weights=weights,\n", | |
" )\n", | |
"\n", | |
" if input_tensor is None:\n", | |
" img_input = layers.Input(shape=input_shape)\n", | |
" else:\n", | |
" if not backend.is_keras_tensor(input_tensor):\n", | |
" img_input = layers.Input(tensor=input_tensor, shape=input_shape)\n", | |
" else:\n", | |
" img_input = input_tensor\n", | |
"\n", | |
" if input_tensor is not None:\n", | |
" inputs = utils.layer_utils.get_source_inputs(input_tensor)[0]\n", | |
" else:\n", | |
" inputs = img_input\n", | |
"\n", | |
" x = inputs\n", | |
" if include_preprocessing:\n", | |
" channel_axis = (\n", | |
" 3 if backend.image_data_format() == \"channels_last\" else 1\n", | |
" )\n", | |
" num_channels = input_shape[channel_axis - 1]\n", | |
" if num_channels == 3:\n", | |
" x = PreStem(name=model_name)(x)\n", | |
"\n", | |
" # Stem block.\n", | |
" stem = sequential.Sequential(\n", | |
" [\n", | |
" layers.Conv2D(\n", | |
" projection_dims[0],\n", | |
" kernel_size=4,\n", | |
" strides=4,\n", | |
" name=model_name + \"_stem_conv\",\n", | |
" ),\n", | |
" layers.LayerNormalization(\n", | |
" epsilon=1e-6, name=model_name + \"_stem_layernorm\"\n", | |
" ),\n", | |
" ],\n", | |
" name=model_name + \"_stem\",\n", | |
" )\n", | |
"\n", | |
" # Downsampling blocks.\n", | |
" downsample_layers = []\n", | |
" downsample_layers.append(stem)\n", | |
"\n", | |
" num_downsample_layers = 3\n", | |
" for i in range(num_downsample_layers):\n", | |
" downsample_layer = sequential.Sequential(\n", | |
" [\n", | |
" layers.LayerNormalization(\n", | |
" epsilon=1e-6,\n", | |
" name=model_name + \"_downsampling_layernorm_\" + str(i),\n", | |
" ),\n", | |
" layers.Conv2D(\n", | |
" projection_dims[i + 1],\n", | |
" kernel_size=2,\n", | |
" strides=2,\n", | |
" name=model_name + \"_downsampling_conv_\" + str(i),\n", | |
" ),\n", | |
" ],\n", | |
" name=model_name + \"_downsampling_block_\" + str(i),\n", | |
" )\n", | |
" downsample_layers.append(downsample_layer)\n", | |
"\n", | |
" # Stochastic depth schedule.\n", | |
" # This is referred from the original ConvNeXt codebase:\n", | |
" # https://github.com/facebookresearch/ConvNeXt/blob/main/models/convnext.py#L86\n", | |
" depth_drop_rates = [\n", | |
" float(x) for x in np.linspace(0.0, drop_path_rate, sum(depths))\n", | |
" ]\n", | |
"\n", | |
" # First apply downsampling blocks and then apply ConvNeXt stages.\n", | |
" cur = 0\n", | |
"\n", | |
" num_convnext_blocks = 4\n", | |
" for i in range(num_convnext_blocks):\n", | |
" x = downsample_layers[i](x)\n", | |
" for j in range(depths[i]):\n", | |
" x = ConvNeXtBlock(\n", | |
" projection_dim=projection_dims[i],\n", | |
" drop_path_rate=depth_drop_rates[cur + j],\n", | |
" layer_scale_init_value=layer_scale_init_value,\n", | |
" name=model_name + f\"_stage_{i}_block_{j}\",\n", | |
" )(x)\n", | |
" cur += depths[i]\n", | |
"\n", | |
" if include_top:\n", | |
" x = Head(num_classes=classes, name=model_name)(x)\n", | |
" imagenet_utils.validate_activation(classifier_activation, weights)\n", | |
"\n", | |
" else:\n", | |
" if pooling == \"avg\":\n", | |
" x = layers.GlobalAveragePooling2D()(x)\n", | |
" elif pooling == \"max\":\n", | |
" x = layers.GlobalMaxPooling2D()(x)\n", | |
" x = layers.LayerNormalization(epsilon=1e-6)(x)\n", | |
"\n", | |
" model = training_lib.Model(inputs=inputs, outputs=x, name=model_name)\n", | |
"\n", | |
" # Load weights.\n", | |
" if weights == \"imagenet\":\n", | |
" if include_top:\n", | |
" file_suffix = \".h5\"\n", | |
" file_hash = WEIGHTS_HASHES[model_name][0]\n", | |
" else:\n", | |
" file_suffix = \"_notop.h5\"\n", | |
" file_hash = WEIGHTS_HASHES[model_name][1]\n", | |
" file_name = model_name + file_suffix\n", | |
" weights_path = utils.data_utils.get_file(\n", | |
" file_name,\n", | |
" BASE_WEIGHTS_PATH + file_name,\n", | |
" cache_subdir=\"models\",\n", | |
" file_hash=file_hash,\n", | |
" )\n", | |
" model.load_weights(weights_path)\n", | |
" elif weights is not None:\n", | |
" model.load_weights(weights)\n", | |
"\n", | |
" return model\n", | |
"\n", | |
"\n", | |
"## Instantiating variants ##\n", | |
"\n", | |
"\n", | |
"@keras_export(\n", | |
" \"keras.applications.convnext.ConvNeXtTiny\",\n", | |
" \"keras.applications.ConvNeXtTiny\",\n", | |
")\n", | |
"def ConvNeXtTiny(\n", | |
" model_name=\"convnext_tiny\",\n", | |
" include_top=True,\n", | |
" include_preprocessing=True,\n", | |
" weights=\"imagenet\",\n", | |
" input_tensor=None,\n", | |
" input_shape=None,\n", | |
" pooling=None,\n", | |
" classes=1000,\n", | |
" classifier_activation=\"softmax\",\n", | |
"):\n", | |
" return ConvNeXt(\n", | |
" depths=MODEL_CONFIGS[\"tiny\"][\"depths\"],\n", | |
" projection_dims=MODEL_CONFIGS[\"tiny\"][\"projection_dims\"],\n", | |
" drop_path_rate=0.0,\n", | |
" layer_scale_init_value=1e-6,\n", | |
" default_size=MODEL_CONFIGS[\"tiny\"][\"default_size\"],\n", | |
" model_name=model_name,\n", | |
" include_top=include_top,\n", | |
" include_preprocessing=include_preprocessing,\n", | |
" weights=weights,\n", | |
" input_tensor=input_tensor,\n", | |
" input_shape=input_shape,\n", | |
" pooling=pooling,\n", | |
" classes=classes,\n", | |
" classifier_activation=classifier_activation,\n", | |
" )\n", | |
"\n", | |
"\n", | |
"@keras_export(\n", | |
" \"keras.applications.convnext.ConvNeXtSmall\",\n", | |
" \"keras.applications.ConvNeXtSmall\",\n", | |
")\n", | |
"def ConvNeXtSmall(\n", | |
" model_name=\"convnext_small\",\n", | |
" include_top=True,\n", | |
" include_preprocessing=True,\n", | |
" weights=\"imagenet\",\n", | |
" input_tensor=None,\n", | |
" input_shape=None,\n", | |
" pooling=None,\n", | |
" classes=1000,\n", | |
" classifier_activation=\"softmax\",\n", | |
"):\n", | |
" return ConvNeXt(\n", | |
" depths=MODEL_CONFIGS[\"small\"][\"depths\"],\n", | |
" projection_dims=MODEL_CONFIGS[\"small\"][\"projection_dims\"],\n", | |
" drop_path_rate=0.0,\n", | |
" layer_scale_init_value=1e-6,\n", | |
" default_size=MODEL_CONFIGS[\"small\"][\"default_size\"],\n", | |
" model_name=model_name,\n", | |
" include_top=include_top,\n", | |
" include_preprocessing=include_preprocessing,\n", | |
" weights=weights,\n", | |
" input_tensor=input_tensor,\n", | |
" input_shape=input_shape,\n", | |
" pooling=pooling,\n", | |
" classes=classes,\n", | |
" classifier_activation=classifier_activation,\n", | |
" )\n", | |
"\n", | |
"\n", | |
"@keras_export(\n", | |
" \"keras.applications.convnext.ConvNeXtBase\",\n", | |
" \"keras.applications.ConvNeXtBase\",\n", | |
")\n", | |
"def ConvNeXtBase(\n", | |
" model_name=\"convnext_base\",\n", | |
" include_top=True,\n", | |
" include_preprocessing=True,\n", | |
" weights=\"imagenet\",\n", | |
" input_tensor=None,\n", | |
" input_shape=None,\n", | |
" pooling=None,\n", | |
" classes=1000,\n", | |
" classifier_activation=\"softmax\",\n", | |
"):\n", | |
" return ConvNeXt(\n", | |
" depths=MODEL_CONFIGS[\"base\"][\"depths\"],\n", | |
" projection_dims=MODEL_CONFIGS[\"base\"][\"projection_dims\"],\n", | |
" drop_path_rate=0.0,\n", | |
" layer_scale_init_value=1e-6,\n", | |
" default_size=MODEL_CONFIGS[\"base\"][\"default_size\"],\n", | |
" model_name=model_name,\n", | |
" include_top=include_top,\n", | |
" include_preprocessing=include_preprocessing,\n", | |
" weights=weights,\n", | |
" input_tensor=input_tensor,\n", | |
" input_shape=input_shape,\n", | |
" pooling=pooling,\n", | |
" classes=classes,\n", | |
" classifier_activation=classifier_activation,\n", | |
" )\n", | |
"\n", | |
"\n", | |
"@keras_export(\n", | |
" \"keras.applications.convnext.ConvNeXtLarge\",\n", | |
" \"keras.applications.ConvNeXtLarge\",\n", | |
")\n", | |
"def ConvNeXtLarge(\n", | |
" model_name=\"convnext_large\",\n", | |
" include_top=True,\n", | |
" include_preprocessing=True,\n", | |
" weights=\"imagenet\",\n", | |
" input_tensor=None,\n", | |
" input_shape=None,\n", | |
" pooling=None,\n", | |
" classes=1000,\n", | |
" classifier_activation=\"softmax\",\n", | |
"):\n", | |
" return ConvNeXt(\n", | |
" depths=MODEL_CONFIGS[\"large\"][\"depths\"],\n", | |
" projection_dims=MODEL_CONFIGS[\"large\"][\"projection_dims\"],\n", | |
" drop_path_rate=0.0,\n", | |
" layer_scale_init_value=1e-6,\n", | |
" default_size=MODEL_CONFIGS[\"large\"][\"default_size\"],\n", | |
" model_name=model_name,\n", | |
" include_top=include_top,\n", | |
" include_preprocessing=include_preprocessing,\n", | |
" weights=weights,\n", | |
" input_tensor=input_tensor,\n", | |
" input_shape=input_shape,\n", | |
" pooling=pooling,\n", | |
" classes=classes,\n", | |
" classifier_activation=classifier_activation,\n", | |
" )\n", | |
"\n", | |
"\n", | |
"@keras_export(\n", | |
" \"keras.applications.convnext.ConvNeXtXLarge\",\n", | |
" \"keras.applications.ConvNeXtXLarge\",\n", | |
")\n", | |
"def ConvNeXtXLarge(\n", | |
" model_name=\"convnext_xlarge\",\n", | |
" include_top=True,\n", | |
" include_preprocessing=True,\n", | |
" weights=\"imagenet\",\n", | |
" input_tensor=None,\n", | |
" input_shape=None,\n", | |
" pooling=None,\n", | |
" classes=1000,\n", | |
" classifier_activation=\"softmax\",\n", | |
"):\n", | |
" return ConvNeXt(\n", | |
" depths=MODEL_CONFIGS[\"xlarge\"][\"depths\"],\n", | |
" projection_dims=MODEL_CONFIGS[\"xlarge\"][\"projection_dims\"],\n", | |
" drop_path_rate=0.0,\n", | |
" layer_scale_init_value=1e-6,\n", | |
" default_size=MODEL_CONFIGS[\"xlarge\"][\"default_size\"],\n", | |
" model_name=model_name,\n", | |
" include_top=include_top,\n", | |
" include_preprocessing=include_preprocessing,\n", | |
" weights=weights,\n", | |
" input_tensor=input_tensor,\n", | |
" input_shape=input_shape,\n", | |
" pooling=pooling,\n", | |
" classes=classes,\n", | |
" classifier_activation=classifier_activation,\n", | |
" )\n", | |
"\n", | |
"\n", | |
"ConvNeXtTiny.__doc__ = BASE_DOCSTRING.format(name=\"ConvNeXtTiny\")\n", | |
"ConvNeXtSmall.__doc__ = BASE_DOCSTRING.format(name=\"ConvNeXtSmall\")\n", | |
"ConvNeXtBase.__doc__ = BASE_DOCSTRING.format(name=\"ConvNeXtBase\")\n", | |
"ConvNeXtLarge.__doc__ = BASE_DOCSTRING.format(name=\"ConvNeXtLarge\")\n", | |
"ConvNeXtXLarge.__doc__ = BASE_DOCSTRING.format(name=\"ConvNeXtXLarge\")\n", | |
"\n", | |
"\n", | |
"@keras_export(\"keras.applications.convnext.preprocess_input\")\n", | |
"def preprocess_input(x, data_format=None):\n", | |
" \"\"\"A placeholder method for backward compatibility.\n", | |
"\n", | |
" The preprocessing logic has been included in the convnext model\n", | |
" implementation. Users are no longer required to call this method to\n", | |
" normalize the input data. This method does nothing and only kept as a\n", | |
" placeholder to align the API surface between old and new version of model.\n", | |
"\n", | |
" Args:\n", | |
" x: A floating point `numpy.array` or a `tf.Tensor`.\n", | |
" data_format: Optional data format of the image tensor/array. Defaults to\n", | |
" None, in which case the global setting\n", | |
" `tf.keras.backend.image_data_format()` is used (unless you changed it,\n", | |
" it defaults to \"channels_last\").{mode}\n", | |
"\n", | |
" Returns:\n", | |
" Unchanged `numpy.array` or `tf.Tensor`.\n", | |
" \"\"\"\n", | |
" return x\n", | |
"\n", | |
"\n", | |
"@keras_export(\"keras.applications.convnext.decode_predictions\")\n", | |
"def decode_predictions(preds, top=5):\n", | |
" return imagenet_utils.decode_predictions(preds, top=top)\n", | |
"\n", | |
"\n", | |
"decode_predictions.__doc__ = imagenet_utils.decode_predictions.__doc__" | |
], | |
"metadata": { | |
"id": "TwMzUkVf7pfB" | |
}, | |
"execution_count": 1, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"from tensorflow.keras import mixed_precision\n", | |
"# mixed_precision.set_global_policy('mixed_float16')\n", | |
"\n", | |
"# Model with pre-trained weights\n", | |
"model = ConvNeXtBase(include_top=True, weights='imagenet')\n", | |
"model.summary()\n" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "I4tJ1Es96evQ", | |
"outputId": "a9dc71eb-c455-4b7b-fc5e-ea53a88ce5bb" | |
}, | |
"execution_count": 2, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stderr", | |
"text": [ | |
"WARNING:tensorflow:Mixed precision compatibility check (mixed_float16): WARNING\n", | |
"The dtype policy mixed_float16 may run slowly because this machine does not have a GPU. Only Nvidia GPUs with compute capability of at least 7.0 run quickly with mixed_float16.\n", | |
"If you will use compatible GPU(s) not attached to this host, e.g. by running a multi-worker model, you can ignore this warning. This message will only be logged once\n" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Downloading data from https://storage.googleapis.com/tensorflow/keras-applications/convnext/convnext_base.h5\n", | |
"355031056/355031056 [==============================] - 5s 0us/step\n", | |
"Model: \"convnext_base\"\n", | |
"__________________________________________________________________________________________________\n", | |
" Layer (type) Output Shape Param # Connected to \n", | |
"==================================================================================================\n", | |
" input_1 (InputLayer) [(None, 224, 224, 3 0 [] \n", | |
" )] \n", | |
" \n", | |
" convnext_base_prestem_normaliz (None, 224, 224, 3) 0 ['input_1[0][0]'] \n", | |
" ation (Normalization) \n", | |
" \n", | |
" convnext_base_stem (Sequential (None, 56, 56, 128) 6528 ['convnext_base_prestem_normaliza\n", | |
" ) tion[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_0_ (None, 56, 56, 128) 6400 ['convnext_base_stem[0][0]'] \n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_0_block_0_ (None, 56, 56, 128) 256 ['convnext_base_stage_0_block_0_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_0_ (None, 56, 56, 512) 66048 ['convnext_base_stage_0_block_0_l\n", | |
" pointwise_conv_1 (Dense) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_0_ (None, 56, 56, 512) 0 ['convnext_base_stage_0_block_0_p\n", | |
" gelu (Activation) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_0_ (None, 56, 56, 128) 65664 ['convnext_base_stage_0_block_0_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_0_ (None, 56, 56, 128) 128 ['convnext_base_stage_0_block_0_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_0_ (None, 56, 56, 128) 0 ['convnext_base_stage_0_block_0_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add (TFOpLamb (None, 56, 56, 128) 0 ['convnext_base_stem[0][0]', \n", | |
" da) 'convnext_base_stage_0_block_0_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_1_ (None, 56, 56, 128) 6400 ['tf.__operators__.add[0][0]'] \n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_0_block_1_ (None, 56, 56, 128) 256 ['convnext_base_stage_0_block_1_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_1_ (None, 56, 56, 512) 66048 ['convnext_base_stage_0_block_1_l\n", | |
" pointwise_conv_1 (Dense) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_1_ (None, 56, 56, 512) 0 ['convnext_base_stage_0_block_1_p\n", | |
" gelu (Activation) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_1_ (None, 56, 56, 128) 65664 ['convnext_base_stage_0_block_1_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_1_ (None, 56, 56, 128) 128 ['convnext_base_stage_0_block_1_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_1_ (None, 56, 56, 128) 0 ['convnext_base_stage_0_block_1_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_1 (TFOpLa (None, 56, 56, 128) 0 ['tf.__operators__.add[0][0]', \n", | |
" mbda) 'convnext_base_stage_0_block_1_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_2_ (None, 56, 56, 128) 6400 ['tf.__operators__.add_1[0][0]'] \n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_0_block_2_ (None, 56, 56, 128) 256 ['convnext_base_stage_0_block_2_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_2_ (None, 56, 56, 512) 66048 ['convnext_base_stage_0_block_2_l\n", | |
" pointwise_conv_1 (Dense) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_2_ (None, 56, 56, 512) 0 ['convnext_base_stage_0_block_2_p\n", | |
" gelu (Activation) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_2_ (None, 56, 56, 128) 65664 ['convnext_base_stage_0_block_2_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_2_ (None, 56, 56, 128) 128 ['convnext_base_stage_0_block_2_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_0_block_2_ (None, 56, 56, 128) 0 ['convnext_base_stage_0_block_2_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_2 (TFOpLa (None, 56, 56, 128) 0 ['tf.__operators__.add_1[0][0]', \n", | |
" mbda) 'convnext_base_stage_0_block_2_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_downsampling_blo (None, 28, 28, 256) 131584 ['tf.__operators__.add_2[0][0]'] \n", | |
" ck_0 (Sequential) \n", | |
" \n", | |
" convnext_base_stage_1_block_0_ (None, 28, 28, 256) 12800 ['convnext_base_downsampling_bloc\n", | |
" depthwise_conv (Conv2D) k_0[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_0_ (None, 28, 28, 256) 512 ['convnext_base_stage_1_block_0_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_0_ (None, 28, 28, 1024 263168 ['convnext_base_stage_1_block_0_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_0_ (None, 28, 28, 1024 0 ['convnext_base_stage_1_block_0_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_0_ (None, 28, 28, 256) 262400 ['convnext_base_stage_1_block_0_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_0_ (None, 28, 28, 256) 256 ['convnext_base_stage_1_block_0_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_0_ (None, 28, 28, 256) 0 ['convnext_base_stage_1_block_0_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_3 (TFOpLa (None, 28, 28, 256) 0 ['convnext_base_downsampling_bloc\n", | |
" mbda) k_0[0][0]', \n", | |
" 'convnext_base_stage_1_block_0_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_1_ (None, 28, 28, 256) 12800 ['tf.__operators__.add_3[0][0]'] \n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_1_block_1_ (None, 28, 28, 256) 512 ['convnext_base_stage_1_block_1_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_1_ (None, 28, 28, 1024 263168 ['convnext_base_stage_1_block_1_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_1_ (None, 28, 28, 1024 0 ['convnext_base_stage_1_block_1_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_1_ (None, 28, 28, 256) 262400 ['convnext_base_stage_1_block_1_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_1_ (None, 28, 28, 256) 256 ['convnext_base_stage_1_block_1_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_1_ (None, 28, 28, 256) 0 ['convnext_base_stage_1_block_1_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_4 (TFOpLa (None, 28, 28, 256) 0 ['tf.__operators__.add_3[0][0]', \n", | |
" mbda) 'convnext_base_stage_1_block_1_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_2_ (None, 28, 28, 256) 12800 ['tf.__operators__.add_4[0][0]'] \n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_1_block_2_ (None, 28, 28, 256) 512 ['convnext_base_stage_1_block_2_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_2_ (None, 28, 28, 1024 263168 ['convnext_base_stage_1_block_2_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_2_ (None, 28, 28, 1024 0 ['convnext_base_stage_1_block_2_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_2_ (None, 28, 28, 256) 262400 ['convnext_base_stage_1_block_2_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_2_ (None, 28, 28, 256) 256 ['convnext_base_stage_1_block_2_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_1_block_2_ (None, 28, 28, 256) 0 ['convnext_base_stage_1_block_2_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_5 (TFOpLa (None, 28, 28, 256) 0 ['tf.__operators__.add_4[0][0]', \n", | |
" mbda) 'convnext_base_stage_1_block_2_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_downsampling_blo (None, 14, 14, 512) 525312 ['tf.__operators__.add_5[0][0]'] \n", | |
" ck_1 (Sequential) \n", | |
" \n", | |
" convnext_base_stage_2_block_0_ (None, 14, 14, 512) 25600 ['convnext_base_downsampling_bloc\n", | |
" depthwise_conv (Conv2D) k_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_0_ (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_0_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_0_ (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_0_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_0_ (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_0_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_0_ (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_0_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_0_ (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_0_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_0_ (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_0_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_6 (TFOpLa (None, 14, 14, 512) 0 ['convnext_base_downsampling_bloc\n", | |
" mbda) k_1[0][0]', \n", | |
" 'convnext_base_stage_2_block_0_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_1_ (None, 14, 14, 512) 25600 ['tf.__operators__.add_6[0][0]'] \n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_1_ (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_1_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_1_ (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_1_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_1_ (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_1_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_1_ (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_1_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_1_ (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_1_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_1_ (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_1_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_7 (TFOpLa (None, 14, 14, 512) 0 ['tf.__operators__.add_6[0][0]', \n", | |
" mbda) 'convnext_base_stage_2_block_1_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_2_ (None, 14, 14, 512) 25600 ['tf.__operators__.add_7[0][0]'] \n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_2_ (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_2_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_2_ (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_2_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_2_ (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_2_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_2_ (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_2_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_2_ (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_2_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_2_ (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_2_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_8 (TFOpLa (None, 14, 14, 512) 0 ['tf.__operators__.add_7[0][0]', \n", | |
" mbda) 'convnext_base_stage_2_block_2_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_3_ (None, 14, 14, 512) 25600 ['tf.__operators__.add_8[0][0]'] \n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_3_ (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_3_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_3_ (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_3_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_3_ (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_3_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_3_ (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_3_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_3_ (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_3_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_3_ (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_3_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_9 (TFOpLa (None, 14, 14, 512) 0 ['tf.__operators__.add_8[0][0]', \n", | |
" mbda) 'convnext_base_stage_2_block_3_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_4_ (None, 14, 14, 512) 25600 ['tf.__operators__.add_9[0][0]'] \n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_4_ (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_4_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_4_ (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_4_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_4_ (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_4_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_4_ (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_4_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_4_ (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_4_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_4_ (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_4_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_10 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_9[0][0]', \n", | |
" ambda) 'convnext_base_stage_2_block_4_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_5_ (None, 14, 14, 512) 25600 ['tf.__operators__.add_10[0][0]']\n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_5_ (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_5_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_5_ (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_5_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_5_ (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_5_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_5_ (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_5_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_5_ (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_5_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_5_ (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_5_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_11 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_10[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_5_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_6_ (None, 14, 14, 512) 25600 ['tf.__operators__.add_11[0][0]']\n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_6_ (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_6_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_6_ (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_6_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_6_ (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_6_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_6_ (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_6_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_6_ (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_6_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_6_ (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_6_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_12 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_11[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_6_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_7_ (None, 14, 14, 512) 25600 ['tf.__operators__.add_12[0][0]']\n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_7_ (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_7_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_7_ (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_7_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_7_ (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_7_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_7_ (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_7_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_7_ (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_7_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_7_ (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_7_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_13 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_12[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_7_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_8_ (None, 14, 14, 512) 25600 ['tf.__operators__.add_13[0][0]']\n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_8_ (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_8_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_8_ (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_8_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_8_ (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_8_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_8_ (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_8_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_8_ (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_8_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_8_ (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_8_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_14 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_13[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_8_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_9_ (None, 14, 14, 512) 25600 ['tf.__operators__.add_14[0][0]']\n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_9_ (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_9_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_9_ (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_9_l\n", | |
" pointwise_conv_1 (Dense) ) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_9_ (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_9_p\n", | |
" gelu (Activation) ) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_9_ (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_9_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_9_ (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_9_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_9_ (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_9_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_15 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_14[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_9_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_10 (None, 14, 14, 512) 25600 ['tf.__operators__.add_15[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_10 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_10_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_10 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_10_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_10 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_10_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_10 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_10_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_10 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_10_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_10 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_10_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_16 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_15[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_10_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_11 (None, 14, 14, 512) 25600 ['tf.__operators__.add_16[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_11 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_11_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_11 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_11_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_11 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_11_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_11 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_11_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_11 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_11_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_11 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_11_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_17 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_16[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_11_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_12 (None, 14, 14, 512) 25600 ['tf.__operators__.add_17[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_12 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_12_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_12 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_12_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_12 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_12_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_12 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_12_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_12 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_12_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_12 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_12_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_18 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_17[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_12_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_13 (None, 14, 14, 512) 25600 ['tf.__operators__.add_18[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_13 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_13_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_13 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_13_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_13 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_13_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_13 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_13_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_13 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_13_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_13 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_13_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_19 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_18[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_13_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_14 (None, 14, 14, 512) 25600 ['tf.__operators__.add_19[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_14 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_14_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_14 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_14_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_14 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_14_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_14 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_14_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_14 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_14_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_14 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_14_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_20 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_19[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_14_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_15 (None, 14, 14, 512) 25600 ['tf.__operators__.add_20[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_15 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_15_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_15 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_15_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_15 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_15_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_15 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_15_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_15 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_15_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_15 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_15_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_21 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_20[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_15_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_16 (None, 14, 14, 512) 25600 ['tf.__operators__.add_21[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_16 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_16_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_16 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_16_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_16 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_16_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_16 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_16_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_16 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_16_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_16 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_16_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_22 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_21[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_16_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_17 (None, 14, 14, 512) 25600 ['tf.__operators__.add_22[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_17 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_17_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_17 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_17_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_17 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_17_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_17 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_17_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_17 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_17_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_17 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_17_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_23 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_22[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_17_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_18 (None, 14, 14, 512) 25600 ['tf.__operators__.add_23[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_18 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_18_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_18 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_18_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_18 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_18_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_18 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_18_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_18 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_18_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_18 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_18_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_24 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_23[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_18_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_19 (None, 14, 14, 512) 25600 ['tf.__operators__.add_24[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_19 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_19_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_19 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_19_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_19 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_19_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_19 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_19_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_19 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_19_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_19 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_19_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_25 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_24[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_19_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_20 (None, 14, 14, 512) 25600 ['tf.__operators__.add_25[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_20 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_20_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_20 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_20_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_20 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_20_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_20 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_20_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_20 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_20_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_20 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_20_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_26 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_25[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_20_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_21 (None, 14, 14, 512) 25600 ['tf.__operators__.add_26[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_21 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_21_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_21 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_21_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_21 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_21_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_21 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_21_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_21 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_21_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_21 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_21_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_27 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_26[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_21_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_22 (None, 14, 14, 512) 25600 ['tf.__operators__.add_27[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_22 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_22_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_22 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_22_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_22 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_22_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_22 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_22_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_22 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_22_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_22 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_22_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_28 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_27[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_22_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_23 (None, 14, 14, 512) 25600 ['tf.__operators__.add_28[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_23 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_23_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_23 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_23_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_23 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_23_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_23 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_23_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_23 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_23_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_23 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_23_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_29 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_28[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_23_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_24 (None, 14, 14, 512) 25600 ['tf.__operators__.add_29[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_24 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_24_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_24 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_24_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_24 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_24_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_24 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_24_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_24 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_24_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_24 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_24_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_30 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_29[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_24_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_25 (None, 14, 14, 512) 25600 ['tf.__operators__.add_30[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_25 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_25_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_25 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_25_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_25 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_25_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_25 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_25_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_25 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_25_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_25 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_25_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_31 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_30[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_25_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_26 (None, 14, 14, 512) 25600 ['tf.__operators__.add_31[0][0]']\n", | |
" _depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_2_block_26 (None, 14, 14, 512) 1024 ['convnext_base_stage_2_block_26_\n", | |
" _layernorm (LayerNormalization depthwise_conv[0][0]'] \n", | |
" ) \n", | |
" \n", | |
" convnext_base_stage_2_block_26 (None, 14, 14, 2048 1050624 ['convnext_base_stage_2_block_26_\n", | |
" _pointwise_conv_1 (Dense) ) layernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_26 (None, 14, 14, 2048 0 ['convnext_base_stage_2_block_26_\n", | |
" _gelu (Activation) ) pointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_26 (None, 14, 14, 512) 1049088 ['convnext_base_stage_2_block_26_\n", | |
" _pointwise_conv_2 (Dense) gelu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_26 (None, 14, 14, 512) 512 ['convnext_base_stage_2_block_26_\n", | |
" _layer_scale (LayerScale) pointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_2_block_26 (None, 14, 14, 512) 0 ['convnext_base_stage_2_block_26_\n", | |
" _identity (Activation) layer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_32 (TFOpL (None, 14, 14, 512) 0 ['tf.__operators__.add_31[0][0]',\n", | |
" ambda) 'convnext_base_stage_2_block_26_\n", | |
" identity[0][0]'] \n", | |
" \n", | |
" convnext_base_downsampling_blo (None, 7, 7, 1024) 2099200 ['tf.__operators__.add_32[0][0]']\n", | |
" ck_2 (Sequential) \n", | |
" \n", | |
" convnext_base_stage_3_block_0_ (None, 7, 7, 1024) 51200 ['convnext_base_downsampling_bloc\n", | |
" depthwise_conv (Conv2D) k_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_0_ (None, 7, 7, 1024) 2048 ['convnext_base_stage_3_block_0_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_0_ (None, 7, 7, 4096) 4198400 ['convnext_base_stage_3_block_0_l\n", | |
" pointwise_conv_1 (Dense) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_0_ (None, 7, 7, 4096) 0 ['convnext_base_stage_3_block_0_p\n", | |
" gelu (Activation) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_0_ (None, 7, 7, 1024) 4195328 ['convnext_base_stage_3_block_0_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_0_ (None, 7, 7, 1024) 1024 ['convnext_base_stage_3_block_0_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_0_ (None, 7, 7, 1024) 0 ['convnext_base_stage_3_block_0_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_33 (TFOpL (None, 7, 7, 1024) 0 ['convnext_base_downsampling_bloc\n", | |
" ambda) k_2[0][0]', \n", | |
" 'convnext_base_stage_3_block_0_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_1_ (None, 7, 7, 1024) 51200 ['tf.__operators__.add_33[0][0]']\n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_3_block_1_ (None, 7, 7, 1024) 2048 ['convnext_base_stage_3_block_1_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_1_ (None, 7, 7, 4096) 4198400 ['convnext_base_stage_3_block_1_l\n", | |
" pointwise_conv_1 (Dense) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_1_ (None, 7, 7, 4096) 0 ['convnext_base_stage_3_block_1_p\n", | |
" gelu (Activation) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_1_ (None, 7, 7, 1024) 4195328 ['convnext_base_stage_3_block_1_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_1_ (None, 7, 7, 1024) 1024 ['convnext_base_stage_3_block_1_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_1_ (None, 7, 7, 1024) 0 ['convnext_base_stage_3_block_1_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_34 (TFOpL (None, 7, 7, 1024) 0 ['tf.__operators__.add_33[0][0]',\n", | |
" ambda) 'convnext_base_stage_3_block_1_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_2_ (None, 7, 7, 1024) 51200 ['tf.__operators__.add_34[0][0]']\n", | |
" depthwise_conv (Conv2D) \n", | |
" \n", | |
" convnext_base_stage_3_block_2_ (None, 7, 7, 1024) 2048 ['convnext_base_stage_3_block_2_d\n", | |
" layernorm (LayerNormalization) epthwise_conv[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_2_ (None, 7, 7, 4096) 4198400 ['convnext_base_stage_3_block_2_l\n", | |
" pointwise_conv_1 (Dense) ayernorm[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_2_ (None, 7, 7, 4096) 0 ['convnext_base_stage_3_block_2_p\n", | |
" gelu (Activation) ointwise_conv_1[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_2_ (None, 7, 7, 1024) 4195328 ['convnext_base_stage_3_block_2_g\n", | |
" pointwise_conv_2 (Dense) elu[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_2_ (None, 7, 7, 1024) 1024 ['convnext_base_stage_3_block_2_p\n", | |
" layer_scale (LayerScale) ointwise_conv_2[0][0]'] \n", | |
" \n", | |
" convnext_base_stage_3_block_2_ (None, 7, 7, 1024) 0 ['convnext_base_stage_3_block_2_l\n", | |
" identity (Activation) ayer_scale[0][0]'] \n", | |
" \n", | |
" tf.__operators__.add_35 (TFOpL (None, 7, 7, 1024) 0 ['tf.__operators__.add_34[0][0]',\n", | |
" ambda) 'convnext_base_stage_3_block_2_i\n", | |
" dentity[0][0]'] \n", | |
" \n", | |
" convnext_base_head_gap (Global (None, 1024) 0 ['tf.__operators__.add_35[0][0]']\n", | |
" AveragePooling2D) \n", | |
" \n", | |
" convnext_base_head_layernorm ( (None, 1024) 2048 ['convnext_base_head_gap[0][0]'] \n", | |
" LayerNormalization) \n", | |
" \n", | |
" convnext_base_head_dense (Dens (None, 1000) 1025000 ['convnext_base_head_layernorm[0]\n", | |
" e) [0]'] \n", | |
" \n", | |
"==================================================================================================\n", | |
"Total params: 88,591,464\n", | |
"Trainable params: 88,591,464\n", | |
"Non-trainable params: 0\n", | |
"__________________________________________________________________________________________________\n" | |
] | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment