.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/visualkeras_CNN/plot_vgg.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` 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_vgg.py: visualkeras: custom VGG 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-13 .. code-block:: Python :lineno-start: 9 # Authors: The scikit-plots developers # SPDX-License-Identifier: BSD-3-Clause .. GENERATED FROM PYTHON SOURCE LINES 14-15 pip install protobuf==5.29.4 .. GENERATED FROM PYTHON SOURCE LINES 15-22 .. code-block:: Python :lineno-start: 15 import tensorflow as tf # Clear any session to reset the state of TensorFlow/Keras tf.keras.backend.clear_session() from scikitplot import visualkeras .. GENERATED FROM PYTHON SOURCE LINES 23-40 model = tf.keras.applications.VGG16( include_top=True, weights=None, # "imagenet" or 'path/' input_tensor=None, input_shape=None, pooling=None, classes=1000, classifier_activation="softmax", name="vgg16", ) model.summary() visualkeras.layered_view( model, legend=True, show_dimension=True, to_file='result_images/vgg16.png', ) .. GENERATED FROM PYTHON SOURCE LINES 42-54 .. code-block:: Python :lineno-start: 42 model = tf.keras.applications.VGG19( include_top=True, weights=None, # "imagenet" or 'path/' input_tensor=None, input_shape=None, pooling=None, classes=1000, classifier_activation="softmax", name="vgg19", ) # model.summary() .. GENERATED FROM PYTHON SOURCE LINES 55-75 .. code-block:: Python :lineno-start: 55 img_vgg19 = visualkeras.layered_view( model, legend=True, show_dimension=True, min_z=1, min_xy=1, max_z=4096, max_xy=4096, scale_z=0.5, scale_xy=11, font={"font_size": 199}, # to_file="result_images/vgg19.png", save_fig=True, save_fig_filename="vgg19.png", overwrite=False, add_timestamp=True, verbose=True, ) img_vgg19 .. image-sg:: /auto_examples/visualkeras_CNN/images/sphx_glr_plot_vgg_001.png :alt: plot vgg :srcset: /auto_examples/visualkeras_CNN/images/sphx_glr_plot_vgg_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [INFO] Saving path to: /home/circleci/repo/galleries/examples/visualkeras_CNN/result_images/vgg19_20250627_091001Z.png .. GENERATED FROM PYTHON SOURCE LINES 76-84 .. tags:: model-type: classification model-workflow: model building plot-type: visualkeras domain: neural network level: beginner purpose: showcase .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 13.730 seconds) .. _sphx_glr_download_auto_examples_visualkeras_CNN_plot_vgg.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/maintenance/0...X?urlpath=lab/tree/notebooks/auto_examples/visualkeras_CNN/plot_vgg.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_vgg.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_vgg.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_vgg.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_vgg.zip ` .. include:: plot_vgg.recommendations .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_