Skip to content

This repository is web application that aims to provide various features such as video live stream, haarcascade classifier, and optical character recognition (OCR). This app is built using Python, OpenCV, Django, TailwindCSS (django-tailwind), EasyOCR

Notifications You must be signed in to change notification settings

armandwipangestu/django-plate-number-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Plate Number Detection

Python  OpenCV  Django  TailwindCSS  PyTorch 

Preview

This repository is web application that aims to provide various features such as video live stream, haarcascade classifier, and optical character recognition (OCR). This app is built using Python, OpenCV, Django, TailwindCSS (django-tailwind), EasyOCR

Table of Contents

Demo App

django-plate-number-detection.mp4

Tech Stack

  • Python (Programming Language): Python is a high-level, interpreted programming language known for its simplicity and versatility, widely used in web development, data analysis, artificial intelligence, scientific computing, and more.
  • OpenCV (Computer Vision): OpenCV (Open Source Computer Vision Library) is an open-source computer vision and machine learning software library. It provides a comprehensive set of features for image processing, computer vision, and machine learning.
  • Django (Framework): Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It is designed to help developers build robust and scalable web applications quickly.
  • TailwindCSS (CSS Framework): TailwindCSS is a utility-first CSS framework for building custom user interfaces rapidly and efficiently. It provides a comprehensive set of CSS utility classes that allow developers to design directly in their markup.
  • EasyOCR (OCR): EasyOCR is a ready-to-use Optical Character Recognition (OCR) library built with deep learning techniques. It can handle text in different languages and is designed for high accuracy and performance.

Running on Localhost

  1. Clone this repository
git clone https://github.com/armandwipangestu/django-plate-number-detection.git && cd django-plate-number-detection
  1. Install python-virtualenv (in my case use Arch Linux) and create the virtual environment

NOTE: If you are using windows you can install with anaconda, then create the virtual environment

conda create -n django-plate-number-detection python==3.8
sudo pacman -S python-virtualenv
virtualenv django-plate-number-detection
  1. Activate the virtual environment to the current shell session

NOTE: If you are using windows and anaconda, to activate the virtual environment use this command instead

conda activate django-plate-number-detection
source django-plate-number-detection/bin/activate
  1. Install dependency required library
pip install -r requirements.txt
  1. Install dependency tailwindcss library
python manage.py tailwind install
  1. Running application & tailwindcss

NOTE: Running this server with seperate shell session

python manage.py runserver 0.0.0.0:8080
python manage.py tailwind start

After the server running, open this url http://localhost:8080 on your web browser

Troubleshooting Error

Commons

Live Video Stream Camera Not Detecting

If you got this error, just reload the page browser, sometimes it likes to error (I don't know why, but if reload it it will be normal)

OpenCV imshow The function is not implemented

NOTE: This error will not appear on this application, this error will appear if you use the imshow function on opencv library

If you got this error message cv2.error: OpenCV(4.10.0) /io/opencv/modules/highgui/src/window.cpp:1301: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage', just run this command

pip uninstall opencv-python-headless opencv-python
pip install opencv-python

After uninstall and install the library, just run the app again

Windows

PyTorch Library fbgem.dll

NOTE: ${PATH_TO_ENV} is dynamic location, it depends on your installation either using conda or virtualenv

If you got error the PyTorch library like this OSError: [WinError 126] The specified module could not be found. Error loading "${PATH_TO_ENV}/lib/site-packages/torch/lib/fbgem.dll" or one of its dependencies when running the application. You can read this forums, it's like the PyTorch library doesn't have libomp140.x86_64.dll file. So you can download the file and place it to the same location fbgem.dll

  • Discuss PyTorch - Failed to import pytorch fbgemm.dll or one of its dependencies is missing: #22
  • Discuss PyTorch - Failed to import pytorch fbgemm.dll or one of its dependencies is missing: #23
  • DLLme - libomp140.x86_64.dll: Download

OMP: Error #15: Initializing libiomp5md.dll, but found libomp140.x86_64.dll already initialized.

NOTE: That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

If you got this error, you can add this code at file manage.py

import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"

Credits

About

This repository is web application that aims to provide various features such as video live stream, haarcascade classifier, and optical character recognition (OCR). This app is built using Python, OpenCV, Django, TailwindCSS (django-tailwind), EasyOCR

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published