All Projects → FabianGroeger96 → cnn-number-detection

FabianGroeger96 / cnn-number-detection

Licence: MIT license
Number detection implemented using TensorFlow with custom CNN architecture for fast inference and custom dataset

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to cnn-number-detection

isaac ros dnn inference
Hardware-accelerated DNN model inference ROS2 packages using NVIDIA Triton/TensorRT for both Jetson and x86_64 with CUDA-capable GPU
Stars: ✭ 67 (+31.37%)
Mutual labels:  dnn
awesome-dnn
Awesome things related to DNN (DotNetNuke)
Stars: ✭ 19 (-62.75%)
Mutual labels:  dnn
QTextRecognizer
A gui for tesseractOCR with some preprocessing image options (OpenCV) for improve character recognition
Stars: ✭ 27 (-47.06%)
Mutual labels:  dnn
dnnextensions
One solution. Multiple extensions. No pain. A collection of DNN modules and other extensions.
Stars: ✭ 36 (-29.41%)
Mutual labels:  dnn
YOLO-Streaming
Push-pull streaming and Web display of YOLO series
Stars: ✭ 56 (+9.8%)
Mutual labels:  dnn
Custom-CNN-based-Image-Classification-in-PyTorch
No description or website provided.
Stars: ✭ 41 (-19.61%)
Mutual labels:  custom-dataset
DNN-JavaScript-Libraries
Common JavaScript libraries packaged as DNN JavaScript Library extensions
Stars: ✭ 26 (-49.02%)
Mutual labels:  dnn
FaceMaskDetection-dnn
用opencv的dnn模块实现人脸口罩检测,包含C++和Python两种版本的实现
Stars: ✭ 44 (-13.73%)
Mutual labels:  dnn
HyperKeras
An AutoDL tool for Neural Architecture Search and Hyperparameter Optimization on Tensorflow and Keras
Stars: ✭ 29 (-43.14%)
Mutual labels:  dnn
DNN.Reports
DNN Reports module provides a simple, flexible, view on your database, any table, any view and display results with plugin visualizers
Stars: ✭ 20 (-60.78%)
Mutual labels:  dnn
ofxOpenCvDnnObjectDetection
OpenCV based DNN Object Detection Library for Openframeworks
Stars: ✭ 34 (-33.33%)
Mutual labels:  dnn
Tengine-Convert-Tools
Tengine Convert Tool supports converting multi framworks' models into tmfile that suitable for Tengine-Lite AI framework.
Stars: ✭ 89 (+74.51%)
Mutual labels:  dnn
SynthText Chinese
Modify from https://github.com/JarveeLee/SynthText_Chinese_version.git with python3 and cv3.
Stars: ✭ 35 (-31.37%)
Mutual labels:  dnn
DNN.Templates
MVC and SPA (Single Page Application) module templates for DNN
Stars: ✭ 19 (-62.75%)
Mutual labels:  dnn
Perception-of-Autonomous-mobile-robot
Perception of Autonomous mobile robot,Using ROS,rs-lidar-16,By SLAM,Object Detection with Yolov5 Based DNN
Stars: ✭ 40 (-21.57%)
Mutual labels:  dnn
DNN.Faq
DNN FAQ is a basic module used for displaying frequently asked questions on your DNN site.
Stars: ✭ 16 (-68.63%)
Mutual labels:  dnn
ofxDlib
An openFrameworks wrapper for dlib. http://dlib.net/
Stars: ✭ 52 (+1.96%)
Mutual labels:  dnn
stonne
STONNE: A Simulation Tool for Neural Networks Engines
Stars: ✭ 57 (+11.76%)
Mutual labels:  dnn
DNN.Feedback
DNN Feedback is a basic module used for accepting user inquiries on your DNN site.
Stars: ✭ 17 (-66.67%)
Mutual labels:  dnn
jpeg-defense
SHIELD: Fast, Practical Defense and Vaccination for Deep Learning using JPEG Compression
Stars: ✭ 82 (+60.78%)
Mutual labels:  dnn

CNN number detection

Stars Forks GitHub Issues License Contribotion

Table of Contents

  1. Project
  2. Example Images
  3. Installation
  4. Usage
  5. Additional Remarks

Project

The goal of this repository is to implement a number detection using Tensorflow with a custom Convolution Neural Net (CNN) architecture specifically for fast inference. The CNN will be trained using a custom created dataset that contains numbers from 1-9 and a category for 'not numbers (-1)'.

The CNN is fast enough to run in real-time on a Raspberry Pi.

Number detection Raspberry Pi

Specs

  • Image size (input to the model): 320 x 240
  • Camera fps: 38
  • Processing time (with isolator): 25ms - 45ms (on Raspberry Pi)

Download links

Includes

  • DataExtractor (to extract data for the dataset)
  • Isolator (to find the numbers inside an image)
  • Trainer (to train the model)
  • Tester (to test the model)

Example Images

Example input images

Example Image Example Image Example Image

Example extracted images (dataset images)

Example Extracted Example Extracted Example Extracted

Installation

Requirements

You need to have the following packages installed (check requirements.txt):

  • Python 3.6
  • Tensorflow 1.4.1+
  • OpenCV 4.0
  • Etc.

Install

Clone the repo and install 3rd-party libraries

$ git clone https://github.com/FabianGroeger96/cnn-number-detection
$ cd cnn-number-detection
$ pip3 install -r requirements.txt

Usage

Extract data with DataExtractor

  1. Create a folder named images_to_extract in the data extractor directory (The folder can be named differently, but don't forget to change the INPUT_DATA_DIR variable in the constants.py file). This directory will be used to extract the regions of interest to train your CNN.
  2. Copy the data to extract the regions of interest into the images_to_extract folder
  3. Specify which categories you want to extract in the constants.py file, by changing the CATEGORIES variable
  4. Run the extract_data.py file and call the method extract_data() from the Extractor
  5. After the method is finished your extracted regions of interest are located in the data_extracted folder. In there you will also find folders for each of your categories. These folders are used to label the regions of interest for then training your CNN.

Label the Data (by Hand)

  1. First of all you will have to extract the regions of interest with the DataExtractor (follow the step Extract data with DataExtractor)
  2. Classify the images, by dragging them in the corresponding category folder

Label the Data (with existing Model)

  1. First of all you will have to extract the regions of interest with the DataExtractor (follow the step Extract data with DataExtractor)
  2. Specify in the constants.py file where your model will be located, by modifying the MODEL_DIR constant
  3. Place your existing model in the directory that you specified before
  4. Run the extract_data.py file and call the method categorize_with_trained_model(), this will categorize your regions of interest
  5. Verify that the data was labeled correctly, by checking the data_extracted folder

Create dataset pickle files

  1. If you are finished labeling the images, run the extract_data.py file and call the method rename_images_in_categories() from the Extractor, this will rename the images in each category
  2. Run the extract_data.py file and call the method create_training_data(), this will create your pickle files (X.pickle and y.pickle) which contain the data and the labels of your data

Train the CNN

  1. Check if the pickle files (X.pickle and y.pickle) were created in the root directory of the project
  2. Run the train_model.py file within the trainer, this will train your model and save it to the directory specified in the constants.py (MODEL_DIR)

Test the CNN

usage: test_model.py [-h] [--model_type MODEL_TYPE] [--model_path MODEL_PATH] [--test_image TEST_IMAGE]
                     [--test_folder TEST_FOLDER] [--test_on_random]

cnn-number-detection

optional arguments:
  -h, --help                 show this help message and exit
  --model_type MODEL_TYPE    type of model to use
  --model_path MODEL_PATH    path to the saved model
  --test_image TEST_IMAGE    path to the image for testing the model
  --test_folder TEST_FOLDER  folder with images for inference
  --test_on_random           if a randomly generated image should be used for inference
  1. Check if the model is in the directory specified in constants.py (MODEL_DIR)
  2. Upload a testing image or a folder full of test images to the tester directory
  3. Specify the correct model type (--model_type) and model path (--model_path)
  4. Run inference
    1. Run the test_model.py file within the Tester by specifying the image with --test_image
    2. Run the test_model.py file within the Tester by specifying the folder with --test_folder
    3. Run the test_model.py file within the Tester on a random image with --test_on_random

Additional Remarks

Command to create a video out of a bunch of images.

 convert *.jpg recognized.mpeg
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].