.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/visualkeras_CNN/plot_resnetv2.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_auto_examples_visualkeras_CNN_plot_resnetv2.py>`
        to download the full example code. or to run this example in your browser via JupyterLite or Binder

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_visualkeras_CNN_plot_resnetv2.py:


visualkeras ResNetV2 example
==========================================

An example showing the :py:func:`~scikitplot.visualkeras` function
used by a :py:class:`~tensorflow.keras.Model` model.

.. GENERATED FROM PYTHON SOURCE LINES 8-43

.. code-block:: Python

    # Authors: The scikit-plots developers
    # SPDX-License-Identifier: BSD-3-Clause

    # Force garbage collection
    import gc; gc.collect()
    import tensorflow as tf
    # Clear any session to reset the state of TensorFlow/Keras
    tf.keras.backend.clear_session()

    from scikitplot import visualkeras

    model = tf.keras.applications.ResNet50V2(
        include_top=True,
        weights=None,  # "imagenet" or 'path/'
        input_tensor=None,
        input_shape=None,
        pooling=None,
        classes=1000,
        classifier_activation="softmax",
        name="resnet50v2",
    )
    img_resnet50v2 = visualkeras.layered_view(
      model,
      legend=True,
      show_dimension=True,
      to_file='../result_images/resnet50v2.png',
    )
    try:
        import matplotlib.pyplot as plt
        plt.imshow(img_resnet50v2)
        plt.axis('off')
        plt.show()
    except:
        pass




.. image-sg:: /auto_examples/visualkeras_CNN/images/sphx_glr_plot_resnetv2_001.png
   :alt: plot resnetv2
   :srcset: /auto_examples/visualkeras_CNN/images/sphx_glr_plot_resnetv2_001.png
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 44-52

.. tags::

   model-type: classification
   model-workflow: model building
   plot-type: visualkeras
   domain: neural network
   level: beginner
   purpose: showcase

.. GENERATED FROM PYTHON SOURCE LINES 53-86

.. code-block:: Python


    # model = tf.keras.applications.ResNet101V2(
    #     include_top=True,
    #     weights=None,  # "imagenet" or 'path/'
    #     input_tensor=None,
    #     input_shape=None,
    #     pooling=None,
    #     classes=1000,
    #     classifier_activation="softmax",
    #     name="resnet101v2",
    # )
    # visualkeras.layered_view(
    #   model,
    #   legend=True,
    #   show_dimension=True,
    #   to_file='../result_images/resnet101v2.png',
    # )

    # model = tf.keras.applications.ResNet152V2(
    #     include_top=True,
    #     weights=None,  # "imagenet" or 'path/'
    #     input_tensor=None,
    #     input_shape=None,
    #     pooling=None,
    #     classes=1000,
    #     classifier_activation="softmax",
    #     name="resnet152v2",
    # )
    # visualkeras.layered_view(
    #   model,
    #   legend=True,
    #   show_dimension=True,
    #   to_file='../result_images/resnet152v2.png',
    # )







.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 5.280 seconds)


.. _sphx_glr_download_auto_examples_visualkeras_CNN_plot_resnetv2.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: binder-badge

      .. image:: images/binder_badge_logo.svg
        :target: https://mybinder.org/v2/gh/scikit-plots/scikit-plots/0.4.X?urlpath=lab/tree/notebooks/auto_examples/visualkeras_CNN/plot_resnetv2.ipynb
        :alt: Launch binder
        :width: 150 px

    .. container:: lite-badge

      .. image:: images/jupyterlite_badge_logo.svg
        :target: ../../lite/lab/index.html?path=auto_examples/visualkeras_CNN/plot_resnetv2.ipynb
        :alt: Launch JupyterLite
        :width: 150 px

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: plot_resnetv2.ipynb <plot_resnetv2.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: plot_resnetv2.py <plot_resnetv2.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_resnetv2.zip <plot_resnetv2.zip>`


.. include:: plot_resnetv2.recommendations


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_