Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sjain-stanford/deep-route

Training a deep FCN network in PyTorch to route circuit layouts
https://github.com/sjain-stanford/deep-route

convolutional-neural-networks deep-learning fully-convolutional-networks integrated-circuits pytorch routing

Last synced: 2 months ago
JSON representation

Training a deep FCN network in PyTorch to route circuit layouts

Awesome Lists containing this project

README

        

# Deep-Route

This repository contains PyTorch implementation (pretrained weights provided) and dataset generation code for the paper

**[Training a Fully Convolutional Neural Network to Route Integrated Circuits](https://arxiv.org/abs/1706.08948)**


[Sambhav R. Jain](https://bit.ly/sjain-stanford), Kye Okabe


arXiv-cs.CV (Computer Vision and Pattern Recognition) 2017

We design and train a deep, fully convolutional neural network that learns to route a circuit layout net with appropriate choice of metal tracks and wire class combinations. Inputs to the network are the encoded layouts containing spatial location of pins to be routed. After 15 fully convolutional stages followed by a score comparator, the network outputs 8 layout layers (corresponding to 4 route layers, 3 via layers and an identity-mapped pin layer) which are then decoded to obtain the routed layouts.

**Proposed FCN Model**

**Training samples (left: data, right: labels) from the generated dataset**

## Install (Linux)
1. Fork [this GitHub repository](https://github.com/sjain-stanford/deep-route)
2. Setup virtualenv and install dependencies
* `./setup_virtualenv.sh`
3. Install PyTorch
* `./setup_pytorch.sh`
4. Activate virtualenv, start Jupyter notebook
* `./start_jupyter_env.sh`

## Generate Dataset
Run the script `./datagen/gen_data.py` to generate training data of shape (N, 1, H, W) and labels of shape (N, 8, H, W) stored using [HDF5 (h5py)](https://github.com/h5py/h5py). Default parameters used for the paper are `H = W = 32`, and `pin_range = (2, 6)`, but feel free to modify as desired. Generating 50,000 image dataset should take < 1 minute.
```
python ./datagen/gen_data.py
>> Enter the number of images to be generated: 50000
mv ./data/layout_data.hdf5 ./model/data/train_50k_32pix.hdf5

python ./datagen/gen_data.py
>> Enter the number of images to be generated: 10000
mv ./data/layout_data.hdf5 ./model/data/val_10k_32pix.hdf5
```

## Train FCN Network (in PyTorch)
Switch to `./model/` dir and run the script `./train_fcn_pytorch.py` to train the FCN model with default options, or use the switch `--help` to display a list of options and their defaults.
```
cd ./model/
python ./train_fcn_pytorch.py --help
```

```
usage: train_fcn_pytorch.py [-h] [--data PATH] [--batch_size N]
[--num_workers N] [--num_epochs N] [--use_gpu]
[--pretrained] [--lr LR] [--adapt_lr] [--reg REG]
[--print-freq N]

Deep-Route: Training a deep FCN network to route circuit layouts.

optional arguments:
-h, --help show this help message and exit
--data PATH path to dataset (default: ./data/)
--batch_size N mini-batch size (default: 100)
--num_workers N number of data loading workers (default: 4)
--num_epochs N number of total epochs to run (default: 200)
--use_gpu use GPU if available
--pretrained use pre-trained model
--lr LR initial learning rate (default: 5e-4)
--adapt_lr use learning rate schedule
--reg REG regularization strength (default: 1e-5)
--print-freq N print frequency (default: 10)
```

To run on GPU, provide switch `--use_gpu`. Best model parameters (based on F-1 score on validation set) are saved to `./model/training/` dir every epoch, along with loss and training curves. If the switch `--pretrained` is provided, model is pre-loaded with saved parameters before training. Pretrained weights (for batch size 10 and 100) are made available [here](https://github.com/sjain-stanford/pretrained-weights). With `--adapt_lr`, a learning rate decay factor of 10 is applied every 30 epochs.

## Cite
If you find this work useful in your research, please cite:
```
@article{jain2017route,
title={Training a Fully Convolutional Neural Network to Route Integrated Circuits},
author={Jain, Sambhav R and Okabe, Kye},
journal={arXiv preprint arXiv:1706.08948},
year={2017}
}
```