Coder Social home page Coder Social logo

Comments (5)

wissem01chiha avatar wissem01chiha commented on August 20, 2024 1

Thanks very much Dr Karim for you advices , I will correct the dependency issue with the release of a docker image soon , and i will improve the detection functionally in order to get more accurate results. I am still working on it.
I am happy to invite you to fork the repo and contribute to the project Dr. It's a great pleasure.

from alpr.

kmezhoud avatar kmezhoud commented on August 20, 2024
pip3 list | grep tesseract
pytesseract               0.3.10
tesseract                 0.1.3

from alpr.

kmezhoud avatar kmezhoud commented on August 20, 2024

Possible cause of this error (about tesseract) is that I installed pytesseract with pip without installing the binary. If that is the case, you can install it as following source:

sudo apt update
sudo apt install tesseract-ocr
sudo apt install libtesseract-dev

And now it is better:

python3 main.py 
[INFO] Configuring Environment ...
[INFO] Reading Variable Files ...
[INFO] Starting Video Processing
[INFO] Capturing video ...
[SUCESS] video captured in 0 seconds
[INFO] Generating Frames ...
[SUCESS] 181 frames generated in 7 seconds
[INFO] Preprocessing Frames ...
[SUCESS] frames preprocessed in 19 seconds
[INFO] Filtring and Denoisng Frames ...
[SUCESS] frames filtred and denoised in 20 seconds
[INFO] frames sorted in 21 seconds
[INFO] Numerical Character Detection ... 
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:21
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:21
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:225-0
[INFO] Time Remaining:21
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:22
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:22
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:22
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:22
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:22
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:22
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:22
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:22
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:22
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-7526
[INFO] Time Remaining:23
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:23
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:23
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:24
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:24
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:24
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:79
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:80
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:80
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:80
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:81
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:82
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:82
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:82
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:82
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:82
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:82
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:82
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:82
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:82
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:82
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:83
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:83
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:83
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:83
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:83
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:83
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:84
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:89
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:89
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:89
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:89
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:89
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:94
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:100
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:100
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:100
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:100
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:102
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:102
---------------------------------------------
[FAIL] licence plate not detected ! 
[INFO] processing possible best matched numbers ...
[INFO] car number is:0-0
[INFO] Time Remaining:103
[INFO] end program !

But the plate is not detected.
Any Idea is welcome.
Thanks!

from alpr.

wissem01chiha avatar wissem01chiha commented on August 20, 2024

Dear kmezhoud;

Thanks very much for you interest in my project. I am so grateful for your remakes.

First I developed the software on Windows 11 and USB Cam video camera witch run on python 3.11.4 , then i used to compile it to Raspberry pi 3B+ witch run on Raspbian OS , so there was many libs had incompatibility issues , for the Raspbian (Default python 3.9), i make some changes to make it works ( lib version listed in setup.py might not work under any laptop )
so
try to downgrade your python version and rerun.

Second , the last output ( program exist without plate detection) is due the tesseract engine version , with some versions it do not work well. try to change the version or use another better OCR engine or
it's due to the matching character function matching_number.py go to line 355 to 370 of the main.py code :

serie_detected,reg_detected,s,reg=utils.matching_number(plate_chars)
   if(serie_detected and reg_detected):
       print("---------------------------------------------")
       print("[SUCESS] licence plate detected succesfully :")
       print("[INFO] car number is:%d-%d"%(reg,s))
       t=time.time()-start_time
       print("[INFO] Time Remaining:%d"% t )  
       print("[INFO] Exit Process!")
       break
   else:
       print("---------------------------------------------")
       print("[FAIL] licence plate not detected ! ")
       print("[INFO] processing possible best matched numbers ...")
       print("[INFO] car number is:%d-%d"%(reg,s))
       t=time.time()-start_time
       print("[INFO] Time Remaining:%d"%  t)

and replace it with :

serie_detected,reg_detected,s,reg=utils.matching_number(plate_chars)
print("---------------------------------------------")
print("[SUCESS] licence plate detected succesfully :")
print("[INFO] car number is:%d-%d"%(reg,s))
t=time.time()-start_time
print("[INFO] Time Remaining:%d"% t )  
print("[INFO] Exit Process!")

you should print many character including numbers , symbols , .... and show me the result.

the function matching_number.py should be implemented with a fuzzy logic or probabilistic approach , hence in the project we don t find time to implement that.

For video recording , there was a function implemented capture_video.py in video module. it works for the default hardware camera (it works fine for the Raspberry pi camera, check it for laptop camera records )

The actual version use recognition from proceed images one by one , the cod do not make correlation between results extracted from previous image , try to implement a feature localization module and a comparison process.

from alpr.

kmezhoud avatar kmezhoud commented on August 20, 2024

Hi Thanks,

  1. To avoid this kind of dependency issues and versions, you can build a docker image like this.
cd cil4sys
# generate requiements.txt file with all dependency and verions
pipreqs .

# create dockerfile without extention
touch dokerfile

# edit dockerfile with your editor
vim dockerfile &

dokerfile

# set base image (host OS)
FROM python:3.9

# set the working directory in the container
WORKDIR /home

# copy the dependencies file to the working directory
COPY requirements.txt .

# install dependencies
RUN pip install -r requirements.txt

# copy the content of the local src directory to the working directory
COPY . ./cil4sys

# command to run on container start
CMD [ "python", "main.py" ] 

close dockerfile and build the image

# build image
docker build -t myimage .
# check existing image  in local machine
docker images

# publish you image to dockerhub
docker push WissemChiha/sci4sys:0.1

after that, any user can install your package without any issue by

# install
docker pull WissemChiha/sci4sys:0.1

# run
docker run -d  WissemChiha/sci4sys:0.1

This is the Principe of dockerize python package and not a full solution of your case.

  1. after main.py modif
python3 main.py 
[INFO] Configuring Environment ...
[INFO] Reading Variable Files ...
[INFO] Starting Video Processing
[INFO] Capturing video ...
[SUCESS] video captured in 0 seconds
[INFO] Generating Frames ...
[SUCESS] 181 frames generated in 7 seconds
[INFO] Preprocessing Frames ...
[SUCESS] frames preprocessed in 21 seconds
[INFO] Filtring and Denoisng Frames ...
[SUCESS] frames filtred and denoised in 22 seconds
[INFO] frames sorted in 23 seconds
[INFO] Numerical Character Detection ... 
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:23
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:24
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:225-0
[INFO] Time Remaining:24
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:24
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:24
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:24
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:24
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:24
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:24
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:24
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:25
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:25
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-7526
[INFO] Time Remaining:25
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:26
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:26
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:26
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:26
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:27
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:80
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:80
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:80
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:80
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:82
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:83
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:84
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:84
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:88
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:88
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:88
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:88
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:89
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:93
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:98
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:98
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:98
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:98
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:100
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:100
[INFO] Exit Process!
---------------------------------------------
[SUCESS] licence plate detected succesfully :
[INFO] car number is:0-0
[INFO] Time Remaining:100
[INFO] Exit Process!
[INFO] end program !

Not yet.
Karim

from alpr.

Related Issues (2)

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.