diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 48ca6fa2..83acc5ca 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,7 +23,7 @@ jobs: - name: Run Flake8 run: flake8 - name: Black code style - run: black . --check --target-version py36 --exclude 'build/|buck-out/|dzzist/|_build/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|larq/snapshots/' + run: black . --check --target-version py36 --exclude 'build/|buck-out/|dzzist/|_build/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|tests/snapshots/' - name: Check import order with isort run: isort --check-only --diff - name: Type check with PyType diff --git a/larq_zoo/training/train.py b/larq_zoo/training/train.py index 3e7196b7..f2b7ab93 100644 --- a/larq_zoo/training/train.py +++ b/larq_zoo/training/train.py @@ -25,6 +25,9 @@ class TrainLarqZooModel(Experiment): # Use a per-batch progress bar (as opposed to per-epoch). use_progress_bar: bool = Field(False) + # Whether this experiment is compilation-only (i.e. no training) + dry_run: bool = Field(False) + # How often to run validation. validation_frequency: int = Field(1) @@ -119,6 +122,10 @@ def run(self): self.model.load_weights(str(self.model_path)) print(f"Loaded model from epoch {initial_epoch}.") + if self.dry_run: + click.secho("Dry run: Not starting training!", fg="green") + return + click.secho(str(self)) self.model.fit( diff --git a/setup.py b/setup.py index 77fcc89e..30e726ce 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,7 @@ def readme(): "pytest-xdist==1.31.0", "Pillow==7.1.2", "scipy==1.4.1", + "snapshottest>=0.5.1", "tensorflow_datasets>=3.1.0", ], }, diff --git a/tests/models_test.py b/tests/models_test.py index d4e223af..73a728f8 100644 --- a/tests/models_test.py +++ b/tests/models_test.py @@ -1,58 +1,47 @@ -import functools -import os +from pathlib import Path +import larq as lq import numpy as np import pytest -from tensorflow import keras +import tensorflow as tf +from zookeeper import cli import larq_zoo as lqz -def keras_test(func): - """Function wrapper to clean up after TensorFlow tests. - # Arguments - func: test function to clean up after. - # Returns - A function wrapping the input function. - """ - - @functools.wraps(func) - def wrapper(*args, **kwargs): - output = func(*args, **kwargs) - keras.backend.clear_session() - return output - - return wrapper - - -def parametrize(func): - func = keras_test(func) - return pytest.mark.parametrize( - "app,last_feature_dim", - [ - (lqz.literature.BinaryAlexNet, 256), - (lqz.literature.BiRealNet, 512), - (lqz.literature.BinaryResNetE18, 512), - (lqz.literature.BinaryDenseNet28, 576), - (lqz.literature.BinaryDenseNet37, 640), - (lqz.literature.BinaryDenseNet37Dilated, 640), - (lqz.literature.BinaryDenseNet45, 800), - (lqz.literature.MeliusNet22, 512), - (lqz.literature.XNORNet, 4096), - (lqz.literature.DoReFaNet, 256), - (lqz.literature.RealToBinaryNet, 512), - (lqz.sota.QuickNet, 512), - (lqz.sota.QuickNetLarge, 512), - (lqz.sota.QuickNetXL, 512), - ], - )(func) +@pytest.fixture(autouse=True) +def run_around_tests(): + tf.keras.backend.clear_session() + yield + + +parametrize = pytest.mark.parametrize( + "app,last_feature_dim", + [ + (lqz.literature.BinaryAlexNet, 256), + (lqz.literature.BiRealNet, 512), + (lqz.literature.BinaryResNetE18, 512), + (lqz.literature.BinaryDenseNet28, 576), + (lqz.literature.BinaryDenseNet37, 640), + (lqz.literature.BinaryDenseNet37Dilated, 640), + (lqz.literature.BinaryDenseNet45, 800), + (lqz.literature.MeliusNet22, 512), + (lqz.literature.XNORNet, 4096), + (lqz.literature.DoReFaNet, 256), + (lqz.literature.RealToBinaryNet, 512), + (lqz.sota.QuickNet, 512), + (lqz.sota.QuickNetLarge, 512), + (lqz.sota.QuickNetXL, 512), + ], +) @parametrize def test_prediction(app, last_feature_dim): - file = os.path.join(os.path.dirname(__file__), "fixtures", "elephant.jpg") - img = keras.preprocessing.image.load_img(file) - img = keras.preprocessing.image.img_to_array(img) + img = tf.keras.preprocessing.image.load_img( + Path() / "tests" / "fixtures" / "elephant.jpg" + ) + img = tf.keras.preprocessing.image.img_to_array(img) img = lqz.preprocess_input(img) model = app(weights="imagenet") preds = model.predict(np.expand_dims(img, axis=0)) @@ -74,7 +63,7 @@ def test_basic(app, last_feature_dim): @parametrize def test_keras_tensor_input(app, last_feature_dim): - input_tensor = keras.layers.Input(shape=(224, 224, 3)) + input_tensor = tf.keras.layers.Input(shape=(224, 224, 3)) model = app(weights=None, input_tensor=input_tensor) assert model.output_shape == (None, 1000) @@ -97,3 +86,50 @@ def test_no_top_variable_shape_4(app, last_feature_dim): input_shape = (None, None, 4) model = app(weights=None, include_top=False, input_shape=input_shape) assert model.output_shape == (None, None, None, last_feature_dim) + + +@parametrize +def test_model_summary(app, last_feature_dim): + input_tensor = tf.keras.layers.Input(shape=(224, 224, 3)) + model = app(weights=None, input_tensor=input_tensor) + + class PrintToVariable: + output = "" + + def __call__(self, x): + self.output += f"{x}\n" + + capture = PrintToVariable() + lq.models.summary(model, print_fn=capture) + + summary_file = ( + Path() + / "tests" + / "snapshots" + / "model_summaries" + / f"{app.__name__}_{last_feature_dim}.txt" + ) + + if summary_file.exists(): + with open(summary_file, "r") as file: + content = file.read() + assert content.lower() == capture.output.lower() + else: + with open(summary_file, "w") as file: + file.write(capture.output) + raise FileNotFoundError( + f"Could not find snapshot {summary_file}, so generated a new summary. " + "If this was intentional, re-running the tests locally will make them pass." + ) + + +@pytest.mark.parametrize("command_name", cli.commands.keys()) +def test_experiments(command_name: str, snapshot, capsys): + try: + cli.commands[command_name]( + ["dataset=DummyOxfordFlowers", "batch_size=2", "dry_run=True"] + ) + # Catch successful SystemExit to prevent exception + except SystemExit as e: + if e.code != 0: + raise diff --git a/tests/snapshots/__init__.py b/tests/snapshots/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/snapshots/model_summaries/BiRealNet_512.txt b/tests/snapshots/model_summaries/BiRealNet_512.txt new file mode 100644 index 00000000..a433616a --- /dev/null +++ b/tests/snapshots/model_summaries/BiRealNet_512.txt @@ -0,0 +1,83 @@ ++birealnet18 stats--------------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++-------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| conv2d - (-1, 112, 112, 64) 0 9408 36.75 0 118013952 | +| batch_normalization - (-1, 112, 112, 64) 0 128 0.50 0 0 | +| max_pooling2d - (-1, 56, 56, 64) 0 0 0 0 0 | +| quant_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_1 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_1 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_2 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_1 - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_2 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_3 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_2 - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_3 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_4 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_3 - (-1, 56, 56, 64) 0 0 0 ? ? | +| average_pooling2d - (-1, 28, 28, 64) 0 0 0 0 0 | +| quant_conv2d_4 1 (-1, 28, 28, 128) 73728 0 9.00 57802752 0 | +| conv2d_1 - (-1, 28, 28, 128) 0 8192 32.00 0 6422528 | +| batch_normalization_6 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| batch_normalization_5 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_4 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_5 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_7 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_5 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_6 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_8 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_6 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_7 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_9 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_7 - (-1, 28, 28, 128) 0 0 0 ? ? | +| average_pooling2d_1 - (-1, 14, 14, 128) 0 0 0 0 0 | +| quant_conv2d_8 1 (-1, 14, 14, 256) 294912 0 36.00 57802752 0 | +| conv2d_2 - (-1, 14, 14, 256) 0 32768 128.00 0 6422528 | +| batch_normalization_11 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| batch_normalization_10 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_8 - (-1, 14, 14, 256) 0 0 0 ? ? | +| quant_conv2d_9 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| batch_normalization_12 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_9 - (-1, 14, 14, 256) 0 0 0 ? ? | +| quant_conv2d_10 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| batch_normalization_13 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_10 - (-1, 14, 14, 256) 0 0 0 ? ? | +| quant_conv2d_11 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| batch_normalization_14 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_11 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_2 - (-1, 7, 7, 256) 0 0 0 0 0 | +| quant_conv2d_12 1 (-1, 7, 7, 512) 1179648 0 144.00 57802752 0 | +| conv2d_3 - (-1, 7, 7, 512) 0 131072 512.00 0 6422528 | +| batch_normalization_16 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| batch_normalization_15 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_12 - (-1, 7, 7, 512) 0 0 0 ? ? | +| quant_conv2d_13 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| batch_normalization_17 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_13 - (-1, 7, 7, 512) 0 0 0 ? ? | +| quant_conv2d_14 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| batch_normalization_18 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_14 - (-1, 7, 7, 512) 0 0 0 ? ? | +| quant_conv2d_15 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| batch_normalization_19 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_15 - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_3 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten - (-1, 512) 0 0 0 0 0 | +| dense - (-1, 1000) 0 513000 2003.91 0 512000 | +| activation - (-1, 1000) 0 0 0 ? ? | ++-------------------------------------------------------------------------------------------------------------------+ +| Total 10985472 704040 4091.16 1676279808 137793536 | ++-------------------------------------------------------------------------------------------------------------------+ ++birealnet18 summary--------------------------+ +| Total params 11.7 M | +| Trainable params 11.7 M | +| Non-trainable params 9.6 k | +| Model size 4.00 MiB | +| Model size (8-bit FP weights) 1.98 MiB | +| Float-32 Equivalent 44.59 MiB | +| Compression Ratio of Memory 0.09 | +| Number of MACs 1.81 B | +| Ratio of MACs that are binarized 0.9240 | ++---------------------------------------------+ diff --git a/tests/snapshots/model_summaries/BinaryAlexNet_256.txt b/tests/snapshots/model_summaries/BinaryAlexNet_256.txt new file mode 100644 index 00000000..05b9d4ec --- /dev/null +++ b/tests/snapshots/model_summaries/BinaryAlexNet_256.txt @@ -0,0 +1,40 @@ ++binary_alexnet stats----------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| quant_conv2d - (-1, 56, 56, 64) 23232 0 2.84 0 72855552 | +| max_pooling2d - (-1, 27, 27, 64) 0 0 0 0 0 | +| batch_normalization - (-1, 27, 27, 64) 0 128 0.50 0 0 | +| quant_conv2d_1 1 (-1, 27, 27, 192) 307200 0 37.50 223948800 0 | +| max_pooling2d_1 - (-1, 13, 13, 192) 0 0 0 0 0 | +| batch_normalization_1 - (-1, 13, 13, 192) 0 384 1.50 0 0 | +| quant_conv2d_2 1 (-1, 13, 13, 384) 663552 0 81.00 112140288 0 | +| batch_normalization_2 - (-1, 13, 13, 384) 0 768 3.00 0 0 | +| quant_conv2d_3 1 (-1, 13, 13, 384) 1327104 0 162.00 224280576 0 | +| batch_normalization_3 - (-1, 13, 13, 384) 0 768 3.00 0 0 | +| quant_conv2d_4 1 (-1, 13, 13, 256) 884736 0 108.00 149520384 0 | +| max_pooling2d_2 - (-1, 6, 6, 256) 0 0 0 0 0 | +| batch_normalization_4 - (-1, 6, 6, 256) 0 512 2.00 0 0 | +| flatten - (-1, 9216) 0 0 0 0 0 | +| quant_dense 1 (-1, 4096) 37748736 0 4608.00 37748736 0 | +| batch_normalization_5 - (-1, 4096) 0 8192 32.00 0 0 | +| quant_dense_1 1 (-1, 4096) 16777216 0 2048.00 16777216 0 | +| batch_normalization_6 - (-1, 4096) 0 8192 32.00 0 0 | +| quant_dense_2 1 (-1, 1000) 4096000 0 500.00 4096000 0 | +| batch_normalization_7 - (-1, 1000) 0 2000 7.81 0 0 | +| activation - (-1, 1000) 0 0 0 ? ? | ++------------------------------------------------------------------------------------------------------------------+ +| Total 61827776 20944 7629.15 768512000 72855552 | ++------------------------------------------------------------------------------------------------------------------+ ++binary_alexnet summary------------------------+ +| Total params 61.8 M | +| Trainable params 61.8 M | +| Non-trainable params 20.9 k | +| Model size 7.45 MiB | +| Model size (8-bit FP weights) 7.39 MiB | +| Float-32 Equivalent 235.93 MiB | +| Compression Ratio of Memory 0.03 | +| Number of MACs 841 M | +| Ratio of MACs that are binarized 0.9134 | ++----------------------------------------------+ diff --git a/tests/snapshots/model_summaries/BinaryDenseNet28_576.txt b/tests/snapshots/model_summaries/BinaryDenseNet28_576.txt new file mode 100644 index 00000000..e2bd2cf6 --- /dev/null +++ b/tests/snapshots/model_summaries/BinaryDenseNet28_576.txt @@ -0,0 +1,110 @@ ++binary_densenet28 stats-------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| conv2d - (-1, 112, 112, 64) 0 9408 36.75 0 118013952 | +| batch_normalization - (-1, 112, 112, 64) 0 128 0.50 0 0 | +| activation - (-1, 112, 112, 64) 0 0 0 ? ? | +| max_pooling2d - (-1, 56, 56, 64) 0 0 0 0 0 | +| batch_normalization_1 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| quant_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| concatenate - (-1, 56, 56, 128) 0 0 0 ? ? | +| batch_normalization_2 - (-1, 56, 56, 128) 0 256 1.00 0 0 | +| quant_conv2d_1 1 (-1, 56, 56, 64) 73728 0 9.00 231211008 0 | +| concatenate_1 - (-1, 56, 56, 192) 0 0 0 ? ? | +| batch_normalization_3 - (-1, 56, 56, 192) 0 384 1.50 0 0 | +| quant_conv2d_2 1 (-1, 56, 56, 64) 110592 0 13.50 346816512 0 | +| concatenate_2 - (-1, 56, 56, 256) 0 0 0 ? ? | +| batch_normalization_4 - (-1, 56, 56, 256) 0 512 2.00 0 0 | +| quant_conv2d_3 1 (-1, 56, 56, 64) 147456 0 18.00 462422016 0 | +| concatenate_3 - (-1, 56, 56, 320) 0 0 0 ? ? | +| batch_normalization_5 - (-1, 56, 56, 320) 0 640 2.50 0 0 | +| quant_conv2d_4 1 (-1, 56, 56, 64) 184320 0 22.50 578027520 0 | +| concatenate_4 - (-1, 56, 56, 384) 0 0 0 ? ? | +| batch_normalization_6 - (-1, 56, 56, 384) 0 768 3.00 0 0 | +| quant_conv2d_5 1 (-1, 56, 56, 64) 221184 0 27.00 693633024 0 | +| concatenate_5 - (-1, 56, 56, 448) 0 0 0 ? ? | +| batch_normalization_7 - (-1, 56, 56, 448) 0 896 3.50 0 0 | +| max_pooling2d_1 - (-1, 28, 28, 448) 0 0 0 0 0 | +| activation_1 - (-1, 28, 28, 448) 0 0 0 ? ? | +| conv2d_1 - (-1, 28, 28, 160) 0 71680 280.00 0 56197120 | +| batch_normalization_8 - (-1, 28, 28, 160) 0 320 1.25 0 0 | +| quant_conv2d_6 1 (-1, 28, 28, 64) 92160 0 11.25 72253440 0 | +| concatenate_6 - (-1, 28, 28, 224) 0 0 0 ? ? | +| batch_normalization_9 - (-1, 28, 28, 224) 0 448 1.75 0 0 | +| quant_conv2d_7 1 (-1, 28, 28, 64) 129024 0 15.75 101154816 0 | +| concatenate_7 - (-1, 28, 28, 288) 0 0 0 ? ? | +| batch_normalization_10 - (-1, 28, 28, 288) 0 576 2.25 0 0 | +| quant_conv2d_8 1 (-1, 28, 28, 64) 165888 0 20.25 130056192 0 | +| concatenate_8 - (-1, 28, 28, 352) 0 0 0 ? ? | +| batch_normalization_11 - (-1, 28, 28, 352) 0 704 2.75 0 0 | +| quant_conv2d_9 1 (-1, 28, 28, 64) 202752 0 24.75 158957568 0 | +| concatenate_9 - (-1, 28, 28, 416) 0 0 0 ? ? | +| batch_normalization_12 - (-1, 28, 28, 416) 0 832 3.25 0 0 | +| quant_conv2d_10 1 (-1, 28, 28, 64) 239616 0 29.25 187858944 0 | +| concatenate_10 - (-1, 28, 28, 480) 0 0 0 ? ? | +| batch_normalization_13 - (-1, 28, 28, 480) 0 960 3.75 0 0 | +| quant_conv2d_11 1 (-1, 28, 28, 64) 276480 0 33.75 216760320 0 | +| concatenate_11 - (-1, 28, 28, 544) 0 0 0 ? ? | +| batch_normalization_14 - (-1, 28, 28, 544) 0 1088 4.25 0 0 | +| max_pooling2d_2 - (-1, 14, 14, 544) 0 0 0 0 0 | +| activation_2 - (-1, 14, 14, 544) 0 0 0 ? ? | +| conv2d_2 - (-1, 14, 14, 192) 0 104448 408.00 0 20471808 | +| batch_normalization_15 - (-1, 14, 14, 192) 0 384 1.50 0 0 | +| quant_conv2d_12 1 (-1, 14, 14, 64) 110592 0 13.50 21676032 0 | +| concatenate_12 - (-1, 14, 14, 256) 0 0 0 ? ? | +| batch_normalization_16 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| quant_conv2d_13 1 (-1, 14, 14, 64) 147456 0 18.00 28901376 0 | +| concatenate_13 - (-1, 14, 14, 320) 0 0 0 ? ? | +| batch_normalization_17 - (-1, 14, 14, 320) 0 640 2.50 0 0 | +| quant_conv2d_14 1 (-1, 14, 14, 64) 184320 0 22.50 36126720 0 | +| concatenate_14 - (-1, 14, 14, 384) 0 0 0 ? ? | +| batch_normalization_18 - (-1, 14, 14, 384) 0 768 3.00 0 0 | +| quant_conv2d_15 1 (-1, 14, 14, 64) 221184 0 27.00 43352064 0 | +| concatenate_15 - (-1, 14, 14, 448) 0 0 0 ? ? | +| batch_normalization_19 - (-1, 14, 14, 448) 0 896 3.50 0 0 | +| quant_conv2d_16 1 (-1, 14, 14, 64) 258048 0 31.50 50577408 0 | +| concatenate_16 - (-1, 14, 14, 512) 0 0 0 ? ? | +| batch_normalization_20 - (-1, 14, 14, 512) 0 1024 4.00 0 0 | +| quant_conv2d_17 1 (-1, 14, 14, 64) 294912 0 36.00 57802752 0 | +| concatenate_17 - (-1, 14, 14, 576) 0 0 0 ? ? | +| batch_normalization_21 - (-1, 14, 14, 576) 0 1152 4.50 0 0 | +| max_pooling2d_3 - (-1, 7, 7, 576) 0 0 0 0 0 | +| activation_3 - (-1, 7, 7, 576) 0 0 0 ? ? | +| conv2d_3 - (-1, 7, 7, 256) 0 147456 576.00 0 7225344 | +| batch_normalization_22 - (-1, 7, 7, 256) 0 512 2.00 0 0 | +| quant_conv2d_18 1 (-1, 7, 7, 64) 147456 0 18.00 7225344 0 | +| concatenate_18 - (-1, 7, 7, 320) 0 0 0 ? ? | +| batch_normalization_23 - (-1, 7, 7, 320) 0 640 2.50 0 0 | +| quant_conv2d_19 1 (-1, 7, 7, 64) 184320 0 22.50 9031680 0 | +| concatenate_19 - (-1, 7, 7, 384) 0 0 0 ? ? | +| batch_normalization_24 - (-1, 7, 7, 384) 0 768 3.00 0 0 | +| quant_conv2d_20 1 (-1, 7, 7, 64) 221184 0 27.00 10838016 0 | +| concatenate_20 - (-1, 7, 7, 448) 0 0 0 ? ? | +| batch_normalization_25 - (-1, 7, 7, 448) 0 896 3.50 0 0 | +| quant_conv2d_21 1 (-1, 7, 7, 64) 258048 0 31.50 12644352 0 | +| concatenate_21 - (-1, 7, 7, 512) 0 0 0 ? ? | +| batch_normalization_26 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| quant_conv2d_22 1 (-1, 7, 7, 64) 294912 0 36.00 14450688 0 | +| concatenate_22 - (-1, 7, 7, 576) 0 0 0 ? ? | +| batch_normalization_27 - (-1, 7, 7, 576) 0 1152 4.50 0 0 | +| activation_4 - (-1, 7, 7, 576) 0 0 0 ? ? | +| average_pooling2d - (-1, 1, 1, 576) 0 0 0 0 0 | +| flatten - (-1, 576) 0 0 0 0 0 | +| dense - (-1, 1000) 0 577000 2253.91 0 576000 | +| activation_5 - (-1, 1000) 0 0 0 ? ? | ++------------------------------------------------------------------------------------------------------------------+ +| Total 4202496 929000 4141.91 3587383296 202484224 | ++------------------------------------------------------------------------------------------------------------------+ ++binary_densenet28 summary--------------------+ +| Total params 5.13 M | +| Trainable params 5.11 M | +| Non-trainable params 19 k | +| Model size 4.04 MiB | +| Model size (8-bit FP weights) 1.39 MiB | +| Float-32 Equivalent 19.58 MiB | +| Compression Ratio of Memory 0.21 | +| Number of MACs 3.79 B | +| Ratio of MACs that are binarized 0.9466 | ++---------------------------------------------+ diff --git a/tests/snapshots/model_summaries/BinaryDenseNet37Dilated_640.txt b/tests/snapshots/model_summaries/BinaryDenseNet37Dilated_640.txt new file mode 100644 index 00000000..bdbb0f5e --- /dev/null +++ b/tests/snapshots/model_summaries/BinaryDenseNet37Dilated_640.txt @@ -0,0 +1,135 @@ ++binary_densenet37_dilated stats-----------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| conv2d - (-1, 112, 112, 64) 0 9408 36.75 0 118013952 | +| batch_normalization - (-1, 112, 112, 64) 0 128 0.50 0 0 | +| activation - (-1, 112, 112, 64) 0 0 0 ? ? | +| max_pooling2d - (-1, 56, 56, 64) 0 0 0 0 0 | +| batch_normalization_1 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| quant_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| concatenate - (-1, 56, 56, 128) 0 0 0 ? ? | +| batch_normalization_2 - (-1, 56, 56, 128) 0 256 1.00 0 0 | +| quant_conv2d_1 1 (-1, 56, 56, 64) 73728 0 9.00 231211008 0 | +| concatenate_1 - (-1, 56, 56, 192) 0 0 0 ? ? | +| batch_normalization_3 - (-1, 56, 56, 192) 0 384 1.50 0 0 | +| quant_conv2d_2 1 (-1, 56, 56, 64) 110592 0 13.50 346816512 0 | +| concatenate_2 - (-1, 56, 56, 256) 0 0 0 ? ? | +| batch_normalization_4 - (-1, 56, 56, 256) 0 512 2.00 0 0 | +| quant_conv2d_3 1 (-1, 56, 56, 64) 147456 0 18.00 462422016 0 | +| concatenate_3 - (-1, 56, 56, 320) 0 0 0 ? ? | +| batch_normalization_5 - (-1, 56, 56, 320) 0 640 2.50 0 0 | +| quant_conv2d_4 1 (-1, 56, 56, 64) 184320 0 22.50 578027520 0 | +| concatenate_4 - (-1, 56, 56, 384) 0 0 0 ? ? | +| batch_normalization_6 - (-1, 56, 56, 384) 0 768 3.00 0 0 | +| quant_conv2d_5 1 (-1, 56, 56, 64) 221184 0 27.00 693633024 0 | +| concatenate_5 - (-1, 56, 56, 448) 0 0 0 ? ? | +| batch_normalization_7 - (-1, 56, 56, 448) 0 896 3.50 0 0 | +| max_pooling2d_1 - (-1, 28, 28, 448) 0 0 0 0 0 | +| activation_1 - (-1, 28, 28, 448) 0 0 0 ? ? | +| conv2d_1 - (-1, 28, 28, 128) 0 57344 224.00 0 44957696 | +| batch_normalization_8 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| quant_conv2d_6 1 (-1, 28, 28, 64) 73728 0 9.00 57802752 0 | +| concatenate_6 - (-1, 28, 28, 192) 0 0 0 ? ? | +| batch_normalization_9 - (-1, 28, 28, 192) 0 384 1.50 0 0 | +| quant_conv2d_7 1 (-1, 28, 28, 64) 110592 0 13.50 86704128 0 | +| concatenate_7 - (-1, 28, 28, 256) 0 0 0 ? ? | +| batch_normalization_10 - (-1, 28, 28, 256) 0 512 2.00 0 0 | +| quant_conv2d_8 1 (-1, 28, 28, 64) 147456 0 18.00 115605504 0 | +| concatenate_8 - (-1, 28, 28, 320) 0 0 0 ? ? | +| batch_normalization_11 - (-1, 28, 28, 320) 0 640 2.50 0 0 | +| quant_conv2d_9 1 (-1, 28, 28, 64) 184320 0 22.50 144506880 0 | +| concatenate_9 - (-1, 28, 28, 384) 0 0 0 ? ? | +| batch_normalization_12 - (-1, 28, 28, 384) 0 768 3.00 0 0 | +| quant_conv2d_10 1 (-1, 28, 28, 64) 221184 0 27.00 173408256 0 | +| concatenate_10 - (-1, 28, 28, 448) 0 0 0 ? ? | +| batch_normalization_13 - (-1, 28, 28, 448) 0 896 3.50 0 0 | +| quant_conv2d_11 1 (-1, 28, 28, 64) 258048 0 31.50 202309632 0 | +| concatenate_11 - (-1, 28, 28, 512) 0 0 0 ? ? | +| batch_normalization_14 - (-1, 28, 28, 512) 0 1024 4.00 0 0 | +| quant_conv2d_12 1 (-1, 28, 28, 64) 294912 0 36.00 231211008 0 | +| concatenate_12 - (-1, 28, 28, 576) 0 0 0 ? ? | +| batch_normalization_15 - (-1, 28, 28, 576) 0 1152 4.50 0 0 | +| quant_conv2d_13 1 (-1, 28, 28, 64) 331776 0 40.50 260112384 0 | +| concatenate_13 - (-1, 28, 28, 640) 0 0 0 ? ? | +| batch_normalization_16 - (-1, 28, 28, 640) 0 1280 5.00 0 0 | +| activation_2 - (-1, 28, 28, 640) 0 0 0 ? ? | +| conv2d_2 - (-1, 28, 28, 192) 0 122880 480.00 0 96337920 | +| batch_normalization_17 - (-1, 28, 28, 192) 0 384 1.50 0 0 | +| quant_conv2d_14 1 (-1, 28, 28, 64) 110592 0 13.50 86704128 0 | +| concatenate_14 - (-1, 28, 28, 256) 0 0 0 ? ? | +| batch_normalization_18 - (-1, 28, 28, 256) 0 512 2.00 0 0 | +| quant_conv2d_15 1 (-1, 28, 28, 64) 147456 0 18.00 115605504 0 | +| concatenate_15 - (-1, 28, 28, 320) 0 0 0 ? ? | +| batch_normalization_19 - (-1, 28, 28, 320) 0 640 2.50 0 0 | +| quant_conv2d_16 1 (-1, 28, 28, 64) 184320 0 22.50 144506880 0 | +| concatenate_16 - (-1, 28, 28, 384) 0 0 0 ? ? | +| batch_normalization_20 - (-1, 28, 28, 384) 0 768 3.00 0 0 | +| quant_conv2d_17 1 (-1, 28, 28, 64) 221184 0 27.00 173408256 0 | +| concatenate_17 - (-1, 28, 28, 448) 0 0 0 ? ? | +| batch_normalization_21 - (-1, 28, 28, 448) 0 896 3.50 0 0 | +| quant_conv2d_18 1 (-1, 28, 28, 64) 258048 0 31.50 202309632 0 | +| concatenate_18 - (-1, 28, 28, 512) 0 0 0 ? ? | +| batch_normalization_22 - (-1, 28, 28, 512) 0 1024 4.00 0 0 | +| quant_conv2d_19 1 (-1, 28, 28, 64) 294912 0 36.00 231211008 0 | +| concatenate_19 - (-1, 28, 28, 576) 0 0 0 ? ? | +| batch_normalization_23 - (-1, 28, 28, 576) 0 1152 4.50 0 0 | +| quant_conv2d_20 1 (-1, 28, 28, 64) 331776 0 40.50 260112384 0 | +| concatenate_20 - (-1, 28, 28, 640) 0 0 0 ? ? | +| batch_normalization_24 - (-1, 28, 28, 640) 0 1280 5.00 0 0 | +| quant_conv2d_21 1 (-1, 28, 28, 64) 368640 0 45.00 289013760 0 | +| concatenate_21 - (-1, 28, 28, 704) 0 0 0 ? ? | +| batch_normalization_25 - (-1, 28, 28, 704) 0 1408 5.50 0 0 | +| quant_conv2d_22 1 (-1, 28, 28, 64) 405504 0 49.50 317915136 0 | +| concatenate_22 - (-1, 28, 28, 768) 0 0 0 ? ? | +| batch_normalization_26 - (-1, 28, 28, 768) 0 1536 6.00 0 0 | +| quant_conv2d_23 1 (-1, 28, 28, 64) 442368 0 54.00 346816512 0 | +| concatenate_23 - (-1, 28, 28, 832) 0 0 0 ? ? | +| batch_normalization_27 - (-1, 28, 28, 832) 0 1664 6.50 0 0 | +| quant_conv2d_24 1 (-1, 28, 28, 64) 479232 0 58.50 375717888 0 | +| concatenate_24 - (-1, 28, 28, 896) 0 0 0 ? ? | +| batch_normalization_28 - (-1, 28, 28, 896) 0 1792 7.00 0 0 | +| quant_conv2d_25 1 (-1, 28, 28, 64) 516096 0 63.00 404619264 0 | +| concatenate_25 - (-1, 28, 28, 960) 0 0 0 ? ? | +| batch_normalization_29 - (-1, 28, 28, 960) 0 1920 7.50 0 0 | +| activation_3 - (-1, 28, 28, 960) 0 0 0 ? ? | +| conv2d_3 - (-1, 28, 28, 256) 0 245760 960.00 0 192675840 | +| batch_normalization_30 - (-1, 28, 28, 256) 0 512 2.00 0 0 | +| quant_conv2d_26 1 (-1, 28, 28, 64) 147456 0 18.00 115605504 0 | +| concatenate_26 - (-1, 28, 28, 320) 0 0 0 ? ? | +| batch_normalization_31 - (-1, 28, 28, 320) 0 640 2.50 0 0 | +| quant_conv2d_27 1 (-1, 28, 28, 64) 184320 0 22.50 144506880 0 | +| concatenate_27 - (-1, 28, 28, 384) 0 0 0 ? ? | +| batch_normalization_32 - (-1, 28, 28, 384) 0 768 3.00 0 0 | +| quant_conv2d_28 1 (-1, 28, 28, 64) 221184 0 27.00 173408256 0 | +| concatenate_28 - (-1, 28, 28, 448) 0 0 0 ? ? | +| batch_normalization_33 - (-1, 28, 28, 448) 0 896 3.50 0 0 | +| quant_conv2d_29 1 (-1, 28, 28, 64) 258048 0 31.50 202309632 0 | +| concatenate_29 - (-1, 28, 28, 512) 0 0 0 ? ? | +| batch_normalization_34 - (-1, 28, 28, 512) 0 1024 4.00 0 0 | +| quant_conv2d_30 1 (-1, 28, 28, 64) 294912 0 36.00 231211008 0 | +| concatenate_30 - (-1, 28, 28, 576) 0 0 0 ? ? | +| batch_normalization_35 - (-1, 28, 28, 576) 0 1152 4.50 0 0 | +| quant_conv2d_31 1 (-1, 28, 28, 64) 331776 0 40.50 260112384 0 | +| concatenate_31 - (-1, 28, 28, 640) 0 0 0 ? ? | +| batch_normalization_36 - (-1, 28, 28, 640) 0 1280 5.00 0 0 | +| activation_4 - (-1, 28, 28, 640) 0 0 0 ? ? | +| average_pooling2d - (-1, 1, 1, 640) 0 0 0 0 0 | +| flatten - (-1, 640) 0 0 0 0 0 | +| dense - (-1, 1000) 0 641000 2503.91 0 640000 | +| activation_5 - (-1, 1000) 0 0 0 ? ? | ++------------------------------------------------------------------------------------------------------------------+ +| Total 7593984 1108264 5256.16 7774470144 452625408 | ++------------------------------------------------------------------------------------------------------------------+ ++binary_densenet37_dilated summary------------+ +| Total params 8.7 M | +| Trainable params 8.67 M | +| Non-trainable params 31.9 k | +| Model size 5.13 MiB | +| Model size (8-bit FP weights) 1.96 MiB | +| Float-32 Equivalent 33.20 MiB | +| Compression Ratio of Memory 0.15 | +| Number of MACs 8.23 B | +| Ratio of MACs that are binarized 0.9450 | ++---------------------------------------------+ diff --git a/tests/snapshots/model_summaries/BinaryDenseNet37_640.txt b/tests/snapshots/model_summaries/BinaryDenseNet37_640.txt new file mode 100644 index 00000000..2517bd01 --- /dev/null +++ b/tests/snapshots/model_summaries/BinaryDenseNet37_640.txt @@ -0,0 +1,137 @@ ++binary_densenet37 stats-------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| conv2d - (-1, 112, 112, 64) 0 9408 36.75 0 118013952 | +| batch_normalization - (-1, 112, 112, 64) 0 128 0.50 0 0 | +| activation - (-1, 112, 112, 64) 0 0 0 ? ? | +| max_pooling2d - (-1, 56, 56, 64) 0 0 0 0 0 | +| batch_normalization_1 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| quant_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| concatenate - (-1, 56, 56, 128) 0 0 0 ? ? | +| batch_normalization_2 - (-1, 56, 56, 128) 0 256 1.00 0 0 | +| quant_conv2d_1 1 (-1, 56, 56, 64) 73728 0 9.00 231211008 0 | +| concatenate_1 - (-1, 56, 56, 192) 0 0 0 ? ? | +| batch_normalization_3 - (-1, 56, 56, 192) 0 384 1.50 0 0 | +| quant_conv2d_2 1 (-1, 56, 56, 64) 110592 0 13.50 346816512 0 | +| concatenate_2 - (-1, 56, 56, 256) 0 0 0 ? ? | +| batch_normalization_4 - (-1, 56, 56, 256) 0 512 2.00 0 0 | +| quant_conv2d_3 1 (-1, 56, 56, 64) 147456 0 18.00 462422016 0 | +| concatenate_3 - (-1, 56, 56, 320) 0 0 0 ? ? | +| batch_normalization_5 - (-1, 56, 56, 320) 0 640 2.50 0 0 | +| quant_conv2d_4 1 (-1, 56, 56, 64) 184320 0 22.50 578027520 0 | +| concatenate_4 - (-1, 56, 56, 384) 0 0 0 ? ? | +| batch_normalization_6 - (-1, 56, 56, 384) 0 768 3.00 0 0 | +| quant_conv2d_5 1 (-1, 56, 56, 64) 221184 0 27.00 693633024 0 | +| concatenate_5 - (-1, 56, 56, 448) 0 0 0 ? ? | +| batch_normalization_7 - (-1, 56, 56, 448) 0 896 3.50 0 0 | +| max_pooling2d_1 - (-1, 28, 28, 448) 0 0 0 0 0 | +| activation_1 - (-1, 28, 28, 448) 0 0 0 ? ? | +| conv2d_1 - (-1, 28, 28, 128) 0 57344 224.00 0 44957696 | +| batch_normalization_8 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| quant_conv2d_6 1 (-1, 28, 28, 64) 73728 0 9.00 57802752 0 | +| concatenate_6 - (-1, 28, 28, 192) 0 0 0 ? ? | +| batch_normalization_9 - (-1, 28, 28, 192) 0 384 1.50 0 0 | +| quant_conv2d_7 1 (-1, 28, 28, 64) 110592 0 13.50 86704128 0 | +| concatenate_7 - (-1, 28, 28, 256) 0 0 0 ? ? | +| batch_normalization_10 - (-1, 28, 28, 256) 0 512 2.00 0 0 | +| quant_conv2d_8 1 (-1, 28, 28, 64) 147456 0 18.00 115605504 0 | +| concatenate_8 - (-1, 28, 28, 320) 0 0 0 ? ? | +| batch_normalization_11 - (-1, 28, 28, 320) 0 640 2.50 0 0 | +| quant_conv2d_9 1 (-1, 28, 28, 64) 184320 0 22.50 144506880 0 | +| concatenate_9 - (-1, 28, 28, 384) 0 0 0 ? ? | +| batch_normalization_12 - (-1, 28, 28, 384) 0 768 3.00 0 0 | +| quant_conv2d_10 1 (-1, 28, 28, 64) 221184 0 27.00 173408256 0 | +| concatenate_10 - (-1, 28, 28, 448) 0 0 0 ? ? | +| batch_normalization_13 - (-1, 28, 28, 448) 0 896 3.50 0 0 | +| quant_conv2d_11 1 (-1, 28, 28, 64) 258048 0 31.50 202309632 0 | +| concatenate_11 - (-1, 28, 28, 512) 0 0 0 ? ? | +| batch_normalization_14 - (-1, 28, 28, 512) 0 1024 4.00 0 0 | +| quant_conv2d_12 1 (-1, 28, 28, 64) 294912 0 36.00 231211008 0 | +| concatenate_12 - (-1, 28, 28, 576) 0 0 0 ? ? | +| batch_normalization_15 - (-1, 28, 28, 576) 0 1152 4.50 0 0 | +| quant_conv2d_13 1 (-1, 28, 28, 64) 331776 0 40.50 260112384 0 | +| concatenate_13 - (-1, 28, 28, 640) 0 0 0 ? ? | +| batch_normalization_16 - (-1, 28, 28, 640) 0 1280 5.00 0 0 | +| max_pooling2d_2 - (-1, 14, 14, 640) 0 0 0 0 0 | +| activation_2 - (-1, 14, 14, 640) 0 0 0 ? ? | +| conv2d_2 - (-1, 14, 14, 192) 0 122880 480.00 0 24084480 | +| batch_normalization_17 - (-1, 14, 14, 192) 0 384 1.50 0 0 | +| quant_conv2d_14 1 (-1, 14, 14, 64) 110592 0 13.50 21676032 0 | +| concatenate_14 - (-1, 14, 14, 256) 0 0 0 ? ? | +| batch_normalization_18 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| quant_conv2d_15 1 (-1, 14, 14, 64) 147456 0 18.00 28901376 0 | +| concatenate_15 - (-1, 14, 14, 320) 0 0 0 ? ? | +| batch_normalization_19 - (-1, 14, 14, 320) 0 640 2.50 0 0 | +| quant_conv2d_16 1 (-1, 14, 14, 64) 184320 0 22.50 36126720 0 | +| concatenate_16 - (-1, 14, 14, 384) 0 0 0 ? ? | +| batch_normalization_20 - (-1, 14, 14, 384) 0 768 3.00 0 0 | +| quant_conv2d_17 1 (-1, 14, 14, 64) 221184 0 27.00 43352064 0 | +| concatenate_17 - (-1, 14, 14, 448) 0 0 0 ? ? | +| batch_normalization_21 - (-1, 14, 14, 448) 0 896 3.50 0 0 | +| quant_conv2d_18 1 (-1, 14, 14, 64) 258048 0 31.50 50577408 0 | +| concatenate_18 - (-1, 14, 14, 512) 0 0 0 ? ? | +| batch_normalization_22 - (-1, 14, 14, 512) 0 1024 4.00 0 0 | +| quant_conv2d_19 1 (-1, 14, 14, 64) 294912 0 36.00 57802752 0 | +| concatenate_19 - (-1, 14, 14, 576) 0 0 0 ? ? | +| batch_normalization_23 - (-1, 14, 14, 576) 0 1152 4.50 0 0 | +| quant_conv2d_20 1 (-1, 14, 14, 64) 331776 0 40.50 65028096 0 | +| concatenate_20 - (-1, 14, 14, 640) 0 0 0 ? ? | +| batch_normalization_24 - (-1, 14, 14, 640) 0 1280 5.00 0 0 | +| quant_conv2d_21 1 (-1, 14, 14, 64) 368640 0 45.00 72253440 0 | +| concatenate_21 - (-1, 14, 14, 704) 0 0 0 ? ? | +| batch_normalization_25 - (-1, 14, 14, 704) 0 1408 5.50 0 0 | +| quant_conv2d_22 1 (-1, 14, 14, 64) 405504 0 49.50 79478784 0 | +| concatenate_22 - (-1, 14, 14, 768) 0 0 0 ? ? | +| batch_normalization_26 - (-1, 14, 14, 768) 0 1536 6.00 0 0 | +| quant_conv2d_23 1 (-1, 14, 14, 64) 442368 0 54.00 86704128 0 | +| concatenate_23 - (-1, 14, 14, 832) 0 0 0 ? ? | +| batch_normalization_27 - (-1, 14, 14, 832) 0 1664 6.50 0 0 | +| quant_conv2d_24 1 (-1, 14, 14, 64) 479232 0 58.50 93929472 0 | +| concatenate_24 - (-1, 14, 14, 896) 0 0 0 ? ? | +| batch_normalization_28 - (-1, 14, 14, 896) 0 1792 7.00 0 0 | +| quant_conv2d_25 1 (-1, 14, 14, 64) 516096 0 63.00 101154816 0 | +| concatenate_25 - (-1, 14, 14, 960) 0 0 0 ? ? | +| batch_normalization_29 - (-1, 14, 14, 960) 0 1920 7.50 0 0 | +| max_pooling2d_3 - (-1, 7, 7, 960) 0 0 0 0 0 | +| activation_3 - (-1, 7, 7, 960) 0 0 0 ? ? | +| conv2d_3 - (-1, 7, 7, 256) 0 245760 960.00 0 12042240 | +| batch_normalization_30 - (-1, 7, 7, 256) 0 512 2.00 0 0 | +| quant_conv2d_26 1 (-1, 7, 7, 64) 147456 0 18.00 7225344 0 | +| concatenate_26 - (-1, 7, 7, 320) 0 0 0 ? ? | +| batch_normalization_31 - (-1, 7, 7, 320) 0 640 2.50 0 0 | +| quant_conv2d_27 1 (-1, 7, 7, 64) 184320 0 22.50 9031680 0 | +| concatenate_27 - (-1, 7, 7, 384) 0 0 0 ? ? | +| batch_normalization_32 - (-1, 7, 7, 384) 0 768 3.00 0 0 | +| quant_conv2d_28 1 (-1, 7, 7, 64) 221184 0 27.00 10838016 0 | +| concatenate_28 - (-1, 7, 7, 448) 0 0 0 ? ? | +| batch_normalization_33 - (-1, 7, 7, 448) 0 896 3.50 0 0 | +| quant_conv2d_29 1 (-1, 7, 7, 64) 258048 0 31.50 12644352 0 | +| concatenate_29 - (-1, 7, 7, 512) 0 0 0 ? ? | +| batch_normalization_34 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| quant_conv2d_30 1 (-1, 7, 7, 64) 294912 0 36.00 14450688 0 | +| concatenate_30 - (-1, 7, 7, 576) 0 0 0 ? ? | +| batch_normalization_35 - (-1, 7, 7, 576) 0 1152 4.50 0 0 | +| quant_conv2d_31 1 (-1, 7, 7, 64) 331776 0 40.50 16257024 0 | +| concatenate_31 - (-1, 7, 7, 640) 0 0 0 ? ? | +| batch_normalization_36 - (-1, 7, 7, 640) 0 1280 5.00 0 0 | +| activation_4 - (-1, 7, 7, 640) 0 0 0 ? ? | +| average_pooling2d - (-1, 1, 1, 640) 0 0 0 0 0 | +| flatten - (-1, 640) 0 0 0 0 0 | +| dense - (-1, 1000) 0 641000 2503.91 0 640000 | +| activation_5 - (-1, 1000) 0 0 0 ? ? | ++------------------------------------------------------------------------------------------------------------------+ +| Total 7593984 1108264 5256.16 4506808320 199738368 | ++------------------------------------------------------------------------------------------------------------------+ ++binary_densenet37 summary--------------------+ +| Total params 8.7 M | +| Trainable params 8.67 M | +| Non-trainable params 31.9 k | +| Model size 5.13 MiB | +| Model size (8-bit FP weights) 1.96 MiB | +| Float-32 Equivalent 33.20 MiB | +| Compression Ratio of Memory 0.15 | +| Number of MACs 4.71 B | +| Ratio of MACs that are binarized 0.9576 | ++---------------------------------------------+ diff --git a/tests/snapshots/model_summaries/BinaryDenseNet45_800.txt b/tests/snapshots/model_summaries/BinaryDenseNet45_800.txt new file mode 100644 index 00000000..96683862 --- /dev/null +++ b/tests/snapshots/model_summaries/BinaryDenseNet45_800.txt @@ -0,0 +1,161 @@ ++binary_densenet45 stats--------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++-------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| conv2d - (-1, 112, 112, 64) 0 9408 36.75 0 118013952 | +| batch_normalization - (-1, 112, 112, 64) 0 128 0.50 0 0 | +| activation - (-1, 112, 112, 64) 0 0 0 ? ? | +| max_pooling2d - (-1, 56, 56, 64) 0 0 0 0 0 | +| batch_normalization_1 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| quant_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| concatenate - (-1, 56, 56, 128) 0 0 0 ? ? | +| batch_normalization_2 - (-1, 56, 56, 128) 0 256 1.00 0 0 | +| quant_conv2d_1 1 (-1, 56, 56, 64) 73728 0 9.00 231211008 0 | +| concatenate_1 - (-1, 56, 56, 192) 0 0 0 ? ? | +| batch_normalization_3 - (-1, 56, 56, 192) 0 384 1.50 0 0 | +| quant_conv2d_2 1 (-1, 56, 56, 64) 110592 0 13.50 346816512 0 | +| concatenate_2 - (-1, 56, 56, 256) 0 0 0 ? ? | +| batch_normalization_4 - (-1, 56, 56, 256) 0 512 2.00 0 0 | +| quant_conv2d_3 1 (-1, 56, 56, 64) 147456 0 18.00 462422016 0 | +| concatenate_3 - (-1, 56, 56, 320) 0 0 0 ? ? | +| batch_normalization_5 - (-1, 56, 56, 320) 0 640 2.50 0 0 | +| quant_conv2d_4 1 (-1, 56, 56, 64) 184320 0 22.50 578027520 0 | +| concatenate_4 - (-1, 56, 56, 384) 0 0 0 ? ? | +| batch_normalization_6 - (-1, 56, 56, 384) 0 768 3.00 0 0 | +| quant_conv2d_5 1 (-1, 56, 56, 64) 221184 0 27.00 693633024 0 | +| concatenate_5 - (-1, 56, 56, 448) 0 0 0 ? ? | +| batch_normalization_7 - (-1, 56, 56, 448) 0 896 3.50 0 0 | +| max_pooling2d_1 - (-1, 28, 28, 448) 0 0 0 0 0 | +| activation_1 - (-1, 28, 28, 448) 0 0 0 ? ? | +| conv2d_1 - (-1, 28, 28, 160) 0 71680 280.00 0 56197120 | +| batch_normalization_8 - (-1, 28, 28, 160) 0 320 1.25 0 0 | +| quant_conv2d_6 1 (-1, 28, 28, 64) 92160 0 11.25 72253440 0 | +| concatenate_6 - (-1, 28, 28, 224) 0 0 0 ? ? | +| batch_normalization_9 - (-1, 28, 28, 224) 0 448 1.75 0 0 | +| quant_conv2d_7 1 (-1, 28, 28, 64) 129024 0 15.75 101154816 0 | +| concatenate_7 - (-1, 28, 28, 288) 0 0 0 ? ? | +| batch_normalization_10 - (-1, 28, 28, 288) 0 576 2.25 0 0 | +| quant_conv2d_8 1 (-1, 28, 28, 64) 165888 0 20.25 130056192 0 | +| concatenate_8 - (-1, 28, 28, 352) 0 0 0 ? ? | +| batch_normalization_11 - (-1, 28, 28, 352) 0 704 2.75 0 0 | +| quant_conv2d_9 1 (-1, 28, 28, 64) 202752 0 24.75 158957568 0 | +| concatenate_9 - (-1, 28, 28, 416) 0 0 0 ? ? | +| batch_normalization_12 - (-1, 28, 28, 416) 0 832 3.25 0 0 | +| quant_conv2d_10 1 (-1, 28, 28, 64) 239616 0 29.25 187858944 0 | +| concatenate_10 - (-1, 28, 28, 480) 0 0 0 ? ? | +| batch_normalization_13 - (-1, 28, 28, 480) 0 960 3.75 0 0 | +| quant_conv2d_11 1 (-1, 28, 28, 64) 276480 0 33.75 216760320 0 | +| concatenate_11 - (-1, 28, 28, 544) 0 0 0 ? ? | +| batch_normalization_14 - (-1, 28, 28, 544) 0 1088 4.25 0 0 | +| quant_conv2d_12 1 (-1, 28, 28, 64) 313344 0 38.25 245661696 0 | +| concatenate_12 - (-1, 28, 28, 608) 0 0 0 ? ? | +| batch_normalization_15 - (-1, 28, 28, 608) 0 1216 4.75 0 0 | +| quant_conv2d_13 1 (-1, 28, 28, 64) 350208 0 42.75 274563072 0 | +| concatenate_13 - (-1, 28, 28, 672) 0 0 0 ? ? | +| batch_normalization_16 - (-1, 28, 28, 672) 0 1344 5.25 0 0 | +| quant_conv2d_14 1 (-1, 28, 28, 64) 387072 0 47.25 303464448 0 | +| concatenate_14 - (-1, 28, 28, 736) 0 0 0 ? ? | +| batch_normalization_17 - (-1, 28, 28, 736) 0 1472 5.75 0 0 | +| quant_conv2d_15 1 (-1, 28, 28, 64) 423936 0 51.75 332365824 0 | +| concatenate_15 - (-1, 28, 28, 800) 0 0 0 ? ? | +| batch_normalization_18 - (-1, 28, 28, 800) 0 1600 6.25 0 0 | +| quant_conv2d_16 1 (-1, 28, 28, 64) 460800 0 56.25 361267200 0 | +| concatenate_16 - (-1, 28, 28, 864) 0 0 0 ? ? | +| batch_normalization_19 - (-1, 28, 28, 864) 0 1728 6.75 0 0 | +| quant_conv2d_17 1 (-1, 28, 28, 64) 497664 0 60.75 390168576 0 | +| concatenate_17 - (-1, 28, 28, 928) 0 0 0 ? ? | +| batch_normalization_20 - (-1, 28, 28, 928) 0 1856 7.25 0 0 | +| max_pooling2d_2 - (-1, 14, 14, 928) 0 0 0 0 0 | +| activation_2 - (-1, 14, 14, 928) 0 0 0 ? ? | +| conv2d_2 - (-1, 14, 14, 288) 0 267264 1044.00 0 52383744 | +| batch_normalization_21 - (-1, 14, 14, 288) 0 576 2.25 0 0 | +| quant_conv2d_18 1 (-1, 14, 14, 64) 165888 0 20.25 32514048 0 | +| concatenate_18 - (-1, 14, 14, 352) 0 0 0 ? ? | +| batch_normalization_22 - (-1, 14, 14, 352) 0 704 2.75 0 0 | +| quant_conv2d_19 1 (-1, 14, 14, 64) 202752 0 24.75 39739392 0 | +| concatenate_19 - (-1, 14, 14, 416) 0 0 0 ? ? | +| batch_normalization_23 - (-1, 14, 14, 416) 0 832 3.25 0 0 | +| quant_conv2d_20 1 (-1, 14, 14, 64) 239616 0 29.25 46964736 0 | +| concatenate_20 - (-1, 14, 14, 480) 0 0 0 ? ? | +| batch_normalization_24 - (-1, 14, 14, 480) 0 960 3.75 0 0 | +| quant_conv2d_21 1 (-1, 14, 14, 64) 276480 0 33.75 54190080 0 | +| concatenate_21 - (-1, 14, 14, 544) 0 0 0 ? ? | +| batch_normalization_25 - (-1, 14, 14, 544) 0 1088 4.25 0 0 | +| quant_conv2d_22 1 (-1, 14, 14, 64) 313344 0 38.25 61415424 0 | +| concatenate_22 - (-1, 14, 14, 608) 0 0 0 ? ? | +| batch_normalization_26 - (-1, 14, 14, 608) 0 1216 4.75 0 0 | +| quant_conv2d_23 1 (-1, 14, 14, 64) 350208 0 42.75 68640768 0 | +| concatenate_23 - (-1, 14, 14, 672) 0 0 0 ? ? | +| batch_normalization_27 - (-1, 14, 14, 672) 0 1344 5.25 0 0 | +| quant_conv2d_24 1 (-1, 14, 14, 64) 387072 0 47.25 75866112 0 | +| concatenate_24 - (-1, 14, 14, 736) 0 0 0 ? ? | +| batch_normalization_28 - (-1, 14, 14, 736) 0 1472 5.75 0 0 | +| quant_conv2d_25 1 (-1, 14, 14, 64) 423936 0 51.75 83091456 0 | +| concatenate_25 - (-1, 14, 14, 800) 0 0 0 ? ? | +| batch_normalization_29 - (-1, 14, 14, 800) 0 1600 6.25 0 0 | +| quant_conv2d_26 1 (-1, 14, 14, 64) 460800 0 56.25 90316800 0 | +| concatenate_26 - (-1, 14, 14, 864) 0 0 0 ? ? | +| batch_normalization_30 - (-1, 14, 14, 864) 0 1728 6.75 0 0 | +| quant_conv2d_27 1 (-1, 14, 14, 64) 497664 0 60.75 97542144 0 | +| concatenate_27 - (-1, 14, 14, 928) 0 0 0 ? ? | +| batch_normalization_31 - (-1, 14, 14, 928) 0 1856 7.25 0 0 | +| quant_conv2d_28 1 (-1, 14, 14, 64) 534528 0 65.25 104767488 0 | +| concatenate_28 - (-1, 14, 14, 992) 0 0 0 ? ? | +| batch_normalization_32 - (-1, 14, 14, 992) 0 1984 7.75 0 0 | +| quant_conv2d_29 1 (-1, 14, 14, 64) 571392 0 69.75 111992832 0 | +| concatenate_29 - (-1, 14, 14, 1056) 0 0 0 ? ? | +| batch_normalization_33 - (-1, 14, 14, 1056) 0 2112 8.25 0 0 | +| quant_conv2d_30 1 (-1, 14, 14, 64) 608256 0 74.25 119218176 0 | +| concatenate_30 - (-1, 14, 14, 1120) 0 0 0 ? ? | +| batch_normalization_34 - (-1, 14, 14, 1120) 0 2240 8.75 0 0 | +| quant_conv2d_31 1 (-1, 14, 14, 64) 645120 0 78.75 126443520 0 | +| concatenate_31 - (-1, 14, 14, 1184) 0 0 0 ? ? | +| batch_normalization_35 - (-1, 14, 14, 1184) 0 2368 9.25 0 0 | +| max_pooling2d_3 - (-1, 7, 7, 1184) 0 0 0 0 0 | +| activation_3 - (-1, 7, 7, 1184) 0 0 0 ? ? | +| conv2d_3 - (-1, 7, 7, 288) 0 340992 1332.00 0 16708608 | +| batch_normalization_36 - (-1, 7, 7, 288) 0 576 2.25 0 0 | +| quant_conv2d_32 1 (-1, 7, 7, 64) 165888 0 20.25 8128512 0 | +| concatenate_32 - (-1, 7, 7, 352) 0 0 0 ? ? | +| batch_normalization_37 - (-1, 7, 7, 352) 0 704 2.75 0 0 | +| quant_conv2d_33 1 (-1, 7, 7, 64) 202752 0 24.75 9934848 0 | +| concatenate_33 - (-1, 7, 7, 416) 0 0 0 ? ? | +| batch_normalization_38 - (-1, 7, 7, 416) 0 832 3.25 0 0 | +| quant_conv2d_34 1 (-1, 7, 7, 64) 239616 0 29.25 11741184 0 | +| concatenate_34 - (-1, 7, 7, 480) 0 0 0 ? ? | +| batch_normalization_39 - (-1, 7, 7, 480) 0 960 3.75 0 0 | +| quant_conv2d_35 1 (-1, 7, 7, 64) 276480 0 33.75 13547520 0 | +| concatenate_35 - (-1, 7, 7, 544) 0 0 0 ? ? | +| batch_normalization_40 - (-1, 7, 7, 544) 0 1088 4.25 0 0 | +| quant_conv2d_36 1 (-1, 7, 7, 64) 313344 0 38.25 15353856 0 | +| concatenate_36 - (-1, 7, 7, 608) 0 0 0 ? ? | +| batch_normalization_41 - (-1, 7, 7, 608) 0 1216 4.75 0 0 | +| quant_conv2d_37 1 (-1, 7, 7, 64) 350208 0 42.75 17160192 0 | +| concatenate_37 - (-1, 7, 7, 672) 0 0 0 ? ? | +| batch_normalization_42 - (-1, 7, 7, 672) 0 1344 5.25 0 0 | +| quant_conv2d_38 1 (-1, 7, 7, 64) 387072 0 47.25 18966528 0 | +| concatenate_38 - (-1, 7, 7, 736) 0 0 0 ? ? | +| batch_normalization_43 - (-1, 7, 7, 736) 0 1472 5.75 0 0 | +| quant_conv2d_39 1 (-1, 7, 7, 64) 423936 0 51.75 20772864 0 | +| concatenate_39 - (-1, 7, 7, 800) 0 0 0 ? ? | +| batch_normalization_44 - (-1, 7, 7, 800) 0 1600 6.25 0 0 | +| activation_4 - (-1, 7, 7, 800) 0 0 0 ? ? | +| average_pooling2d - (-1, 1, 1, 800) 0 0 0 0 0 | +| flatten - (-1, 800) 0 0 0 0 0 | +| dense - (-1, 1000) 0 801000 3128.91 0 800000 | +| activation_5 - (-1, 1000) 0 0 0 ? ? | ++-------------------------------------------------------------------------------------------------------------------+ +| Total 12349440 1540072 7523.41 6430556160 244103424 | ++-------------------------------------------------------------------------------------------------------------------+ ++binary_densenet45 summary--------------------+ +| Total params 13.9 M | +| Trainable params 13.8 M | +| Non-trainable params 49.7 k | +| Model size 7.35 MiB | +| Model size (8-bit FP weights) 2.94 MiB | +| Float-32 Equivalent 52.98 MiB | +| Compression Ratio of Memory 0.14 | +| Number of MACs 6.67 B | +| Ratio of MACs that are binarized 0.9634 | ++---------------------------------------------+ diff --git a/tests/snapshots/model_summaries/BinaryResNetE18_512.txt b/tests/snapshots/model_summaries/BinaryResNetE18_512.txt new file mode 100644 index 00000000..4077806d --- /dev/null +++ b/tests/snapshots/model_summaries/BinaryResNetE18_512.txt @@ -0,0 +1,86 @@ ++binary_resnet_e_18 stats-------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++-------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| conv2d - (-1, 112, 112, 64) 0 9408 36.75 0 118013952 | +| batch_normalization - (-1, 112, 112, 64) 0 128 0.50 0 0 | +| activation - (-1, 112, 112, 64) 0 0 0 ? ? | +| max_pooling2d - (-1, 56, 56, 64) 0 0 0 0 0 | +| batch_normalization_1 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| quant_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_2 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_1 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_3 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_1 - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_2 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_4 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_2 - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_3 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_5 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_3 - (-1, 56, 56, 64) 0 0 0 ? ? | +| average_pooling2d - (-1, 28, 28, 64) 0 0 0 0 0 | +| quant_conv2d_4 1 (-1, 28, 28, 128) 73728 0 9.00 57802752 0 | +| conv2d_1 - (-1, 28, 28, 128) 0 8192 32.00 0 6422528 | +| batch_normalization_7 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| batch_normalization_6 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_4 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_5 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_8 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_5 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_6 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_9 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_6 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_7 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_10 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_7 - (-1, 28, 28, 128) 0 0 0 ? ? | +| average_pooling2d_1 - (-1, 14, 14, 128) 0 0 0 0 0 | +| quant_conv2d_8 1 (-1, 14, 14, 256) 294912 0 36.00 57802752 0 | +| conv2d_2 - (-1, 14, 14, 256) 0 32768 128.00 0 6422528 | +| batch_normalization_12 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| batch_normalization_11 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_8 - (-1, 14, 14, 256) 0 0 0 ? ? | +| quant_conv2d_9 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| batch_normalization_13 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_9 - (-1, 14, 14, 256) 0 0 0 ? ? | +| quant_conv2d_10 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| batch_normalization_14 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_10 - (-1, 14, 14, 256) 0 0 0 ? ? | +| quant_conv2d_11 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| batch_normalization_15 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_11 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_2 - (-1, 7, 7, 256) 0 0 0 0 0 | +| quant_conv2d_12 1 (-1, 7, 7, 512) 1179648 0 144.00 57802752 0 | +| conv2d_3 - (-1, 7, 7, 512) 0 131072 512.00 0 6422528 | +| batch_normalization_17 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| batch_normalization_16 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_12 - (-1, 7, 7, 512) 0 0 0 ? ? | +| quant_conv2d_13 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| batch_normalization_18 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_13 - (-1, 7, 7, 512) 0 0 0 ? ? | +| quant_conv2d_14 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| batch_normalization_19 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_14 - (-1, 7, 7, 512) 0 0 0 ? ? | +| quant_conv2d_15 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| batch_normalization_20 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_15 - (-1, 7, 7, 512) 0 0 0 ? ? | +| activation_1 - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_3 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten - (-1, 512) 0 0 0 0 0 | +| dense - (-1, 1000) 0 513000 2003.91 0 512000 | +| activation_2 - (-1, 1000) 0 0 0 ? ? | ++-------------------------------------------------------------------------------------------------------------------+ +| Total 10985472 704168 4091.66 1676279808 137793536 | ++-------------------------------------------------------------------------------------------------------------------+ ++binary_resnet_e_18 summary-------------------+ +| Total params 11.7 M | +| Trainable params 11.7 M | +| Non-trainable params 9.73 k | +| Model size 4.00 MiB | +| Model size (8-bit FP weights) 1.98 MiB | +| Float-32 Equivalent 44.59 MiB | +| Compression Ratio of Memory 0.09 | +| Number of MACs 1.81 B | +| Ratio of MACs that are binarized 0.9240 | ++---------------------------------------------+ diff --git a/tests/snapshots/model_summaries/DoReFaNet_256.txt b/tests/snapshots/model_summaries/DoReFaNet_256.txt new file mode 100644 index 00000000..9d9d4847 --- /dev/null +++ b/tests/snapshots/model_summaries/DoReFaNet_256.txt @@ -0,0 +1,39 @@ ++dorefanet stats----------------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 2-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++-------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| conv2d - (-1, 54, 54, 96) 0 41568 162.38 0 120932352 | +| quant_conv2d 2 (-1, 54, 54, 256) 614400 0 75.00 1791590400 0 | +| batch_normalization - (-1, 54, 54, 256) 0 512 2.00 0 0 | +| max_pooling2d - (-1, 27, 27, 256) 0 0 0 0 0 | +| quant_conv2d_1 2 (-1, 27, 27, 384) 884736 0 108.00 644972544 0 | +| batch_normalization_1 - (-1, 27, 27, 384) 0 768 3.00 0 0 | +| max_pooling2d_1 - (-1, 14, 14, 384) 0 0 0 0 0 | +| quant_conv2d_2 2 (-1, 14, 14, 384) 1327104 0 162.00 260112384 0 | +| batch_normalization_2 - (-1, 14, 14, 384) 0 768 3.00 0 0 | +| quant_conv2d_3 2 (-1, 14, 14, 256) 884736 0 108.00 173408256 0 | +| batch_normalization_3 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| max_pooling2d_2 - (-1, 6, 6, 256) 0 0 0 0 0 | +| flatten - (-1, 9216) 0 0 0 0 0 | +| quant_dense 2 (-1, 4096) 37748736 0 4608.00 37748736 0 | +| batch_normalization_4 - (-1, 4096) 0 8192 32.00 0 0 | +| quant_dense_1 2 (-1, 4096) 16777216 0 2048.00 16777216 0 | +| batch_normalization_5 - (-1, 4096) 0 8192 32.00 0 0 | +| activation - (-1, 4096) 0 0 0 ? ? | +| dense - (-1, 1000) 0 4097000 16003.91 0 4096000 | +| activation_1 - (-1, 1000) 0 0 0 ? ? | ++-------------------------------------------------------------------------------------------------------------------+ +| Total 58236928 4157512 23349.28 2924609536 125028352 | ++-------------------------------------------------------------------------------------------------------------------+ ++dorefanet summary------------------------------+ +| Total params 62.4 M | +| Trainable params 62.4 M | +| Non-trainable params 18.9 k | +| Model size 22.80 MiB | +| Model size (8-bit FP weights) 10.91 MiB | +| Float-32 Equivalent 238.02 MiB | +| Compression Ratio of Memory 0.10 | +| Number of MACs 3.05 B | +| Ratio of MACs that are ternarized 0.9590 | ++-----------------------------------------------+ diff --git a/tests/snapshots/model_summaries/MeliusNet22_512.txt b/tests/snapshots/model_summaries/MeliusNet22_512.txt new file mode 100644 index 00000000..28f79847 --- /dev/null +++ b/tests/snapshots/model_summaries/MeliusNet22_512.txt @@ -0,0 +1,163 @@ ++meliusnet22 stats--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| stem_s0_conv - (-1, 112, 112, 32) 0 864 3.38 0 10838016 | +| stem_s0_bn - (-1, 112, 112, 32) 0 64 0.25 0 0 | +| stem_s0_relu - (-1, 112, 112, 32) 0 0 0 ? ? | +| stem_s1_groupconv_split - ((None, 112, 112, 8), (None, 112, 112, 8), (None, 112, 112, 8), (None, 112, 112, 8)) 0 0 0 ? ? | +| stem_s1_groupconv_conv0 - (-1, 112, 112, 8) 0 576 2.25 0 7225344 | +| stem_s1_groupconv_conv1 - (-1, 112, 112, 8) 0 576 2.25 0 7225344 | +| stem_s1_groupconv_conv2 - (-1, 112, 112, 8) 0 576 2.25 0 7225344 | +| stem_s1_groupconv_conv3 - (-1, 112, 112, 8) 0 576 2.25 0 7225344 | +| stem_s1_groupconv_concat - (-1, 112, 112, 32) 0 0 0 ? ? | +| stem_s1_bn - (-1, 112, 112, 32) 0 64 0.25 0 0 | +| stem_s1_relu - (-1, 112, 112, 32) 0 0 0 ? ? | +| stem_s2_groupconv_split - ((None, 112, 112, 4), (None, 112, 112, 4), (None, 112, 112, 4), (None, 112, 112, 4), (None, 112, 112, 4), (None, 112, 112, 4), (None, 112, 112, 4), (None, 112, 112, 4)) 0 0 0 ? ? | +| stem_s2_groupconv_conv0 - (-1, 112, 112, 8) 0 288 1.12 0 3612672 | +| stem_s2_groupconv_conv1 - (-1, 112, 112, 8) 0 288 1.12 0 3612672 | +| stem_s2_groupconv_conv2 - (-1, 112, 112, 8) 0 288 1.12 0 3612672 | +| stem_s2_groupconv_conv3 - (-1, 112, 112, 8) 0 288 1.12 0 3612672 | +| stem_s2_groupconv_conv4 - (-1, 112, 112, 8) 0 288 1.12 0 3612672 | +| stem_s2_groupconv_conv5 - (-1, 112, 112, 8) 0 288 1.12 0 3612672 | +| stem_s2_groupconv_conv6 - (-1, 112, 112, 8) 0 288 1.12 0 3612672 | +| stem_s2_groupconv_conv7 - (-1, 112, 112, 8) 0 288 1.12 0 3612672 | +| stem_s2_groupconv_concat - (-1, 112, 112, 64) 0 0 0 ? ? | +| stem_s2_bn - (-1, 112, 112, 64) 0 128 0.50 0 0 | +| stem_s2_relu - (-1, 112, 112, 64) 0 0 0 ? ? | +| stem_pool - (-1, 56, 56, 64) 0 0 0 0 0 | +| section_0_block_0_dense_bn - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| section_0_block_0_dense_binconv 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| section_0_block_0_dense_concat - (-1, 56, 56, 128) 0 0 0 ? ? | +| section_0_block_0_improve_bn - (-1, 56, 56, 128) 0 256 1.00 0 0 | +| section_0_block_0_improve_binconv 1 (-1, 56, 56, 64) 73728 0 9.00 231211008 0 | +| section_0_block_0_improve_merge - (-1, 56, 56, 128) 0 0 0 ? ? | +| section_0_block_1_dense_bn - (-1, 56, 56, 128) 0 256 1.00 0 0 | +| section_0_block_1_dense_binconv 1 (-1, 56, 56, 64) 73728 0 9.00 231211008 0 | +| section_0_block_1_dense_concat - (-1, 56, 56, 192) 0 0 0 ? ? | +| section_0_block_1_improve_bn - (-1, 56, 56, 192) 0 384 1.50 0 0 | +| section_0_block_1_improve_binconv 1 (-1, 56, 56, 64) 110592 0 13.50 346816512 0 | +| section_0_block_1_improve_merge - (-1, 56, 56, 192) 0 0 0 ? ? | +| section_0_block_2_dense_bn - (-1, 56, 56, 192) 0 384 1.50 0 0 | +| section_0_block_2_dense_binconv 1 (-1, 56, 56, 64) 110592 0 13.50 346816512 0 | +| section_0_block_2_dense_concat - (-1, 56, 56, 256) 0 0 0 ? ? | +| section_0_block_2_improve_bn - (-1, 56, 56, 256) 0 512 2.00 0 0 | +| section_0_block_2_improve_binconv 1 (-1, 56, 56, 64) 147456 0 18.00 462422016 0 | +| section_0_block_2_improve_merge - (-1, 56, 56, 256) 0 0 0 ? ? | +| section_0_block_3_dense_bn - (-1, 56, 56, 256) 0 512 2.00 0 0 | +| section_0_block_3_dense_binconv 1 (-1, 56, 56, 64) 147456 0 18.00 462422016 0 | +| section_0_block_3_dense_concat - (-1, 56, 56, 320) 0 0 0 ? ? | +| section_0_block_3_improve_bn - (-1, 56, 56, 320) 0 640 2.50 0 0 | +| section_0_block_3_improve_binconv 1 (-1, 56, 56, 64) 184320 0 22.50 578027520 0 | +| section_0_block_3_improve_merge - (-1, 56, 56, 320) 0 0 0 ? ? | +| section_0_transition_bn - (-1, 56, 56, 320) 0 640 2.50 0 0 | +| section_0_transition_maxpool - (-1, 28, 28, 320) 0 0 0 0 0 | +| section_0_transition_relu - (-1, 28, 28, 320) 0 0 0 ? ? | +| section_0_transition_pw - (-1, 28, 28, 160) 0 51200 200.00 0 40140800 | +| section_1_block_0_dense_bn - (-1, 28, 28, 160) 0 320 1.25 0 0 | +| section_1_block_0_dense_binconv 1 (-1, 28, 28, 64) 92160 0 11.25 72253440 0 | +| section_1_block_0_dense_concat - (-1, 28, 28, 224) 0 0 0 ? ? | +| section_1_block_0_improve_bn - (-1, 28, 28, 224) 0 448 1.75 0 0 | +| section_1_block_0_improve_binconv 1 (-1, 28, 28, 64) 129024 0 15.75 101154816 0 | +| section_1_block_0_improve_merge - (-1, 28, 28, 224) 0 0 0 ? ? | +| section_1_block_1_dense_bn - (-1, 28, 28, 224) 0 448 1.75 0 0 | +| section_1_block_1_dense_binconv 1 (-1, 28, 28, 64) 129024 0 15.75 101154816 0 | +| section_1_block_1_dense_concat - (-1, 28, 28, 288) 0 0 0 ? ? | +| section_1_block_1_improve_bn - (-1, 28, 28, 288) 0 576 2.25 0 0 | +| section_1_block_1_improve_binconv 1 (-1, 28, 28, 64) 165888 0 20.25 130056192 0 | +| section_1_block_1_improve_merge - (-1, 28, 28, 288) 0 0 0 ? ? | +| section_1_block_2_dense_bn - (-1, 28, 28, 288) 0 576 2.25 0 0 | +| section_1_block_2_dense_binconv 1 (-1, 28, 28, 64) 165888 0 20.25 130056192 0 | +| section_1_block_2_dense_concat - (-1, 28, 28, 352) 0 0 0 ? ? | +| section_1_block_2_improve_bn - (-1, 28, 28, 352) 0 704 2.75 0 0 | +| section_1_block_2_improve_binconv 1 (-1, 28, 28, 64) 202752 0 24.75 158957568 0 | +| section_1_block_2_improve_merge - (-1, 28, 28, 352) 0 0 0 ? ? | +| section_1_block_3_dense_bn - (-1, 28, 28, 352) 0 704 2.75 0 0 | +| section_1_block_3_dense_binconv 1 (-1, 28, 28, 64) 202752 0 24.75 158957568 0 | +| section_1_block_3_dense_concat - (-1, 28, 28, 416) 0 0 0 ? ? | +| section_1_block_3_improve_bn - (-1, 28, 28, 416) 0 832 3.25 0 0 | +| section_1_block_3_improve_binconv 1 (-1, 28, 28, 64) 239616 0 29.25 187858944 0 | +| section_1_block_3_improve_merge - (-1, 28, 28, 416) 0 0 0 ? ? | +| section_1_block_4_dense_bn - (-1, 28, 28, 416) 0 832 3.25 0 0 | +| section_1_block_4_dense_binconv 1 (-1, 28, 28, 64) 239616 0 29.25 187858944 0 | +| section_1_block_4_dense_concat - (-1, 28, 28, 480) 0 0 0 ? ? | +| section_1_block_4_improve_bn - (-1, 28, 28, 480) 0 960 3.75 0 0 | +| section_1_block_4_improve_binconv 1 (-1, 28, 28, 64) 276480 0 33.75 216760320 0 | +| section_1_block_4_improve_merge - (-1, 28, 28, 480) 0 0 0 ? ? | +| section_1_transition_bn - (-1, 28, 28, 480) 0 960 3.75 0 0 | +| section_1_transition_maxpool - (-1, 14, 14, 480) 0 0 0 0 0 | +| section_1_transition_relu - (-1, 14, 14, 480) 0 0 0 ? ? | +| section_1_transition_pw - (-1, 14, 14, 224) 0 107520 420.00 0 21073920 | +| section_2_block_0_dense_bn - (-1, 14, 14, 224) 0 448 1.75 0 0 | +| section_2_block_0_dense_binconv 1 (-1, 14, 14, 64) 129024 0 15.75 25288704 0 | +| section_2_block_0_dense_concat - (-1, 14, 14, 288) 0 0 0 ? ? | +| section_2_block_0_improve_bn - (-1, 14, 14, 288) 0 576 2.25 0 0 | +| section_2_block_0_improve_binconv 1 (-1, 14, 14, 64) 165888 0 20.25 32514048 0 | +| section_2_block_0_improve_merge - (-1, 14, 14, 288) 0 0 0 ? ? | +| section_2_block_1_dense_bn - (-1, 14, 14, 288) 0 576 2.25 0 0 | +| section_2_block_1_dense_binconv 1 (-1, 14, 14, 64) 165888 0 20.25 32514048 0 | +| section_2_block_1_dense_concat - (-1, 14, 14, 352) 0 0 0 ? ? | +| section_2_block_1_improve_bn - (-1, 14, 14, 352) 0 704 2.75 0 0 | +| section_2_block_1_improve_binconv 1 (-1, 14, 14, 64) 202752 0 24.75 39739392 0 | +| section_2_block_1_improve_merge - (-1, 14, 14, 352) 0 0 0 ? ? | +| section_2_block_2_dense_bn - (-1, 14, 14, 352) 0 704 2.75 0 0 | +| section_2_block_2_dense_binconv 1 (-1, 14, 14, 64) 202752 0 24.75 39739392 0 | +| section_2_block_2_dense_concat - (-1, 14, 14, 416) 0 0 0 ? ? | +| section_2_block_2_improve_bn - (-1, 14, 14, 416) 0 832 3.25 0 0 | +| section_2_block_2_improve_binconv 1 (-1, 14, 14, 64) 239616 0 29.25 46964736 0 | +| section_2_block_2_improve_merge - (-1, 14, 14, 416) 0 0 0 ? ? | +| section_2_block_3_dense_bn - (-1, 14, 14, 416) 0 832 3.25 0 0 | +| section_2_block_3_dense_binconv 1 (-1, 14, 14, 64) 239616 0 29.25 46964736 0 | +| section_2_block_3_dense_concat - (-1, 14, 14, 480) 0 0 0 ? ? | +| section_2_block_3_improve_bn - (-1, 14, 14, 480) 0 960 3.75 0 0 | +| section_2_block_3_improve_binconv 1 (-1, 14, 14, 64) 276480 0 33.75 54190080 0 | +| section_2_block_3_improve_merge - (-1, 14, 14, 480) 0 0 0 ? ? | +| section_2_transition_bn - (-1, 14, 14, 480) 0 960 3.75 0 0 | +| section_2_transition_maxpool - (-1, 7, 7, 480) 0 0 0 0 0 | +| section_2_transition_relu - (-1, 7, 7, 480) 0 0 0 ? ? | +| section_2_transition_pw - (-1, 7, 7, 256) 0 122880 480.00 0 6021120 | +| section_3_block_0_dense_bn - (-1, 7, 7, 256) 0 512 2.00 0 0 | +| section_3_block_0_dense_binconv 1 (-1, 7, 7, 64) 147456 0 18.00 7225344 0 | +| section_3_block_0_dense_concat - (-1, 7, 7, 320) 0 0 0 ? ? | +| section_3_block_0_improve_bn - (-1, 7, 7, 320) 0 640 2.50 0 0 | +| section_3_block_0_improve_binconv 1 (-1, 7, 7, 64) 184320 0 22.50 9031680 0 | +| section_3_block_0_improve_merge - (-1, 7, 7, 320) 0 0 0 ? ? | +| section_3_block_1_dense_bn - (-1, 7, 7, 320) 0 640 2.50 0 0 | +| section_3_block_1_dense_binconv 1 (-1, 7, 7, 64) 184320 0 22.50 9031680 0 | +| section_3_block_1_dense_concat - (-1, 7, 7, 384) 0 0 0 ? ? | +| section_3_block_1_improve_bn - (-1, 7, 7, 384) 0 768 3.00 0 0 | +| section_3_block_1_improve_binconv 1 (-1, 7, 7, 64) 221184 0 27.00 10838016 0 | +| section_3_block_1_improve_merge - (-1, 7, 7, 384) 0 0 0 ? ? | +| section_3_block_2_dense_bn - (-1, 7, 7, 384) 0 768 3.00 0 0 | +| section_3_block_2_dense_binconv 1 (-1, 7, 7, 64) 221184 0 27.00 10838016 0 | +| section_3_block_2_dense_concat - (-1, 7, 7, 448) 0 0 0 ? ? | +| section_3_block_2_improve_bn - (-1, 7, 7, 448) 0 896 3.50 0 0 | +| section_3_block_2_improve_binconv 1 (-1, 7, 7, 64) 258048 0 31.50 12644352 0 | +| section_3_block_2_improve_merge - (-1, 7, 7, 448) 0 0 0 ? ? | +| section_3_block_3_dense_bn - (-1, 7, 7, 448) 0 896 3.50 0 0 | +| section_3_block_3_dense_binconv 1 (-1, 7, 7, 64) 258048 0 31.50 12644352 0 | +| section_3_block_3_dense_concat - (-1, 7, 7, 512) 0 0 0 ? ? | +| section_3_block_3_improve_bn - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| section_3_block_3_improve_binconv 1 (-1, 7, 7, 64) 294912 0 36.00 14450688 0 | +| section_3_block_3_improve_merge - (-1, 7, 7, 512) 0 0 0 ? ? | +| head_bn - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| head_relu - (-1, 7, 7, 512) 0 0 0 ? ? | +| head_globalpool_pool - (-1, 1, 1, 512) 0 0 0 0 0 | +| head_globalpool_flatten - (-1, 512) 0 0 0 0 0 | +| head_dense - (-1, 1000) 0 513000 2003.91 0 512000 | +| head_softmax - (-1, 1000) 0 0 0 ? ? | ++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Total 6119424 825160 3970.28 4624220160 136388608 | ++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ++meliusnet22 summary--------------------------+ +| Total params 6.94 M | +| Trainable params 6.92 M | +| Non-trainable params 25.1 k | +| Model size 3.88 MiB | +| Model size (8-bit FP weights) 1.52 MiB | +| Float-32 Equivalent 26.49 MiB | +| Compression Ratio of Memory 0.15 | +| Number of MACs 4.76 B | +| Ratio of MACs that are binarized 0.9714 | ++---------------------------------------------+ diff --git a/tests/snapshots/model_summaries/QuickNetLarge_512.txt b/tests/snapshots/model_summaries/QuickNetLarge_512.txt new file mode 100644 index 00000000..fad17a8e --- /dev/null +++ b/tests/snapshots/model_summaries/QuickNetLarge_512.txt @@ -0,0 +1,132 @@ ++quicknet_large stats-----------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++-------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| conv2d - (-1, 112, 112, 8) 0 216 0.84 0 2709504 | +| depthwise_conv2d - (-1, 56, 56, 64) 0 576 2.25 0 1806336 | +| batch_normalization - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| quant_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_1 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_1 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_2 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_1 - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_2 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_3 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_2 - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_3 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_4 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_3 - (-1, 56, 56, 64) 0 0 0 ? ? | +| max_pooling2d - (-1, 28, 28, 64) 0 0 0 0 0 | +| quant_conv2d_4 1 (-1, 28, 28, 128) 73728 0 9.00 57802752 0 | +| conv2d_1 - (-1, 28, 28, 128) 0 8192 32.00 0 6422528 | +| batch_normalization_6 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| batch_normalization_5 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_4 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_5 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_7 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_5 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_6 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_8 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_6 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_7 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_9 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_7 - (-1, 28, 28, 128) 0 0 0 ? ? | +| average_pooling2d - (-1, 1, 1, 128) 0 0 0 0 0 | +| flatten - (-1, 128) 0 0 0 0 0 | +| dense - (-1, 8) 0 1024 4.00 0 1024 | +| quant_conv2d_8 1 (-1, 14, 14, 256) 294912 0 36.00 57802752 0 | +| dense_1 - (-1, 256) 0 2048 8.00 0 2048 | +| max_pooling2d_1 - (-1, 14, 14, 128) 0 0 0 0 0 | +| batch_normalization_11 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape - ((None, 1, 1, 256),) 0 0 0 ? ? | +| conv2d_2 - (-1, 14, 14, 256) 0 32768 128.00 0 6422528 | +| tf_op_layer_mul - ((None, 14, 14, 256),) 0 0 0 ? ? | +| batch_normalization_10 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_8 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_1 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_1 - (-1, 256) 0 0 0 0 0 | +| dense_2 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_9 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_3 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_12 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_1 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_1 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_9 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_2 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_2 - (-1, 256) 0 0 0 0 0 | +| dense_4 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_10 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_5 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_13 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_2 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_2 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_10 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_3 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_3 - (-1, 256) 0 0 0 0 0 | +| dense_6 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_11 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_7 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_14 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_3 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_3 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_11 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_4 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_4 - (-1, 256) 0 0 0 0 0 | +| dense_8 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_12 1 (-1, 7, 7, 512) 1179648 0 144.00 57802752 0 | +| dense_9 - (-1, 512) 0 8192 32.00 0 8192 | +| max_pooling2d_2 - (-1, 7, 7, 256) 0 0 0 0 0 | +| batch_normalization_16 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| tf_op_layer_Reshape_4 - ((None, 1, 1, 512),) 0 0 0 ? ? | +| conv2d_3 - (-1, 7, 7, 512) 0 131072 512.00 0 6422528 | +| tf_op_layer_mul_4 - ((None, 7, 7, 512),) 0 0 0 ? ? | +| batch_normalization_15 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_12 - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_5 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten_5 - (-1, 512) 0 0 0 0 0 | +| dense_10 - (-1, 32) 0 16384 64.00 0 16384 | +| quant_conv2d_13 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| dense_11 - (-1, 512) 0 16384 64.00 0 16384 | +| batch_normalization_17 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| tf_op_layer_Reshape_5 - ((None, 1, 1, 512),) 0 0 0 ? ? | +| tf_op_layer_mul_5 - ((None, 7, 7, 512),) 0 0 0 ? ? | +| add_13 - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_6 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten_6 - (-1, 512) 0 0 0 0 0 | +| dense_12 - (-1, 32) 0 16384 64.00 0 16384 | +| quant_conv2d_14 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| dense_13 - (-1, 512) 0 16384 64.00 0 16384 | +| batch_normalization_18 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| tf_op_layer_Reshape_6 - ((None, 1, 1, 512),) 0 0 0 ? ? | +| tf_op_layer_mul_6 - ((None, 7, 7, 512),) 0 0 0 ? ? | +| add_14 - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_7 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten_7 - (-1, 512) 0 0 0 0 0 | +| dense_14 - (-1, 32) 0 16384 64.00 0 16384 | +| quant_conv2d_15 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| dense_15 - (-1, 512) 0 16384 64.00 0 16384 | +| batch_normalization_19 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| tf_op_layer_Reshape_7 - ((None, 1, 1, 512),) 0 0 0 ? ? | +| tf_op_layer_mul_7 - ((None, 7, 7, 512),) 0 0 0 ? ? | +| add_15 - (-1, 7, 7, 512) 0 0 0 ? ? | +| activation - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_8 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten_8 - (-1, 512) 0 0 0 0 0 | +| dense_16 - (-1, 1000) 0 513000 2003.91 0 512000 | +| activation_1 - (-1, 1000) 0 0 0 ? ? | ++-------------------------------------------------------------------------------------------------------------------+ +| Total 10985472 833664 4597.50 1676279808 24433664 | ++-------------------------------------------------------------------------------------------------------------------+ ++quicknet_large summary-----------------------+ +| Total params 11.8 M | +| Trainable params 11.8 M | +| Non-trainable params 9.6 k | +| Model size 4.49 MiB | +| Model size (8-bit FP weights) 2.10 MiB | +| Float-32 Equivalent 45.09 MiB | +| Compression Ratio of Memory 0.10 | +| Number of MACs 1.7 B | +| Ratio of MACs that are binarized 0.9856 | ++---------------------------------------------+ diff --git a/tests/snapshots/model_summaries/QuickNetXL_512.txt b/tests/snapshots/model_summaries/QuickNetXL_512.txt new file mode 100644 index 00000000..79d58148 --- /dev/null +++ b/tests/snapshots/model_summaries/QuickNetXL_512.txt @@ -0,0 +1,240 @@ ++quicknet_xl stats--------------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++-------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| conv2d - (-1, 112, 112, 8) 0 216 0.84 0 2709504 | +| depthwise_conv2d - (-1, 56, 56, 64) 0 576 2.25 0 1806336 | +| batch_normalization - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| quant_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_1 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_1 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_2 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_1 - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_2 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_3 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_2 - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_3 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_4 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_3 - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_4 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_5 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_4 - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_5 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_6 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_5 - (-1, 56, 56, 64) 0 0 0 ? ? | +| max_pooling2d - (-1, 28, 28, 64) 0 0 0 0 0 | +| quant_conv2d_6 1 (-1, 28, 28, 128) 73728 0 9.00 57802752 0 | +| conv2d_1 - (-1, 28, 28, 128) 0 8192 32.00 0 6422528 | +| batch_normalization_8 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| batch_normalization_7 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_6 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_7 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_9 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_7 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_8 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_10 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_8 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_9 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_11 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_9 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_10 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_12 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_10 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_11 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_13 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_11 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_12 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_14 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_12 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_13 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_15 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_13 - (-1, 28, 28, 128) 0 0 0 ? ? | +| average_pooling2d - (-1, 1, 1, 128) 0 0 0 0 0 | +| flatten - (-1, 128) 0 0 0 0 0 | +| dense - (-1, 8) 0 1024 4.00 0 1024 | +| quant_conv2d_14 1 (-1, 14, 14, 256) 294912 0 36.00 57802752 0 | +| dense_1 - (-1, 256) 0 2048 8.00 0 2048 | +| max_pooling2d_1 - (-1, 14, 14, 128) 0 0 0 0 0 | +| batch_normalization_17 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape - ((None, 1, 1, 256),) 0 0 0 ? ? | +| conv2d_2 - (-1, 14, 14, 256) 0 32768 128.00 0 6422528 | +| tf_op_layer_mul - ((None, 14, 14, 256),) 0 0 0 ? ? | +| batch_normalization_16 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_14 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_1 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_1 - (-1, 256) 0 0 0 0 0 | +| dense_2 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_15 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_3 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_18 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_1 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_1 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_15 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_2 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_2 - (-1, 256) 0 0 0 0 0 | +| dense_4 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_16 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_5 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_19 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_2 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_2 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_16 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_3 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_3 - (-1, 256) 0 0 0 0 0 | +| dense_6 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_17 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_7 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_20 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_3 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_3 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_17 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_4 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_4 - (-1, 256) 0 0 0 0 0 | +| dense_8 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_18 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_9 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_21 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_4 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_4 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_18 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_5 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_5 - (-1, 256) 0 0 0 0 0 | +| dense_10 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_19 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_11 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_22 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_5 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_5 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_19 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_6 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_6 - (-1, 256) 0 0 0 0 0 | +| dense_12 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_20 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_13 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_23 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_6 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_6 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_20 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_7 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_7 - (-1, 256) 0 0 0 0 0 | +| dense_14 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_21 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_15 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_24 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_7 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_7 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_21 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_8 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_8 - (-1, 256) 0 0 0 0 0 | +| dense_16 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_22 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_17 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_25 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_8 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_8 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_22 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_9 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_9 - (-1, 256) 0 0 0 0 0 | +| dense_18 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_23 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_19 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_26 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_9 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_9 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_23 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_10 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_10 - (-1, 256) 0 0 0 0 0 | +| dense_20 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_24 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_21 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_27 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_10 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_10 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_24 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_11 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_11 - (-1, 256) 0 0 0 0 0 | +| dense_22 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_25 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| dense_23 - (-1, 256) 0 4096 16.00 0 4096 | +| batch_normalization_28 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| tf_op_layer_Reshape_11 - ((None, 1, 1, 256),) 0 0 0 ? ? | +| tf_op_layer_mul_11 - ((None, 14, 14, 256),) 0 0 0 ? ? | +| add_25 - (-1, 14, 14, 256) 0 0 0 ? ? | +| average_pooling2d_12 - (-1, 1, 1, 256) 0 0 0 0 0 | +| flatten_12 - (-1, 256) 0 0 0 0 0 | +| dense_24 - (-1, 16) 0 4096 16.00 0 4096 | +| quant_conv2d_26 1 (-1, 7, 7, 512) 1179648 0 144.00 57802752 0 | +| dense_25 - (-1, 512) 0 8192 32.00 0 8192 | +| max_pooling2d_2 - (-1, 7, 7, 256) 0 0 0 0 0 | +| batch_normalization_30 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| tf_op_layer_Reshape_12 - ((None, 1, 1, 512),) 0 0 0 ? ? | +| conv2d_3 - (-1, 7, 7, 512) 0 131072 512.00 0 6422528 | +| tf_op_layer_mul_12 - ((None, 7, 7, 512),) 0 0 0 ? ? | +| batch_normalization_29 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_26 - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_13 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten_13 - (-1, 512) 0 0 0 0 0 | +| dense_26 - (-1, 32) 0 16384 64.00 0 16384 | +| quant_conv2d_27 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| dense_27 - (-1, 512) 0 16384 64.00 0 16384 | +| batch_normalization_31 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| tf_op_layer_Reshape_13 - ((None, 1, 1, 512),) 0 0 0 ? ? | +| tf_op_layer_mul_13 - ((None, 7, 7, 512),) 0 0 0 ? ? | +| add_27 - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_14 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten_14 - (-1, 512) 0 0 0 0 0 | +| dense_28 - (-1, 32) 0 16384 64.00 0 16384 | +| quant_conv2d_28 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| dense_29 - (-1, 512) 0 16384 64.00 0 16384 | +| batch_normalization_32 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| tf_op_layer_Reshape_14 - ((None, 1, 1, 512),) 0 0 0 ? ? | +| tf_op_layer_mul_14 - ((None, 7, 7, 512),) 0 0 0 ? ? | +| add_28 - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_15 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten_15 - (-1, 512) 0 0 0 0 0 | +| dense_30 - (-1, 32) 0 16384 64.00 0 16384 | +| quant_conv2d_29 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| dense_31 - (-1, 512) 0 16384 64.00 0 16384 | +| batch_normalization_33 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| tf_op_layer_Reshape_15 - ((None, 1, 1, 512),) 0 0 0 ? ? | +| tf_op_layer_mul_15 - ((None, 7, 7, 512),) 0 0 0 ? ? | +| add_29 - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_16 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten_16 - (-1, 512) 0 0 0 0 0 | +| dense_32 - (-1, 32) 0 16384 64.00 0 16384 | +| quant_conv2d_30 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| dense_33 - (-1, 512) 0 16384 64.00 0 16384 | +| batch_normalization_34 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| tf_op_layer_Reshape_16 - ((None, 1, 1, 512),) 0 0 0 ? ? | +| tf_op_layer_mul_16 - ((None, 7, 7, 512),) 0 0 0 ? ? | +| add_30 - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_17 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten_17 - (-1, 512) 0 0 0 0 0 | +| dense_34 - (-1, 32) 0 16384 64.00 0 16384 | +| quant_conv2d_31 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| dense_35 - (-1, 512) 0 16384 64.00 0 16384 | +| batch_normalization_35 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| tf_op_layer_Reshape_17 - ((None, 1, 1, 512),) 0 0 0 ? ? | +| tf_op_layer_mul_17 - ((None, 7, 7, 512),) 0 0 0 ? ? | +| add_31 - (-1, 7, 7, 512) 0 0 0 ? ? | +| activation - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d_18 - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten_18 - (-1, 512) 0 0 0 0 0 | +| dense_36 - (-1, 1000) 0 513000 2003.91 0 512000 | +| activation_1 - (-1, 1000) 0 0 0 ? ? | ++-------------------------------------------------------------------------------------------------------------------+ +| Total 21086208 972160 6371.50 3525967872 24564736 | ++-------------------------------------------------------------------------------------------------------------------+ ++quicknet_xl summary--------------------------+ +| Total params 22.1 M | +| Trainable params 22 M | +| Non-trainable params 17 k | +| Model size 6.22 MiB | +| Model size (8-bit FP weights) 3.44 MiB | +| Float-32 Equivalent 84.15 MiB | +| Compression Ratio of Memory 0.07 | +| Number of MACs 3.55 B | +| Ratio of MACs that are binarized 0.9931 | ++---------------------------------------------+ diff --git a/tests/snapshots/model_summaries/QuickNet_512.txt b/tests/snapshots/model_summaries/QuickNet_512.txt new file mode 100644 index 00000000..6972ef60 --- /dev/null +++ b/tests/snapshots/model_summaries/QuickNet_512.txt @@ -0,0 +1,75 @@ ++quicknet stats----------------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| conv2d - (-1, 112, 112, 8) 0 216 0.84 0 2709504 | +| depthwise_conv2d - (-1, 56, 56, 64) 0 576 2.25 0 1806336 | +| batch_normalization - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| quant_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_1 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add - (-1, 56, 56, 64) 0 0 0 ? ? | +| quant_conv2d_1 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| batch_normalization_2 - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| add_1 - (-1, 56, 56, 64) 0 0 0 ? ? | +| max_pooling2d - (-1, 28, 28, 64) 0 0 0 0 0 | +| quant_conv2d_2 1 (-1, 28, 28, 64) 36864 0 4.50 28901376 0 | +| batch_normalization_3 - (-1, 28, 28, 64) 0 128 0.50 0 0 | +| batch_normalization_4 - (-1, 28, 28, 64) 0 128 0.50 0 0 | +| add_2 - (-1, 28, 28, 64) 0 0 0 ? ? | +| concatenate - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_3 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_5 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_3 - (-1, 28, 28, 128) 0 0 0 ? ? | +| quant_conv2d_4 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| batch_normalization_6 - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| add_4 - (-1, 28, 28, 128) 0 0 0 ? ? | +| max_pooling2d_1 - (-1, 14, 14, 128) 0 0 0 0 0 | +| quant_conv2d_5 1 (-1, 14, 14, 128) 147456 0 18.00 28901376 0 | +| batch_normalization_7 - (-1, 14, 14, 128) 0 256 1.00 0 0 | +| batch_normalization_8 - (-1, 14, 14, 128) 0 256 1.00 0 0 | +| add_5 - (-1, 14, 14, 128) 0 0 0 ? ? | +| concatenate_1 - (-1, 14, 14, 256) 0 0 0 ? ? | +| quant_conv2d_6 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| batch_normalization_9 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_6 - (-1, 14, 14, 256) 0 0 0 ? ? | +| quant_conv2d_7 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| batch_normalization_10 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_7 - (-1, 14, 14, 256) 0 0 0 ? ? | +| quant_conv2d_8 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| batch_normalization_11 - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| add_8 - (-1, 14, 14, 256) 0 0 0 ? ? | +| max_pooling2d_2 - (-1, 7, 7, 256) 0 0 0 0 0 | +| quant_conv2d_9 1 (-1, 7, 7, 256) 589824 0 72.00 28901376 0 | +| batch_normalization_12 - (-1, 7, 7, 256) 0 512 2.00 0 0 | +| batch_normalization_13 - (-1, 7, 7, 256) 0 512 2.00 0 0 | +| add_9 - (-1, 7, 7, 256) 0 0 0 ? ? | +| concatenate_2 - (-1, 7, 7, 512) 0 0 0 ? ? | +| quant_conv2d_10 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| batch_normalization_14 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_10 - (-1, 7, 7, 512) 0 0 0 ? ? | +| quant_conv2d_11 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| batch_normalization_15 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_11 - (-1, 7, 7, 512) 0 0 0 ? ? | +| quant_conv2d_12 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| batch_normalization_16 - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| add_12 - (-1, 7, 7, 512) 0 0 0 ? ? | +| activation - (-1, 7, 7, 512) 0 0 0 ? ? | +| average_pooling2d - (-1, 1, 1, 512) 0 0 0 0 0 | +| flatten - (-1, 512) 0 0 0 0 0 | +| dense - (-1, 1000) 0 513000 2003.91 0 512000 | +| activation_1 - (-1, 1000) 0 0 0 ? ? | ++------------------------------------------------------------------------------------------------------------------+ +| Total 9990144 521088 3255.00 1242759168 5027840 | ++------------------------------------------------------------------------------------------------------------------+ ++quicknet summary-----------------------------+ +| Total params 10.5 M | +| Trainable params 10.5 M | +| Non-trainable params 7.3 k | +| Model size 3.18 MiB | +| Model size (8-bit FP weights) 1.69 MiB | +| Float-32 Equivalent 40.10 MiB | +| Compression Ratio of Memory 0.08 | +| Number of MACs 1.25 B | +| Ratio of MACs that are binarized 0.9960 | ++---------------------------------------------+ diff --git a/tests/snapshots/model_summaries/RealToBinaryNet_512.txt b/tests/snapshots/model_summaries/RealToBinaryNet_512.txt new file mode 100644 index 00000000..6116db0c --- /dev/null +++ b/tests/snapshots/model_summaries/RealToBinaryNet_512.txt @@ -0,0 +1,204 @@ ++r2b_bnn stats-----------------------------------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++------------------------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| r2b_bnn_block_1_conv2d - (-1, 112, 112, 64) 0 9408 36.75 0 118013952 | +| r2b_bnn_block_1_batch_norm - (-1, 112, 112, 64) 0 128 0.50 0 0 | +| r2b_bnn_block_1_prelu - (-1, 112, 112, 64) 0 64 0.25 ? ? | +| r2b_bnn_block_1_pool - (-1, 56, 56, 64) 0 0 0 0 0 | +| r2b_bnn_block_2a_batch_norm - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| r2b_bnn_block_2a_scaling_pool_pool - (-1, 1, 1, 64) 0 0 0 0 0 | +| r2b_bnn_block_2a_scaling_pool_flatten - (-1, 64) 0 0 0 0 0 | +| r2b_bnn_block_2a_scaling_dense_reduce - (-1, 8) 0 512 2.00 0 512 | +| r2b_bnn_block_2a_scaling_dense_expand - (-1, 64) 0 512 2.00 0 512 | +| r2b_bnn_block_2a_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| r2b_bnn_block_2a_scaling_reshape - (-1, 1, 1, 64) 0 0 0 ? ? | +| r2b_bnn_block_2a_scaling_multiplication - (-1, 56, 56, 64) 0 0 0 ? ? | +| r2b_bnn_block_2a_prelu - (-1, 56, 56, 64) 0 64 0.25 ? ? | +| r2b_bnn_block_2a_skip_add - (-1, 56, 56, 64) 0 0 0 ? ? | +| r2b_bnn_block_2b_batch_norm - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| r2b_bnn_block_2b_scaling_pool_pool - (-1, 1, 1, 64) 0 0 0 0 0 | +| r2b_bnn_block_2b_scaling_pool_flatten - (-1, 64) 0 0 0 0 0 | +| r2b_bnn_block_2b_scaling_dense_reduce - (-1, 8) 0 512 2.00 0 512 | +| r2b_bnn_block_2b_scaling_dense_expand - (-1, 64) 0 512 2.00 0 512 | +| r2b_bnn_block_2b_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| r2b_bnn_block_2b_scaling_reshape - (-1, 1, 1, 64) 0 0 0 ? ? | +| r2b_bnn_block_2b_scaling_multiplication - (-1, 56, 56, 64) 0 0 0 ? ? | +| r2b_bnn_block_2b_prelu - (-1, 56, 56, 64) 0 64 0.25 ? ? | +| r2b_bnn_block_2b_skip_add - (-1, 56, 56, 64) 0 0 0 ? ? | +| r2b_bnn_block_2_out - (-1, 56, 56, 64) 0 0 0 ? ? | +| r2b_bnn_block_3a_batch_norm - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| r2b_bnn_block_3a_scaling_pool_pool - (-1, 1, 1, 64) 0 0 0 0 0 | +| r2b_bnn_block_3a_scaling_pool_flatten - (-1, 64) 0 0 0 0 0 | +| r2b_bnn_block_3a_scaling_dense_reduce - (-1, 8) 0 512 2.00 0 512 | +| r2b_bnn_block_3a_scaling_dense_expand - (-1, 64) 0 512 2.00 0 512 | +| r2b_bnn_block_3a_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| r2b_bnn_block_3a_scaling_reshape - (-1, 1, 1, 64) 0 0 0 ? ? | +| r2b_bnn_block_3a_scaling_multiplication - (-1, 56, 56, 64) 0 0 0 ? ? | +| r2b_bnn_block_3a_prelu - (-1, 56, 56, 64) 0 64 0.25 ? ? | +| r2b_bnn_block_3a_skip_add - (-1, 56, 56, 64) 0 0 0 ? ? | +| r2b_bnn_block_3b_batch_norm - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| r2b_bnn_block_3b_scaling_pool_pool - (-1, 1, 1, 64) 0 0 0 0 0 | +| r2b_bnn_block_3b_scaling_pool_flatten - (-1, 64) 0 0 0 0 0 | +| r2b_bnn_block_3b_scaling_dense_reduce - (-1, 8) 0 512 2.00 0 512 | +| r2b_bnn_block_3b_scaling_dense_expand - (-1, 64) 0 512 2.00 0 512 | +| r2b_bnn_block_3b_conv2d 1 (-1, 56, 56, 64) 36864 0 4.50 115605504 0 | +| r2b_bnn_block_3b_scaling_reshape - (-1, 1, 1, 64) 0 0 0 ? ? | +| r2b_bnn_block_3b_scaling_multiplication - (-1, 56, 56, 64) 0 0 0 ? ? | +| r2b_bnn_block_3b_prelu - (-1, 56, 56, 64) 0 64 0.25 ? ? | +| r2b_bnn_block_3b_skip_add - (-1, 56, 56, 64) 0 0 0 ? ? | +| r2b_bnn_block_3_out - (-1, 56, 56, 64) 0 0 0 ? ? | +| r2b_bnn_block_4a_batch_norm - (-1, 56, 56, 64) 0 128 0.50 0 0 | +| r2b_bnn_block_4a_scaling_pool_pool - (-1, 1, 1, 64) 0 0 0 0 0 | +| r2b_bnn_block_4a_scaling_pool_flatten - (-1, 64) 0 0 0 0 0 | +| r2b_bnn_block_4a_scaling_dense_reduce - (-1, 8) 0 512 2.00 0 512 | +| r2b_bnn_block_4a_scaling_dense_expand - (-1, 128) 0 1024 4.00 0 1024 | +| r2b_bnn_block_4a_conv2d 1 (-1, 28, 28, 128) 73728 0 9.00 57802752 0 | +| r2b_bnn_block_4a_scaling_reshape - (-1, 1, 1, 128) 0 0 0 ? ? | +| r2b_bnn_block_4a_shortcut_pool - (-1, 28, 28, 64) 0 0 0 0 0 | +| r2b_bnn_block_4a_scaling_multiplication - (-1, 28, 28, 128) 0 0 0 ? ? | +| r2b_bnn_block_4a_shortcut_conv2d - (-1, 28, 28, 128) 0 8192 32.00 0 6422528 | +| r2b_bnn_block_4a_prelu - (-1, 28, 28, 128) 0 128 0.50 ? ? | +| r2b_bnn_block_4a_shortcut_batch_norm - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| r2b_bnn_block_4a_skip_add - (-1, 28, 28, 128) 0 0 0 ? ? | +| r2b_bnn_block_4b_batch_norm - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| r2b_bnn_block_4b_scaling_pool_pool - (-1, 1, 1, 128) 0 0 0 0 0 | +| r2b_bnn_block_4b_scaling_pool_flatten - (-1, 128) 0 0 0 0 0 | +| r2b_bnn_block_4b_scaling_dense_reduce - (-1, 16) 0 2048 8.00 0 2048 | +| r2b_bnn_block_4b_scaling_dense_expand - (-1, 128) 0 2048 8.00 0 2048 | +| r2b_bnn_block_4b_conv2d 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| r2b_bnn_block_4b_scaling_reshape - (-1, 1, 1, 128) 0 0 0 ? ? | +| r2b_bnn_block_4b_scaling_multiplication - (-1, 28, 28, 128) 0 0 0 ? ? | +| r2b_bnn_block_4b_prelu - (-1, 28, 28, 128) 0 128 0.50 ? ? | +| r2b_bnn_block_4b_skip_add - (-1, 28, 28, 128) 0 0 0 ? ? | +| r2b_bnn_block_4_out - (-1, 28, 28, 128) 0 0 0 ? ? | +| r2b_bnn_block_5a_batch_norm - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| r2b_bnn_block_5a_scaling_pool_pool - (-1, 1, 1, 128) 0 0 0 0 0 | +| r2b_bnn_block_5a_scaling_pool_flatten - (-1, 128) 0 0 0 0 0 | +| r2b_bnn_block_5a_scaling_dense_reduce - (-1, 16) 0 2048 8.00 0 2048 | +| r2b_bnn_block_5a_scaling_dense_expand - (-1, 128) 0 2048 8.00 0 2048 | +| r2b_bnn_block_5a_conv2d 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| r2b_bnn_block_5a_scaling_reshape - (-1, 1, 1, 128) 0 0 0 ? ? | +| r2b_bnn_block_5a_scaling_multiplication - (-1, 28, 28, 128) 0 0 0 ? ? | +| r2b_bnn_block_5a_prelu - (-1, 28, 28, 128) 0 128 0.50 ? ? | +| r2b_bnn_block_5a_skip_add - (-1, 28, 28, 128) 0 0 0 ? ? | +| r2b_bnn_block_5b_batch_norm - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| r2b_bnn_block_5b_scaling_pool_pool - (-1, 1, 1, 128) 0 0 0 0 0 | +| r2b_bnn_block_5b_scaling_pool_flatten - (-1, 128) 0 0 0 0 0 | +| r2b_bnn_block_5b_scaling_dense_reduce - (-1, 16) 0 2048 8.00 0 2048 | +| r2b_bnn_block_5b_scaling_dense_expand - (-1, 128) 0 2048 8.00 0 2048 | +| r2b_bnn_block_5b_conv2d 1 (-1, 28, 28, 128) 147456 0 18.00 115605504 0 | +| r2b_bnn_block_5b_scaling_reshape - (-1, 1, 1, 128) 0 0 0 ? ? | +| r2b_bnn_block_5b_scaling_multiplication - (-1, 28, 28, 128) 0 0 0 ? ? | +| r2b_bnn_block_5b_prelu - (-1, 28, 28, 128) 0 128 0.50 ? ? | +| r2b_bnn_block_5b_skip_add - (-1, 28, 28, 128) 0 0 0 ? ? | +| r2b_bnn_block_5_out - (-1, 28, 28, 128) 0 0 0 ? ? | +| r2b_bnn_block_6a_batch_norm - (-1, 28, 28, 128) 0 256 1.00 0 0 | +| r2b_bnn_block_6a_scaling_pool_pool - (-1, 1, 1, 128) 0 0 0 0 0 | +| r2b_bnn_block_6a_scaling_pool_flatten - (-1, 128) 0 0 0 0 0 | +| r2b_bnn_block_6a_scaling_dense_reduce - (-1, 16) 0 2048 8.00 0 2048 | +| r2b_bnn_block_6a_scaling_dense_expand - (-1, 256) 0 4096 16.00 0 4096 | +| r2b_bnn_block_6a_conv2d 1 (-1, 14, 14, 256) 294912 0 36.00 57802752 0 | +| r2b_bnn_block_6a_scaling_reshape - (-1, 1, 1, 256) 0 0 0 ? ? | +| r2b_bnn_block_6a_shortcut_pool - (-1, 14, 14, 128) 0 0 0 0 0 | +| r2b_bnn_block_6a_scaling_multiplication - (-1, 14, 14, 256) 0 0 0 ? ? | +| r2b_bnn_block_6a_shortcut_conv2d - (-1, 14, 14, 256) 0 32768 128.00 0 6422528 | +| r2b_bnn_block_6a_prelu - (-1, 14, 14, 256) 0 256 1.00 ? ? | +| r2b_bnn_block_6a_shortcut_batch_norm - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| r2b_bnn_block_6a_skip_add - (-1, 14, 14, 256) 0 0 0 ? ? | +| r2b_bnn_block_6b_batch_norm - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| r2b_bnn_block_6b_scaling_pool_pool - (-1, 1, 1, 256) 0 0 0 0 0 | +| r2b_bnn_block_6b_scaling_pool_flatten - (-1, 256) 0 0 0 0 0 | +| r2b_bnn_block_6b_scaling_dense_reduce - (-1, 32) 0 8192 32.00 0 8192 | +| r2b_bnn_block_6b_scaling_dense_expand - (-1, 256) 0 8192 32.00 0 8192 | +| r2b_bnn_block_6b_conv2d 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| r2b_bnn_block_6b_scaling_reshape - (-1, 1, 1, 256) 0 0 0 ? ? | +| r2b_bnn_block_6b_scaling_multiplication - (-1, 14, 14, 256) 0 0 0 ? ? | +| r2b_bnn_block_6b_prelu - (-1, 14, 14, 256) 0 256 1.00 ? ? | +| r2b_bnn_block_6b_skip_add - (-1, 14, 14, 256) 0 0 0 ? ? | +| r2b_bnn_block_6_out - (-1, 14, 14, 256) 0 0 0 ? ? | +| r2b_bnn_block_7a_batch_norm - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| r2b_bnn_block_7a_scaling_pool_pool - (-1, 1, 1, 256) 0 0 0 0 0 | +| r2b_bnn_block_7a_scaling_pool_flatten - (-1, 256) 0 0 0 0 0 | +| r2b_bnn_block_7a_scaling_dense_reduce - (-1, 32) 0 8192 32.00 0 8192 | +| r2b_bnn_block_7a_scaling_dense_expand - (-1, 256) 0 8192 32.00 0 8192 | +| r2b_bnn_block_7a_conv2d 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| r2b_bnn_block_7a_scaling_reshape - (-1, 1, 1, 256) 0 0 0 ? ? | +| r2b_bnn_block_7a_scaling_multiplication - (-1, 14, 14, 256) 0 0 0 ? ? | +| r2b_bnn_block_7a_prelu - (-1, 14, 14, 256) 0 256 1.00 ? ? | +| r2b_bnn_block_7a_skip_add - (-1, 14, 14, 256) 0 0 0 ? ? | +| r2b_bnn_block_7b_batch_norm - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| r2b_bnn_block_7b_scaling_pool_pool - (-1, 1, 1, 256) 0 0 0 0 0 | +| r2b_bnn_block_7b_scaling_pool_flatten - (-1, 256) 0 0 0 0 0 | +| r2b_bnn_block_7b_scaling_dense_reduce - (-1, 32) 0 8192 32.00 0 8192 | +| r2b_bnn_block_7b_scaling_dense_expand - (-1, 256) 0 8192 32.00 0 8192 | +| r2b_bnn_block_7b_conv2d 1 (-1, 14, 14, 256) 589824 0 72.00 115605504 0 | +| r2b_bnn_block_7b_scaling_reshape - (-1, 1, 1, 256) 0 0 0 ? ? | +| r2b_bnn_block_7b_scaling_multiplication - (-1, 14, 14, 256) 0 0 0 ? ? | +| r2b_bnn_block_7b_prelu - (-1, 14, 14, 256) 0 256 1.00 ? ? | +| r2b_bnn_block_7b_skip_add - (-1, 14, 14, 256) 0 0 0 ? ? | +| r2b_bnn_block_7_out - (-1, 14, 14, 256) 0 0 0 ? ? | +| r2b_bnn_block_8a_batch_norm - (-1, 14, 14, 256) 0 512 2.00 0 0 | +| r2b_bnn_block_8a_scaling_pool_pool - (-1, 1, 1, 256) 0 0 0 0 0 | +| r2b_bnn_block_8a_scaling_pool_flatten - (-1, 256) 0 0 0 0 0 | +| r2b_bnn_block_8a_scaling_dense_reduce - (-1, 32) 0 8192 32.00 0 8192 | +| r2b_bnn_block_8a_scaling_dense_expand - (-1, 512) 0 16384 64.00 0 16384 | +| r2b_bnn_block_8a_conv2d 1 (-1, 7, 7, 512) 1179648 0 144.00 57802752 0 | +| r2b_bnn_block_8a_scaling_reshape - (-1, 1, 1, 512) 0 0 0 ? ? | +| r2b_bnn_block_8a_shortcut_pool - (-1, 7, 7, 256) 0 0 0 0 0 | +| r2b_bnn_block_8a_scaling_multiplication - (-1, 7, 7, 512) 0 0 0 ? ? | +| r2b_bnn_block_8a_shortcut_conv2d - (-1, 7, 7, 512) 0 131072 512.00 0 6422528 | +| r2b_bnn_block_8a_prelu - (-1, 7, 7, 512) 0 512 2.00 ? ? | +| r2b_bnn_block_8a_shortcut_batch_norm - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| r2b_bnn_block_8a_skip_add - (-1, 7, 7, 512) 0 0 0 ? ? | +| r2b_bnn_block_8b_batch_norm - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| r2b_bnn_block_8b_scaling_pool_pool - (-1, 1, 1, 512) 0 0 0 0 0 | +| r2b_bnn_block_8b_scaling_pool_flatten - (-1, 512) 0 0 0 0 0 | +| r2b_bnn_block_8b_scaling_dense_reduce - (-1, 64) 0 32768 128.00 0 32768 | +| r2b_bnn_block_8b_scaling_dense_expand - (-1, 512) 0 32768 128.00 0 32768 | +| r2b_bnn_block_8b_conv2d 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| r2b_bnn_block_8b_scaling_reshape - (-1, 1, 1, 512) 0 0 0 ? ? | +| r2b_bnn_block_8b_scaling_multiplication - (-1, 7, 7, 512) 0 0 0 ? ? | +| r2b_bnn_block_8b_prelu - (-1, 7, 7, 512) 0 512 2.00 ? ? | +| r2b_bnn_block_8b_skip_add - (-1, 7, 7, 512) 0 0 0 ? ? | +| r2b_bnn_block_8_out - (-1, 7, 7, 512) 0 0 0 ? ? | +| r2b_bnn_block_9a_batch_norm - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| r2b_bnn_block_9a_scaling_pool_pool - (-1, 1, 1, 512) 0 0 0 0 0 | +| r2b_bnn_block_9a_scaling_pool_flatten - (-1, 512) 0 0 0 0 0 | +| r2b_bnn_block_9a_scaling_dense_reduce - (-1, 64) 0 32768 128.00 0 32768 | +| r2b_bnn_block_9a_scaling_dense_expand - (-1, 512) 0 32768 128.00 0 32768 | +| r2b_bnn_block_9a_conv2d 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| r2b_bnn_block_9a_scaling_reshape - (-1, 1, 1, 512) 0 0 0 ? ? | +| r2b_bnn_block_9a_scaling_multiplication - (-1, 7, 7, 512) 0 0 0 ? ? | +| r2b_bnn_block_9a_prelu - (-1, 7, 7, 512) 0 512 2.00 ? ? | +| r2b_bnn_block_9a_skip_add - (-1, 7, 7, 512) 0 0 0 ? ? | +| r2b_bnn_block_9b_batch_norm - (-1, 7, 7, 512) 0 1024 4.00 0 0 | +| r2b_bnn_block_9b_scaling_pool_pool - (-1, 1, 1, 512) 0 0 0 0 0 | +| r2b_bnn_block_9b_scaling_pool_flatten - (-1, 512) 0 0 0 0 0 | +| r2b_bnn_block_9b_scaling_dense_reduce - (-1, 64) 0 32768 128.00 0 32768 | +| r2b_bnn_block_9b_scaling_dense_expand - (-1, 512) 0 32768 128.00 0 32768 | +| r2b_bnn_block_9b_conv2d 1 (-1, 7, 7, 512) 2359296 0 288.00 115605504 0 | +| r2b_bnn_block_9b_scaling_reshape - (-1, 1, 1, 512) 0 0 0 ? ? | +| r2b_bnn_block_9b_scaling_multiplication - (-1, 7, 7, 512) 0 0 0 ? ? | +| r2b_bnn_block_9b_prelu - (-1, 7, 7, 512) 0 512 2.00 ? ? | +| r2b_bnn_block_9b_skip_add - (-1, 7, 7, 512) 0 0 0 ? ? | +| r2b_bnn_block_9_out - (-1, 7, 7, 512) 0 0 0 ? ? | +| r2b_bnn_block_10_global_pool_pool - (-1, 1, 1, 512) 0 0 0 0 0 | +| r2b_bnn_block_10_global_pool_flatten - (-1, 512) 0 0 0 0 0 | +| r2b_bnn_block_10_logits - (-1, 1000) 0 513000 2003.91 0 512000 | +| r2b_bnn_block_10_probs - (-1, 1000) 0 0 0 ? ? | ++------------------------------------------------------------------------------------------------------------------------------------+ +| Total 10985472 1001448 5252.91 1676279808 138087936 | ++------------------------------------------------------------------------------------------------------------------------------------+ ++r2b_bnn summary------------------------------+ +| Total params 12 M | +| Trainable params 12 M | +| Non-trainable params 8.7 k | +| Model size 5.13 MiB | +| Model size (8-bit FP weights) 2.26 MiB | +| Float-32 Equivalent 45.73 MiB | +| Compression Ratio of Memory 0.11 | +| Number of MACs 1.81 B | +| Ratio of MACs that are binarized 0.9239 | ++---------------------------------------------+ diff --git a/tests/snapshots/model_summaries/XNORNet_4096.txt b/tests/snapshots/model_summaries/XNORNet_4096.txt new file mode 100644 index 00000000..58390c8f --- /dev/null +++ b/tests/snapshots/model_summaries/XNORNet_4096.txt @@ -0,0 +1,42 @@ ++xnornet stats------------------------------------------------------------------------------------------------------+ +| Layer Input prec. Outputs # 1-bit # 32-bit Memory 1-bit MACs 32-bit MACs | +| (bit) x 1 x 1 (kB) | ++-------------------------------------------------------------------------------------------------------------------+ +| input_1 - ((None, 224, 224, 3),) 0 0 0 ? ? | +| conv2d - (-1, 56, 56, 96) 0 34848 136.12 0 109283328 | +| batch_normalization - (-1, 56, 56, 96) 0 192 0.75 0 0 | +| activation - (-1, 56, 56, 96) 0 0 0 ? ? | +| max_pooling2d - (-1, 27, 27, 96) 0 0 0 0 0 | +| batch_normalization_1 - (-1, 27, 27, 96) 0 192 0.75 0 0 | +| quant_conv2d 1 (-1, 27, 27, 256) 614400 0 75.00 447897600 0 | +| max_pooling2d_1 - (-1, 13, 13, 256) 0 0 0 0 0 | +| batch_normalization_2 - (-1, 13, 13, 256) 0 512 2.00 0 0 | +| quant_conv2d_1 1 (-1, 13, 13, 384) 884736 0 108.00 149520384 0 | +| batch_normalization_3 - (-1, 13, 13, 384) 0 768 3.00 0 0 | +| quant_conv2d_2 1 (-1, 13, 13, 384) 1327104 0 162.00 224280576 0 | +| batch_normalization_4 - (-1, 13, 13, 384) 0 768 3.00 0 0 | +| quant_conv2d_3 1 (-1, 13, 13, 256) 884736 0 108.00 149520384 0 | +| max_pooling2d_2 - (-1, 6, 6, 256) 0 0 0 0 0 | +| batch_normalization_5 - (-1, 6, 6, 256) 0 512 2.00 0 0 | +| quant_conv2d_4 1 (-1, 1, 1, 4096) 37748736 0 4608.00 37748736 0 | +| batch_normalization_6 - (-1, 1, 1, 4096) 0 8192 32.00 0 0 | +| quant_conv2d_5 1 (-1, 1, 1, 4096) 16777216 0 2048.00 16777216 0 | +| batch_normalization_7 - (-1, 1, 1, 4096) 0 8192 32.00 0 0 | +| activation_1 - (-1, 1, 1, 4096) 0 0 0 ? ? | +| flatten - (-1, 4096) 0 0 0 0 0 | +| dense - (-1, 1000) 0 4096000 16000.00 0 4096000 | +| activation_2 - (-1, 1000) 0 0 0 ? ? | ++-------------------------------------------------------------------------------------------------------------------+ +| Total 58236928 4150176 23320.62 1025744896 113379328 | ++-------------------------------------------------------------------------------------------------------------------+ ++xnornet summary-------------------------------+ +| Total params 62.4 M | +| Trainable params 62.4 M | +| Non-trainable params 19.3 k | +| Model size 22.77 MiB | +| Model size (8-bit FP weights) 10.90 MiB | +| Float-32 Equivalent 237.99 MiB | +| Compression Ratio of Memory 0.10 | +| Number of MACs 1.14 B | +| Ratio of MACs that are binarized 0.9005 | ++----------------------------------------------+