Skip to content

Haosam/Binary-Neural-Network-Keras

Repository files navigation

Binary-Neural-Network-Keras

A Keras code on Binary Neural Networks

Files to run in this order
Step 1: Run BNN_full_binary_io.py
This will give you your training for a Fully Connected 784-512-512-10 MLP layer. Binarization fo final weights is done at the end of training. Please edit the code for the binarization of your layers, if you added more layers
Step 1.1: Run Mnist_cnn.py
This will run the CNN model. BatchNorm and dropout has been commented out

Updated:

Step 2: Go into models folder. Run weight_extract_cnn.py (Run this if you ran mnist_cnn.py)
This will give you your binarized weights and conv layers on your final trained mode constrained to -1 and +1
Please edit the code for the binarization of your layers.

Step 3: (Results_validate folder) Either run BNN_new_train.py for evaluation of your saved weights loaded into a new model
OR
BNN_train_fun.py to test the trained results on real-time to see whether the model is able to predict your results

Note: Please Edit your PATH files

Miscellanous files (Do not Remove):

  • activations.py
  • binary_layers.py

(Results_validate Folder)

  • bnn_ip_binary.py (This is for fun to visualize the actual binarization of the input images)

This code is not maintained as it is for a school project

5/12/2022 : Latest Update - Will consider Scikit-Learn implementation for certain aspects of the code for refresher of Machine Learning Methodologies

About

A Keras code on Binary Neural Networks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages