Skip to content

goldstraw/rust_cnn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Convolutional Neural Network from Scratch

This repository contains a Rust implementation of a Convolutional Neural Network (CNN) built from scratch. This repository provides code for training on the MNIST dataset, and the 50States10K dataset.

All machine learning code is written from scratch, however the ndarray crate is used for matrix operations. When tuned correctly, the network should reach 90+% accuracy within one minute on the MNIST dataset.

Overview

The repository implements the following features:

  • Convolutional, max pooling, and fully connected layers
  • ReLU and Softmax activation functions
  • Cross-entropy loss function
  • SGD, Momentum, RMSProp, and Adam optimizers
  • Dropout
  • He initialization

Installation

To use this CNN implementation, you must have Rust and Cargo installed on your machine. After installing Rust and Cargo, you can clone this repository to your local machine and build the project with the following command:

$ cargo build --release

Usage

To run the demo of the CNN, place the MNIST dataset in a folder named data, and use the following command:

$ cargo run --release

This command will run a demo of the CNN and train it on the MNIST dataset.

Further Reading

For more information about this project, read my blog post on CNNs.

License

This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.