licj15 / CNN4lecture

Exercise for Tsinghua lecture: Neuromorphic Computing Theory and System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exercise for Tsinghua lecture: Neuromorphic Computing Theory and System

Code example for convolutional neural network training

Prerequisites

  • A computer with NVIDIA GPUs (Please, it is important)
  • CUDA + CuDNN
  • Tensorflow (GPU version)
  • python3
  • tqdm

Data

Download and generate mnist and fashion datasets:

cd data/mnist/
python3 download_and_convert_mnist.py

and

cd data/fashion
python3 download_and_convert_fashion.py

Config training devices

Change your configurations in the file

gedit source/opt.py
gpu_list = [0]

to use GPU0 or

gpu_list = []

to use cpu

Config training hyperparameters

Change your configurations in the file

gedit source/opt.py

Config network models

Change your configurations in the file

gedit source/nets/mlp.py

or

gedit source/nets/lenet5.py

or add your own network files, don't forget to register them in nets_factory.py

You can also adjust and add other components, such as preprocessing, dataset, and register them in individual factory files.

Train

Start training:

cd source/
python top.py

The training log files will be saved in log/xxxx.txt

You can check the training details in log files, and derive statistics for drawing curves.

And the model will be saved in model/xxxx if you have configured in opt.py

About

Exercise for Tsinghua lecture: Neuromorphic Computing Theory and System


Languages

Language:Python 100.0%