Package: model-profiler
Tensorflow/ Keras Model ProfilerGives you some basic but important information about yourtforkerasmodel like,Model ParametersModel memory requirement on GPUMemory required to store parametersmodel weights.GPU availability and GPU IDs if availableVersion 1.1.8 fixes problems with custom sequential models and includes other minor improvements.Dependenciespython >= 3.6
numpy 
tabulate
tensorflow >= 2.0.0
keras >= 2.2.4Built and tested ontensorflow >= 2.3.1Installationusing pip.pip install model_profilerUsageFirs load any model built using keras or tensorflow. Here for simplicity we will load model from kera applications.fromtensorflow.keras.applicationsimportEfficientNetB3model=EfficientNetB3(include_top=True)Now after installingmodel_profilerrunfrommodel_profilerimportmodel_profilerBatch_size=128profile=model_profiler(model,Batch_size)print(profile)Batch_sizehave effect onmodelmemory usage so GPU memory usage needbatch_size, it's default value if1.Output| Model Profile                    | Value         | Unit    |
|----------------------------------|---------------|---------|
| Selected GPUs                    | ['0', '1']    | GPU IDs |
| No. of FLOPs                     | 1.5651        | BFLOPs  |
| GPU Memory Requirement           | 41.7385       | GB      |
| Model Parameters                 | 12.3205       | Million |
| Memory Required by Model Weights | 46.9991       | MB      |Using Custom Modelsyou can also built your own models on top ofkeras.applicationa simple example is given below. The usage is almost same the only difference is that for better calculation ofFLOPs, it's better to
sepcify theinput_shapeargument. Simple example below.fromtensorflow.keras.applicationsimportEfficientNetB3fromtensorflow.keras.modelsimportSequentialfromtensorflow.keras.layersimportDense,Dropoutfromprofilerimportmodel_profilercustom_model=Sequential()custom_model.add(EfficientNetB3(weights='imagenet',include_top=False,input_shape=(296,256,3),pooling='avg'))# build you custom layers on topcustom_model.add(Dropout(0.50))custom_model.add(Dense(1000,activation='softmax'))profile=model_profiler(custom_model,Batch_size)Output| Model Profile                    | Value         | Unit    |
|----------------------------------|---------------|---------|
| Selected GPUs                    | None Detected | GPU IDs |
| No. of FLOPs                     | 1.2868        | BFLOPs  |
| GPU Memory Requirement           | 34.8656       | GB      |
| Model Parameters                 | 10.7989       | Million |
| Memory Required by Model Weights | 41.1945       | MB      |UnitsDefault units for the prfiler are# in order 
use_units = ['GPU IDs', 'BFLOPs', 'GB', 'Million', 'MB']You can change units by changing the list entry in appropriate location. For example if you want to getmodelFLOPs in million just change the list as follows.# keep order 
use_units = ['GPU IDs', 'MFLOPs', 'GB', 'Million', 'MB']Availabel units are'GB':memory unit gega-byte
    'MB': memory unit mega-byte
    'MFLOPs':  FLOPs unit million-flops
    'BFLOPs':  FLOPs unit billion-flops
    'Million': paprmeter count unit millions
    'Billion': paprmeter count unit billionsMore ExamplesFor further details and more examples visit mygithub