Skip to content

erikhelmut/neural-cellular-automata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

neural-cellular-automata


chest   chest

Unleashing emergent behavior through neural network and cellular automata fusion.

Neural cellular automata (NCA) represent an incredible fusion of neural networks and cellular automata, enabling the simulation of complex systems and showcasing remarkable emergent behavior. NCAs offer a captivating approach to studying and understanding dynamic systems in various fields such as physics, biology, and artificial intelligence, making them truly amazing tools for exploration and discovery.
Growing Neural Cellular Automata »

NCA PyTorch Walkthrough · MedMnist · MEC Lab

Table of Contents
  1. Introduction
  2. Getting Started
    1. Prerequisites
    2. Installation
  3. Usage
    1. Training
    2. Visualizing
  4. Contacts

Introduction

This repository was created as part of the lecture 'Deep Generative Models' given by Mec-Lab at the Technical University of Darmstadt.

We explore the capabilities of neural cellular automata (NCA) and their potential applications in the field of medical imaging. We reimplement the NCA model proposed in the Growing Neural Cellular Automata paper and train it on the MedMnist dataset. In addition, we provide a set of tools for training and visualizing the NCA model.

Getting Started

Prerequisites

Make sure you have a running Python 3.11+ environment. We recommend using Anaconda for managing your Python environment.

Installation

Step 1: Clone the repository

$ git clone git@github.com:erikhelmut/neural-cellular-automata.git
$ cd neural-cellular-automata

Step 2: Create conda environment

$ conda create --name nca python=3.11
$ conda activate nca

Step 3: Install dependencies

$ pip install -r requirements.txt

Usage

We provide a set of tools for training and visualizing the NCA model. The following sections describe how to use them in detail.

Training

To train the NCA model, run the following command:

$ cd neural-cellular-automata/src/
$ python3 train.py --config train_config.yaml

The train_config.yaml file contains all the hyperparameters and settings for the training process. You can modify the settings in the file to change the training process. The following table describes the most important settings:

Setting Description
target_path The path to the target image.
model_path The path to the model checkpoint.
device The device to use for training.
ìterations The number of training iterations.
learning_rate The learning rate.
img_size The size of the image.
padding The padding around the image.
n_channels The number of channels. Minimum 4 channels are required.
batch_size The batch size.
pool_size The size of the training pool.
filter The filter to use for the convolution. sobel, scharr, gaussian, laplacian or mean are supported.
loss The loss function to use. L1, L2, Manhattan or Hinge are supported.
damage If True samples from the training pool are damaged during training.

Visualizing

To visualize the trained model, run the following command:

$ cd neural-cellular-automata/src/
$ python3 visualize.py --config visualize_config.yaml

The visualize_config.yaml file contains all the settings for the visualization process. You can modify the settings in the file to change the visualization process. The following table describes the most important settings:

Setting Description
target_path The path to the target image.
model_path The path to the model checkpoint.
ani_path The path to the animation.
iterations The number of iterations to visualize.
img_size The size of the image.
padding The padding around the image.
n_channels The number of channels. Minimum 4 channels are required.
filter The filter to use for the convolution. sobel, scharr, gaussian, laplacian or mean are supported.
loss The loss function to use. L1, L2, Manhattan or Hinge are supported.
damage If True sample will be damaged during visualization.

Contacts