Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mizutanilab authored Oct 29, 2024
1 parent 5bd393d commit d4be469
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ We have been studying brain tissues of <a href="https://dx.doi.org/10.1038/s4139
Mouse-mimetic layer is based on our study on nanometer-scale 3D structures of mouse brain tissues and also on those of human, such as [this](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0287646). We implemented the mouse-mimetic convolutional layers in generative AIs and found that the resultant mouse AI excels at generating cat face and cheese photos. Python scripts used in our <a href="https://arxiv.org/abs/2410.20735">study</a> are available from <a href="https://github.com/mizutanilab/biomimetic-nn/tree/master/mouse">here</a>.<BR>

## How to implement the mouse-mimetic layer in your network
Our code runs on Tensorflow 2.16 / Keras 3.3. Connection-constraint versions of the fully connected layer and the 2D convolutional layers are available. Their usage is the same with the official Keras layers, except for specifying the %usage of weights and its 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%.
Our code runs on Tensorflow 2.16 / Keras 3.3. Mouse-mimetic versions of the fully connected layer and the 2D convolutional layers are available. Their usage is the same with the Keras 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` (Tensorflow 2.16) file from <a href="https://github.com/mizutanilab/biomimetic-nn">our repository</a> to your working directory where your *.py file is placed.
2. The following is an example code using a `mConv2D` layer in place of the `Conv2D` layer:
```
import keras
from keras import layers
import mouselayers as mouse
model = keras.Sequential([
layers.Dense(4 * 4 * 1024, activation='relu'),
Expand All @@ -21,7 +22,7 @@ model = keras.Sequential([
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% parameter reduction, which is defined with argument `window2d_width`. The reduction ratio best fit to your code 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.
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](https://www.nature.com/articles/s41398-019-0427-4). We translated the findings into newly designed layers that mimic connection constraints in schizophrenia. Please find the code used in that paper <a href="https://github.com/mizutanilab/biomimetic-nn/tree/master/FrontNeurorobot">here</a>.<BR>
Expand Down

0 comments on commit d4be469

Please sign in to comment.