Package: dnnviewer
Deep Neural Network viewerAdashboard to inspect deep neural network models, providing interactive view on the layer and unit weights and gradients, as well as activation maps.Current version is targeted at theimage classification. However, coming version will target more diverse tasks.This project is for learning and teaching purpose, do not try to display a network with hundreds of layers.InstallInstall with PIP$pipinstalldnnviewerRundnnviewerwith one of the examples below, or with you own model (see below for capabilities and limitations)Access the web application athttp://127.0.0.1:8050Running the programCurrently accepted input formats are Keras Sequential models written to file in Checkpoint format or HDF5. A series of checkpoints along training epochs is also accepted as exemplified below.Some test models are provided in the GIT repository_dnnviewer-data_to clone from Github or download a zip from therepository page, a full description of the models and their design is available in the repositoryreadme.$gitclonehttps://github.com/tonio73/dnnviewer-data.gitTest data is provided by Keras.Selecting the model within the application`Launch the application with command line--model-directoriesthat set a comma separated list of directory paths where the models are located$dnnviewer--model-directoriesdnnviewer-data/models,dnnviewer-data/models/FashionMNIST_checkpointsThen select the network model and the corresponding test data (optional) on the user interfaceModels containing the '{epoch}' tag are sequences over epochs. They are detected based on the pattern set by
command line option--sequence-patternwhose default is{model}_{epoch}Loading a single modelKeras models are loaded fromTensorflow CheckpointorHDF5format with option--model-keras <file>CIFAR-10 Convolutional neural network (at the beginning of training)$dnnviewer--model-kerasdnnviewer-data/models/CIFAR-10_CNN5-Reg.tf--test-datasetcifar-10MNIST Convolutional neural network based on LeNet5$dnnviewer--model-kerasdnnviewer-data/models/MNIST_LeNet60.h5--test-datasetmnistLoading several epochs of a modelSeries of models along training epochs are loaded using the argument--sequence-keras <path>and the pattern{model}_{epoch}within the provided path. See below on how to generate these checkpoints.Fashion MNIST convolutionnal network$dnnviewer--sequence-keras"dnnviewer-data/models/FashionMNIST_checkpoints/model1_{epoch}"--test-datasetfashion-mnistGenerating the modelsFrom Tensorflow 2.0 KerasNote: Only Sequential models are currently supported.Save a single modelUse thesave()method ofkeras.models.Modelclass the output file format is either Tensorflow Checkpoint or HDF5 based on the extension.model1.save('models/MNIST_LeNet60.h5')Save models during trainingThe Keras standard callbacktensorflow.keras.callbacks.ModelCheckpointis saving the model every epoch or a defined period of epochs:fromtensorflowimportkerasfromtensorflow.keras.callbacksimportModelCheckpointmodel1=keras.models.Sequential()#...callbacks=[ModelCheckpoint(filepath='checkpoints_cnn-mnistfashion/model1_{epoch}',save_best_only=False,verbose=1)]hist1=model1.fit(train_images,train_labels,epochs=nEpochs,validation_split=0.2,batch_size=batch_size,verbose=0,callbacks=callbacks)Current capabilitiesLoadTensorflow Keras Sequentialmodels and create a display of the networkTargeted at image classification task (assume image as input, class as output)Display series of models over training epochsInteractive display and unit weights through connections within the network and histogramsSupported layersDenseConvolution 2DFlattenInputFollowing layers are added as attributes to the previous or next layerDropout, ActivityRegularization, SpatialDropout1D/2D/3DAll pooling layersBatchNormalizationActivationUnsupported layersConvolution 1D and 3DTranspose convolution 2D and 3DReshape, Permute, RepeatVector, Lambda, MaskingRecurrent layers (LSTM, GRU...)Embedding layersMerge layersDeveloper documentationSeedeveloper.md