Skip to content

mizutanilab/biomimetic-nn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

185 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bio-mimetic layers

We have been studying brain tissues of humans, mice, and fruit flies. We implemented the obtained results into artificial neural networks to design architectures that outperform standard AIs.

Mouse-mimetic layer excels at cat and cheese

Mouse-mimetic layer was designed by incorporating structural characteristics of murine neurons into the artificial neural network layer. We used this mouse-mimetic layer to generate photos and found that the mouse-mimetic AIs excel at cat faces and cheese while using only 35% of weights. Python scripts of our study which run on Keras 3.3 along with an implementation example in the Jupyter Notebook format are available from the mouse folder. A PyTorch version and its Jupyter Notebook examples are also provided in the mouse_pytorch folder. The followings are fake photos which showed improvements by using the mouse-mimetic DDIM:

cat_faces

How to implement the mouse-mimetic layer in your network

Our code was originally developed using Tensorflow 2.16 / Keras 3.3 and tested on TF 2.18 / Keras 3.10 and 3.11. A PyTorch version is also available. Their usage is the same with the standard layers, except for specifying the %usage of weights and its reduction method. The reduction method for the mouse layer is 2d and its recommended window width is 0.4-0.6, which corresponds to the parameter %usage of 35-60%.

  1. Download mouselayers.py or mouselayers_pytorch2_7.py file to your working directory where your *.py file is placed.
  2. The following is a Keras example code using a mConv2D layer in place of the Conv2D layer. Please find PyTorch examples in the mouse_pytorch folder.
import keras
from keras import layers
import mouselayers as mouse

model = keras.Sequential([
  layers.Dense(4 * 4 * 1024, activation='relu'),
  layers.Reshape((4, 4, 1024)),
  # layers.Conv2D(512, kernel_size=5, strides=2, padding='same'),
  mouse.mConv2D(512, form='2d', input2d_width=32, output2d_width=32, window2d_width=0.5, kernel_size=5, strides=2, padding='same'),
  layers.Activation('relu'),
  layers.Dense(num_class, activation='sigmoid')
])

In this example, the layers.Conv2D layer was commented out to replace it with a mouse.mConv2D layer of about 50% weight usage, which is defined with argument window2d_width. The %usage best fit to your application depends on a variety of factors, but in most cases 30-50% seems to yield good results. We recommend window2d_width=0.5 as a first choice. The arguments input2d_width and output2d_width should be close to the square root of channel dimensions of input and output layers, respectively. No other modification of your python code is required.

The original schizophrenia-mimicking layer

The original schizophrenia-mimicking layer is based on our study on nanometer-scale 3D structure of neuronal network in schizophrenia cases. We translated the findings into newly designed layers that mimic connection constraints in schizophrenia. Please find the code used in that paper here.

Release notes

2025.7.10 Release of PyTorch version 'mouselayers_pytorch2_7.py'. Keras version 'mouselayer.py' was updated to run on Keras 3.10.
2024.10.29 Fully revised in response to the release of mouselayers.py
2020.9.24 Release of this repo.

References

Saiga et al (2025). Structural differences between human and mouse neurons and their implementation in generative AIs. Sci. Rep. 15, 25091. DOI
Mizutani et al (2022). Schizophrenia-mimicking layers outperform conventional neural network layers. Front. Neurorobot. 16, 851471. DOI
Mizutani et al (2021). Structural diverseness of neurons between brain areas and between cases. Transl. Psychiatry 11, 49. DOI pdf
Mizutani et al (2020) Schizophrenia-mimicking layers outperform conventional neural network layers. arXiv
Mizutani et al (2019) Three-dimensional alteration of neurites in schizophrenia. Transl Psychiatry 9, 85. nature.com

About

Neural network layer mimicking real brain networks

Resources

License

Stars

Watchers

Forks

Contributors