This repository contains VHDL implementations and examples for deploying Convolutional Neural Networks (CNNs) and Feedforward Neural Networks on FPGAs. It is designed to facilitate resource-efficient, scalable AI solutions for image recognition tasks.
The repository is structured into the following directories:
This directory contains universal VHDL modules for implementing neural networks. It includes:
- Core Library: Modular VHDL files for building and deploying CNNs and Feedforward Networks.
- Example Projects: Demonstrations of how to use the VHDL modules, including an MNIST-based digit recognition example.
Contains sample configurations and datasets for testing and deploying neural networks on FPGAs:
- MNIST:
- Predefined configurations and parameters.
- A main file for forming and deploying a digit recognition network.
- Other Examples: Feel free to add your own examples.
The MNIST example demonstrates a basic neural network for handwritten digit recognition, fully implemented on an FPGA. It serves as a foundational model for understanding and extending the VHDL framework.
- Configuration File: Define network architecture and parameters.
- VHDL Implementation: The network logic implemented for FPGA deployment.
- Data File: Pre-trained weights and biases for implementation.
- Modular design to build and customize neural networks.
- Optimized for sequential calculations to minimize resource usage.
- Designed for efficient data flow without complex skip connections (like Yolo).
- Supports convolutional layers, max-pooling, and dense layers (at the moment).
- Parameterizable layer configurations (e.g., filter size, stride).
- Adaptable for various FPGA sizes and applications.
- Sequential computation allows resource-constrained implementations.
To achieve optimal network performance, consider the following:
- Data Augmentation: Use techniques such as rotation, flipping, and contrast adjustment to improve generalization.
- Preprocessing: Simplify input data where possible (e.g., grayscale conversion, resolution reduction).
- Label Simplification: For tasks like segmentation, minimize output complexity by predicting key points or simplified outputs.
When designing FPGA-specific networks:
- Avoid complex architectures with skip connections like in Yolo or V-Net.
- Prefer convolutions over dense layers for generalized feature extraction.
- Utilize straightforward parallel data flow for efficient implementation.
- Use layer configurations like
1x1
,3x3
, or1xN
convolutions for optimal balance between accuracy and resource usage.
- FPGA with sufficient resources for the intended application.
- Toolchain compatible with VHDL files (e.g. Quartus).
We welcome contributions to improve this repository! Here are some areas where your help would be greatly appreciated:
-
Bug Fixes: If you encounter any issues or errors, feel free to report them or submit a pull request with a fix.
-
Additional Features: Help expand the framework by:
- Adding support for more neural network layers or architectures.
- Developing modules to optimize implementation for specific FPGA hardware.
- Creating tools for real-time weight updates or efficient weight initialization.
-
New Examples: Contribute examples that showcase additional use cases, such as:
- Image recognition for other datasets or tasks.
- Applications tailored to specific industries.
-
Documentation: Enhance the documentation to make the framework easier to use and more accessible for newcomers.
If you’d like to contribute, fork the repository, make your changes, and submit a pull request. For larger contributions, please open an issue first to discuss your ideas.
Together, we can make this framework more versatile and powerful for FPGA-based neural network implementations!