Code Monkey home page Code Monkey logo

anpr's Introduction

ANPR -Based on YOLOv4 Tiny

Darknet Continuous Integration CircleCI TravisCI Contributors License: Unlicense

Built on top of AlexyAB's Darknet repository

AlexyAB's Darknet repository: https://github.com/AlexeyAB/darknet

Screenshots

Installation

This code was written and tested on a Linux machine but the installation steps will be similar for Windows an MacOS

Clone the darknet repository

git clone https://github.com/AlexeyAB/darknet.git

Download these files and copy them to the cloned darknet repository

Open the Makefile and change these lines as folows

GPU=1 # 0 to 1 if you have a GPU
CUDNN=1 # 0 to 1 if you want to use CUDNN
CUDNN_HALF=0 # 0 to 1 if you have a higher end GPU
OPENCV=1 # 0 to 1 to use opencv will not work if you dont set it to 1
AVX=1 # 0 to 1 useful if you need to run it in a CPU
OPENMP=0 # 0 to 1 (user preference)
LIBSO=1 # 0 to 1 Important the code wont run without it will generate a libdarknet.so
ZED_CAMERA=0 # 0 to 1 (user preference)
ZED_CAMERA_v2_8=0 # 0 to 1 (user preference)

# if using a Jetson Nano board uncomment the following(for jetson TX1)
# ARCH= -gencode arch=compute_53,code=[sm_53,compute_53]

Run make

make -j4

Darknet will be compiled with GPU support

This code uses openALPR OCR to read the characters from the detected number plates

Install openALPR for Ubuntu (Much easier and had a higher success rate)

# Install prerequisites
sudo apt-get install libopencv-dev libtesseract-dev git cmake build-essential libleptonica-dev
sudo apt-get install liblog4cplus-dev libcurl3-dev

# If using the daemon, install beanstalkd
sudo apt-get install beanstalkd

# Clone the latest code from GitHub
git clone https://github.com/openalpr/openalpr.git

# Setup the build directory
cd openalpr/src
mkdir build
cd build

# setup the compile environment
RUN cmake -D WITH_BINDING_JAVA=OFF \
  -D WITH_DAEMON=OFF \
  -D WITH_GPU_DETECTOR=ON \
  -D CMAKE_INSTALL_PREFIX:PATH=/usr \
  -D CMAKE_INSTALL_SYSCONFDIR:PATH=/etc ..

# compile the library
make -j4

# Install the binaries/libraries to your local system (prefix is /usr)
sudo make install

# Test the library
wget http://plates.openalpr.com/h786poj.jpg -O lp.jpg
alpr lp.jpg

Once you've completed the steps, go to the git repo you've cloned to your machine during the above installation and install the python bindings. runtime_data folder is also available in this repo, which will be helpful for next step.

cd openalpr/src/bindings/python/
sudo python3 setup.py install

After this step follow these to optimize openalpr's ocr for some perfomance gains

You should modify file /etc/openalpr/openalpr.conf example below

; This configuration file overrides the default values specified 
; in /usr/share/openalpr/config/openalpr.defaults.conf
hardware_acceleration = 1
gpu_id = 0
gpu_batch_size = 10

You should modify file /usr/share/openalpr/openalpr.defaults.conf example below

max_detection_input_width = 800
max_detection_input_height = 600

detector = lbpgpu

skip_detection = 1

max_plate_angle_degrees = 30

Credits

AlexyAB for darknet

anpr's People

Contributors

souravrs999 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.