Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@

<!--ACCURACY_PLACEHOLDER-->Accuracy: Stat: 98.01% (updated: 2025-04-28)<!--END_ACCURACY-->
## Short description
A lightweight C++ library for performing high-performance inference on MNIST handwritten digits using a modified AlexNet architecture. Designed for efficiency and educational purposes, this project demonstrates how classic CNNs can be optimized for small-scale tasks in native environments.
A lightweight C++ library for performing high-performance inference on classification tasks. Designed for efficiency and educational purposes, this project demonstrates how classic CNNs can be optimized for small-scale tasks in native environments.
### Key Features:

* C++17 implementation for bare-metal performance

* Simplified AlexNet for 28×28 grayscale images

* Googlenet, Densenet, Resnet and Yolo11x-cls for images of any size

* Parallel computing via Intel OneTBB (Threading Building Blocks)

* Pre-trained model: AlexNet-model.h5 included
* Pre-trained model: AlexNet-model.h5, Googlenet.onnx included
## **Some files used to create the library**
### Neural network models
You need to download [Alexnet-model.h5](https://github.com/moizahmed97/Convolutional-Neural-Net-Designer/blob/master/AlexNet-model.h5) to the folder *docs*
Expand All @@ -30,9 +32,9 @@ Other models:</br>

## **How do I launch the inference?**
* Make sure you install the project dependencies by running: *pip install -r requirements.txt*
* You need to run the script *parser.py* that is located in app/AlexNet to read weights from a model *Alexnet-model.h5* and the json file with the weights will be stored in the *docs* folder.
* You need to run the script *parser.py* that is located in app/converters to read weights from a model *Alexnet-model.h5* or *parser_onnx.py* to read weights from a models ONNX or YOLO and the json file with the weights will be stored in the *docs* folder.
* Then put the test images in png format in the folder *docs/input*
* After building the project, which is described below, run Graph_build in folder *build/bin*
* After building the project, which is described below, run Graph_build with the parameter --model (alexnet_mnist or googlenet or densenet or resnet or yolo) and the parameter --parallel if you need. App Graph_build is located in folder *build/bin*

## **Building a Project**
### *Windows*
Expand Down Expand Up @@ -69,7 +71,7 @@ To build and run this project locally on Windows, follow these steps:
```
and run the file
```bash
Graph_Build.exe
Graph_Build.exe --model alexnet_mnist
```
### *Linux/macOS*
To build and run this project locally on Linux or macOS, follow these steps:
Expand Down Expand Up @@ -116,7 +118,7 @@ To build and run this project locally on Windows, follow these steps:
```
and run the file
```bash
./Graph_Build
./Graph_Build --model alexnet_mnist
```

## Test Process
Expand Down Expand Up @@ -147,10 +149,14 @@ To start the testing process locally, you need to go to the directory
./run_test
```

## **Accuracy validation**
## **Accuracy validation for Alexnet on MNIST**
To run accuracy validation you need to use the MNIST dataset, which you can download [here](https://github.com/DeepTrackAI/MNIST_dataset/tree/main/mnist/test) and put it in a folder *docs/mnist/mnist/test*
Now you can run accuracy check - *build\bin\ACC_MNIST.exe*
* **The accuracy should be 98.02%**
Now you can run accuracy check - *build\bin\ACC.exe --model alexnet_mnist*
* **The accuracy should be 98.01%**

## **Accuracy validation for ONNX or YOLO models on ImageNet**
To run accuracy validation you need to use the ImageNet dataset, which you can download [here](https://www.kaggle.com/datasets/sautkin/imagenet1kvalid) and put it in a folder *docs/Imagenet/*
Now you can run accuracy check - *build\bin\ACC.exe --model googlenet*

## **Documentation of project**
https://github.com/embedded-dev-research/ITLabAI/blob/Semyon1104/Final_documentation/docs/IT_Lab_2023.pdf
Expand Down
Loading