Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update weight and parameter counts in documentation #85

Merged
merged 11 commits into from
Apr 22, 2020

Conversation

leonoverweel
Copy link
Contributor

How I got these numbers:

from larq.models import summary
from larq_zoo.literature import BinaryDenseNet37Dilated, BinaryDenseNet37, BinaryDenseNet28, BinaryResNetE18, BiRealNet, DoReFaNet, XNORNet, BinaryAlexNet
from larq_zoo.sota import QuickNet, QuickNetLarge, QuickNetXL

summary(BinaryDenseNet37Dilated(weights=None))  # for all models

See each commit for the corresponding model's summary. QuickNetXL already had the correct numbers.

Closes #71.

+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    |
+---------------------------------------------+
+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    |
+---------------------------------------------+
+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    |
+---------------------------------------------+
+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    |
+---------------------------------------------+
+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    |
+---------------------------------------------+
+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    |
+---------------------------------------------+
+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     |
+-----------------------------------------------+
+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     |
+----------------------------------------------+
+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     |
+----------------------------------------------+
+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    |
+---------------------------------------------+
+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    |
+---------------------------------------------+
@leonoverweel leonoverweel added the documentation Improvements or additions to documentation label Apr 22, 2020
@leonoverweel leonoverweel requested a review from a team April 22, 2020 11:32
Copy link
Member

@lgeiger lgeiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable since we now properly account for the batchnorms. I think we also need to update the docstrings in zoo as well.

docs/zoo/index.md Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mismatch between zoo model stats and model summary
2 participants