GithubHelp home page GithubHelp logo

mesutpiskin / id-card-detector Goto Github PK

View Code? Open in Web Editor NEW
271.0 8.0 121.0 48.51 MB

:credit_card: Detecting the National Identification Cards with Deep Learning (Faster R-CNN)

Home Page: https://mesutpiskin.com/blog/opencv-egitim-serisi

License: MIT License

Python 100.00%
tensorflow cnn python id-card object-detection faster-rcnn-inception-resnet deep-learning

id-card-detector's Introduction

Hi there, I'm Mesut ๐Ÿ‘‹

I'm a software engineer working primarily with backend technologies. I have extensive experience in software development and architecture design, focusing on creating highly available, low latency, reliable, distributed, and secure software architectures. I specialize in solving complex problems efficiently and providing value through rapid development and the release of quality features.

Find me around the web ๐ŸŒŽ

Visit my website ๐ŸŒ

For more information about me, check out mesutpiskin.com.

id-card-detector's People

Contributors

dependabot[bot] avatar mesutpiskin avatar ozanonurtek avatar sanix-darker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

id-card-detector's Issues

Low precision of the model

Hi,

Thanks for open sourcing this amazing work!

The model is able to detect id cards present in a given image nicely.

But the model seems to detect and classify certain incorrect images as id-card. I tried some images of my smart phone and wallet. It detects them as id-card with high score.

Could you comment on the type of images you used in training or share a better model if you have?

Also a comment on the evaluation scores would be really helpful!

Thanks

Dataset

Could anyone share the procedure of creating dataset for this ? Approx. how many images, dimension of images and other things which might be helpful.

Thank You

Prediction takes 6-7 seconds per image

Hello,

I have been testing the model on some of the images. I am using mac OS

This prediction step takes 6-7 seconds per image:

(boxes, scores, classes, num) = sess.run([detection_boxes, detection_scores, detection_classes, num_detections],feed_dict={image_tensor: image_expanded})

Is this normal? If not, how can I speed it up?

Thanks

No module named 'object_detection'

Traceback (most recent call last):
File "id_card_detection_image.py", line 13, in
from utils import label_map_util
File "C:\Users\Orcun\id-card-detector-master\utils\label_map_util.py", line 21, in
from object_detection.protos import string_int_label_map_pb2
ModuleNotFoundError: No module named 'object_detection'

Dataset type used in model training. ? question

Hi, Please can you provide some basic information about the dataset?

  1. How many examples you have used for training?
  2. Did you use multiple cards on a single image?
  3. what was the image size for training?
  4. what was the training and validation accuracy of the model?
  5. what type of ID card do you use for training?

Thanks for answering. It will be really helpful.

Add performance metrics for the README.md

Things that can be added to the README.md file :

  • Add performance metrics for the program such as accuracy when working on a number of images.
  • Analysis of time and memory space taken while running the model.

Useless Model

This program detects anything that's rectangle shaped. It's not accurate at all. If you want to enhance it, when detecting, show whether it is an actual ID card or not (like a red canva that says it's not an ID)

NameError: name 'image_path' is not defined in id_card_detection_image.py

I got this error when running py id_card_detection_image.py

Traceback (most recent call last):
  File "id_card_detection_image.py", line 105, in <module>
    im = Image.open(image_path)
NameError: name 'image_path' is not defined

I also notice similar error in my IDE PyCharm, the red underlines are undefined variable.
image

Am I missing something? Thanks!

Not Using CUDA ?

The camera version runs better in windows than linux.(although the FPS is better in linux than windows, i believe it is because you are using parallel programming)

Linux
Ubuntu 16.04 Bionic
Nvidia GTX1060 16GB,
8GB RAM
CUDA and Cudnn

Windows 10
8GB RAM
No CUDA

Is it not using CUDA or what ?

Need help making it faster.

crop & save image

After running (id_card_detection_image.py) file, can not find the saved cropped image.

Model Output with different set of inputs

Hai I have tested the model for different sets of input like, the input image is captured from far distance the output crop of the originally image is not as expected could u help me this ?

How to train ?

How to train own data, can you share the training code, thank you

Setup on Colab

Hey!
I'm unable to run it on Google Colab

WARNING:tensorflow:From id_card_detection_image.py:53: The name tf.GraphDef is deprecated. Please use tf.compat.v1.GraphDef instead.

WARNING:tensorflow:From id_card_detection_image.py:59: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

2021-08-11 07:59:44.140550: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2021-08-11 07:59:44.153485: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2021-08-11 07:59:44.153542: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (746494ea7a87): /proc/driver/nvidia/version does not exist
2021-08-11 07:59:44.153966: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2021-08-11 07:59:44.159911: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2200140000 Hz
2021-08-11 07:59:44.160127: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x559ad0e3a680 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2021-08-11 07:59:44.160160: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
: cannot connect to X server

Gazeml nor object-recognition could not be found or installed

I got this error when installing the requirements:

 Could not find a version that satisfies the requirement gazeml==0.1 (from -r requirements.txt (line 38)) (from versions: )
No matching distribution found for gazeml==0.1 (from -r requirements.txt (line 38))

...and it didn't continue installing the rest. Any suggestions?

Also, it couldn't install object-recognition:

 Could not find a version that satisfies the requirement object-detection==0.1 (from -r requirements.txt (line 82)) (from versions: )
No matching distribution found for object-detection==0.1 (from -r requirements.txt (line 82))

TensorFlow deprecated version

Run on linux server

2022-12-21 14:07:27.732736: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-12-21 14:07:27.954111: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.10/dist-packages/cv2/../../lib64:
2022-12-21 14:07:27.954190: I tensorflow/compiler/xla/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2022-12-21 14:07:29.018434: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.10/dist-packages/cv2/../../lib64:
2022-12-21 14:07:29.018557: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.10/dist-packages/cv2/../../lib64:
2022-12-21 14:07:29.018578: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
Traceback (most recent call last):
File "/home/nolonely/id-card-detector/id_card_detection_image.py", line 43, in
label_map = label_map_util.load_labelmap(PATH_TO_LABELS)
File "/home/nolonely/id-card-detector/utils/label_map_util.py", line 132, in load_labelmap
with tf.gfile.GFile(path, 'r') as fid:
AttributeError: module 'tensorflow' has no attribute 'gfile'. Did you mean: 'fill'?

No module named 'object_detection'

giving me this error "No module named 'object_detection'"
I tried to install
conda install tensorflow-object-detection-api

but cannot install in my virtual envr of conda i am wondering this error is due the this module or i am not giving a proper path to some directories secondly what should be the model for which we have to put the path in directory of file 'id_card_detection_image'
under

Name of the directory containing the object detection module we're using

MODEL_NAME = 'model'
IMAGE_NAME = 'test_images/image1.png'

handle skew image?

Can it enhance to deal with the skew image issue like the pic at the bottom of readme with the word blablablabla on it because the skew problem will reduce the accuracy of word recognition?

new id card

Thanks for sharing..

I want to identify my country ID card. Can you elaborate on how to train new card type?
And is it possible to OCR different language than English?

Thanks;

Cannot import name 'string_int_label_map_pb2'

I am trying to run id_card_detection_image.py program. I receive following error. How can I fix this?

WARNING: Logging before flag parsing goes to stderr.
W0225 22:12:39.109291 4549164480 __init__.py:329] Limited tf.compat.v2.summary API due to missing TensorBoard installation.
Traceback (most recent call last):
  File "/Users/halil/Projects/id-card-detector/id_card_detection_image.py", line 15, in <module>
    from utils import label_map_util
  File "/Users/halil/Projects/id-card-detector/utils/label_map_util.py", line 21, in <module>
    from object_detection.protos import string_int_label_map_pb2
ImportError: cannot import name 'string_int_label_map_pb2'

Training Module

How to train the model i have enough data can you share the training code for the model

Problem with running on GPU

Hi,
could you please tell me how can i run your code on a GPU? I'm not very familiar with tensorflow i usually use pytorch.

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.