

{"id":101003,"date":"2021-10-27T09:50:16","date_gmt":"2021-10-27T04:20:16","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=101003"},"modified":"2026-06-01T12:26:00","modified_gmt":"2026-06-01T06:56:00","slug":"pan-card-fraud-detection-python-opencv","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/","title":{"rendered":"Pan Card Fraud Detection using Python &amp; OpenCV"},"content":{"rendered":"<p>Nowadays frauds are everywhere. From cyber technology to legal documents, everywhere is fraud. So here, we\u2019re going to build a pan card fraud detection project using Computer Vision with OpenCV &#8211; Python and Deep Learning.<\/p>\n<h3>What is OpenCV?<\/h3>\n<p>OpenCV is a real-time computer vision library. It is very fast and lightweight because it runs on C++ in the backend. Using OpenCV we can perform any kind of image processing task because it comes with more than 2500 image processing algorithms.<\/p>\n<p><strong>Computer Vision<\/strong> is a field of artificial intelligence that enables the extraction of information from images, videos, or other visual inputs such as cameras.<\/p>\n<h3>What is an Artificial Neural Network?<\/h3>\n<p>Artificial Neural Network is the core of deep learning algorithms. It mimics biological neurons. It works the same way of sending signals to one another of biological neurons. Neural networks are a set of layers that contains an input layer, one or more hidden layers, and an output layer.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/ann.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103885\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/ann.webp\" alt=\"Artificial Neural Network\" width=\"576\" height=\"509\" \/><\/a><\/p>\n<p>Here we\u2019ll work with images, so we have to use a <strong>Convolutional neural network (CNN).<\/strong><\/p>\n<h3>What is a Convolutional Neural Network?<\/h3>\n<p>In deep learning, a convolutional neural network or CNN is a type of algorithm that is commonly used to process images. It is specifically designed to process images. CNN takes images as input, then applies some filters, assigns some learnable weights and biases, and then it will be able to differentiate between one class from another.<\/p>\n<h3>What is Deep Learning?<\/h3>\n<p>Deep learning is a subset of machine learning and artificial intelligence. It is inspired by the human brain\u2019s architecture. Deep learning is used to solve very complex problems that cannot be solved using traditional machine learning algorithms.<\/p>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/ai-computer-vision.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103884\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/ai-computer-vision.webp\" alt=\"ai computer vision\" width=\"600\" height=\"565\" \/><\/a><\/h3>\n<h3>Prerequisites:-<\/h3>\n<p>1. Python 3.x (We used python 3.7.10 for this project).<br \/>\n2. OpenCV &#8211; 4.4.0<br \/>\n3. Numpy &#8211; 1.19.3<br \/>\n4. Tensorflow &#8211; 2.5.0<br \/>\n5. Scikit-learn &#8211; 0.24.2<br \/>\n6. MediaPipe &#8211; 0.8.5<br \/>\n7. Tqdm &#8211; 4.60.0<\/p>\n<p>We&#8217;ll train a classifier model that will be able to distinguish between real and fake pan cards. We\u2019ll use the <strong>TensorFlow<\/strong> library to build the model. <strong>Tensorflow<\/strong> is a Deep learning Library developed by Google.<\/p>\n<h3>Download Pan Card Fraud Detection Project Code<\/h3>\n<p>Please download the source code of pan card fraud detection with opencv: <a href=\"https:\/\/drive.google.com\/file\/d\/1iU4eBNGdVsX0Mh2suiKnE5GgrW9CR6hL\/view?usp=drive_link\"><strong>Pan Card Fraud Detection Project Code<\/strong><\/a><\/p>\n<h3>Steps to create pan card fraud detection system using python:<\/h3>\n<ul>\n<li>Import necessary packages.<\/li>\n<li>Data preprocessing.<\/li>\n<li>Create our model architecture.<\/li>\n<li>Train the model.<\/li>\n<li>Test the model.<\/li>\n<\/ul>\n<h4>Step 1 &#8211; Import necessary packages :<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Pan card fraud detection- DataFlair\r\nimport os\r\nimport cv2\r\nimport numpy as np\r\nfrom tqdm import tqdm\r\nimport tensorflow as tf\r\nimport matplotlib.pyplot as plt\r\nfrom sklearn.model_selection import train_test_split\r\nfrom tensorflow.keras.models import Sequential\r\nfrom tensorflow.keras.layers import Conv2D, Dense, Flatten, Dropout\r\n<\/pre>\n<ul>\n<li>From TensorFlow, we\u2019ve imported some modules that we\u2019ll be using to build our model architecture.<\/li>\n<\/ul>\n<p><strong>Dense:<\/strong> Dense is a commonly used layer of deep learning. A Dense layer takes all outputs from the previous layer to its all neurons, and then each neuron provides one output to the next layer.<\/p>\n<p><strong>Flatten:<\/strong> Flatten layer reshapes multi-dimensional data to one-dimensional. if a layer is having an input shape of (batch_size, 100,100,3), then the output shape will be (batch_size, 30000).<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/flatten-layer.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-103886 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/flatten-layer.webp\" alt=\"flatten layer for Python pan card fraud detection\" width=\"480\" height=\"597\" \/><\/a><\/p>\n<p><strong>Dropout:<\/strong> Dropout randomly ignores neurons during the training phase. It helps to prevent the overfitting of the model.<\/p>\n<h4>Step 2 &#8211; Data preprocessing :<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">img_size = 100\r\ndatadir = r'images'\t# root data directory\r\nCATEGORIES = os.listdir(datadir)\r\nprint(CATEGORIES)\r\n<\/pre>\n<ul>\n<li>os.listdir() returns a list of all files and directories in the specific given path.<\/li>\n<\/ul>\n<p><strong>Output:-<\/strong><\/p>\n<p>[&#8216;fake&#8217;, &#8216;real&#8217;]<\/p>\n<ul>\n<li>Here we can see that there are two folders in the root data directory. Each folder contains its corresponding data.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Preprocessing Function\r\ndef PreProcess(img_size, path):\r\n    \"\"\"This function reads images from the given folders subfolder\r\n    \tand returns a normalized array along with their respective classes\"\"\"\r\n    x, y = [], []\r\n    CATEGORIES = os.listdir(path)\r\n    print(\"Found {} classes: {}\".format(len(CATEGORIES), CATEGORIES))\r\n    \r\n    for category in CATEGORIES:\r\n    \tpath = os.path.join(datadir, category)\r\n    \tclassIndex = CATEGORIES.index(category)\r\n   \t \r\n    \tfor imgs in tqdm(os.listdir(path)):\r\n        \timg_arr = cv2.imread(os.path.join(path, imgs))\r\n\r\n        \t# resize the image\r\n        \tresized_array = cv2.resize(img_arr, (img_size, img_size))\r\n        \tcv2.imshow(\"images\", resized_array)\r\n        \tcv2.waitKey(1)\r\n        \t# Normalize the image\r\n        \tresized_array = resized_array\/255.0\r\n        \tx.append(resized_array)\r\n        \ty.append(classIndex)\r\n    cv2.destroyAllWindows()\r\n    return x, y, CATEGORIES\r\n<\/pre>\n<ul>\n<li>First, we defined a function that takes target training image size and the root directory as input, and returns processed training feature as x, training label as y, and the class names.<\/li>\n<li>Here all image data and class indexes are collected and then stored in the x and y list respectively.<\/li>\n<li>Tqdm is a loop progress visualizer.<\/li>\n<li>cv2.imread() reads an image from the local path and stores it in memory as a numpy array.<\/li>\n<li>We\u2019ll try to make the model lightweight, so using the cv2.resize() function we reduce the image size to 100&#215;100. Image resizing is an important step because the model accepts the same dimensional image as input.<\/li>\n<li>Deep Learning gives the best accuracy with float32 data type. So we divide the resized image array by 255.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Split the dataset into training and testing\r\nX_train, x_test, Y_train, y_test = train_test_split(x, y, random_state=42)\r\n\r\n# Convert all the list to numpy array\r\nX_train = np.array(X_train)\r\nx_test = np.array(x_test)\r\nY_train = np.array(Y_train)\r\ny_test = np.array(y_test)\r\n<\/pre>\n<ul>\n<li>Using train_test_split, we split the dataset into training and testing. Later we\u2019ll use the testing list to evaluate the model accuracy.<\/li>\n<li>After that, we convert all the lists to a numpy array.<\/li>\n<\/ul>\n<h4>Step 3 &#8211; Create our model architecture:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Build the model\r\nmodel = Sequential()\r\n\r\nmodel.add(Conv2D(16, (3, 3), input_shape=(img_size, img_size, 3),\r\n activation=\"relu\"))\r\nmodel.add(Conv2D(32, (3, 3), strides=2, activation=\"relu\"))\r\nmodel.add(Conv2D(64, (3, 3),  activation=\"relu\"))\r\nmodel.add(Conv2D(8, (3, 3), strides=2, activation=\"relu\"))\r\nmodel.add(Dropout(0.5))\r\nmodel.add(Flatten())\r\nmodel.add(Dense(50, activation='relu'))\r\nmodel.add(Dense(30, activation='relu'))\r\nmodel.add(Dense(2, activation='softmax'))\r\n\r\nmodel.compile(optimizer='adam', loss='sparse_categorical_crossentropy',\r\n metrics=['accuracy'])\r\nmodel.summary()\r\n<\/pre>\n<ul>\n<li>Sequential API is used to build simple model architecture. It is a plain stack of layers where each layer has one input and one output.<\/li>\n<li>Using model.add() we can add layers to our model.<\/li>\n<li>In this model architecture, we have used 4 Convolution layers, 1 Dropout layer, 1 Flatten layer, and 3 Dense layers.<\/li>\n<li>The first convolution layer takes a batch of arrays.<\/li>\n<li>The final Dense layer has 2 outputs. Because we have only two classes.<\/li>\n<li>We have categorical data, that\u2019s why we\u2019ve used \u2018softmax\u2019 activation function in the last layer and \u2018&#8217;sparse_categorical_crossentropy&#8217;\u2019 as the loss function.<\/li>\n<li>Finally, we compile the model using model.compile().<\/li>\n<\/ul>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/ml-model-summary.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103887\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/ml-model-summary.webp\" alt=\"ml model summary\" width=\"1920\" height=\"936\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/ml-model-summary.webp 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/ml-model-summary-768x374.webp 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/ml-model-summary-1536x749.webp 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>Step 4 &#8211; Train the model:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">history = model.fit(X_train, Y_train, batch_size = 2, epochs=15, verbose=1)\r\n<\/pre>\n<ul>\n<li>Finally, we start the training using model.fit().<\/li>\n<li>Here we take a batch size of 2. This means 2 images will be fed into the model at the same time.<\/li>\n<li>Epochs is a hyperparameter that defines the number of times the model will work through the dataset.<\/li>\n<\/ul>\n<p>Now we\u2019ll plot the accuracy and loss overtime in each loop. We\u2019ll use matplotlib to plot the accuracy and loss.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/history.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103888\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/history.webp\" alt=\"history\" width=\"1920\" height=\"936\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/history.webp 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/history-768x374.webp 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/history-1536x749.webp 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>Step 5 &#8211; Test the model:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">validation_loss, validation_accuracy = model.evaluate(X_test, y_test)\r\n<\/pre>\n<p><strong>Output:<\/strong> [0.3114681839942932, 0.8571428656578064]<\/p>\n<ul>\n<li>The first item represents a loss of the test dataset and the 2nd item represents the accuracy of the test dataset.<\/li>\n<\/ul>\n<p>Here we can see that the model has over 85% accuracy in the test dataset.<\/p>\n<p>Now let\u2019s predict from images directly.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># load images\r\nimg_real = cv2.cvtColor(cv2.imread('cards\/real.jpg'), cv2.COLOR_BGR2RGB)\r\nimg_fake = cv2.cvtColor(cv2.imread('cards\/fake.jpg'), cv2.COLOR_BGR2RGB)\r\nreal = np.expand_dims(cv2.resize(img_real, (img_size, img_size)), axis=0)\/255.0\r\nfake = np.expand_dims(cv2.resize(img_fake, (img_size, img_size)), axis=0)\/255.0\r\n\r\n<\/pre>\n<ul>\n<li>We need to process the image exactly the same way as the training images.<\/li>\n<li>Using np.expand_dims we expand the image dimension. Suppose the image has a shape of (100, 100, 3), after applying np.expand_dims the image shape will be (1, 100, 100, 3)\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">fig, (ax1, ax2) = plt.subplots(1, 2)\r\nax1.imshow(img_real)\r\nax1.set_title(\"Real\")\r\nax2.imshow(img_fake)\r\nax2.set_title('Fake')\r\n<\/pre>\n<\/li>\n<li>In this part, we just show the images and their corresponding ground truth labels.\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Predict from a image\r\npred1 = model.predict(real)\r\npred2 = model.predict(fake)\r\nCATEGORIES[np.argmax(pred1)], CATEGORIES[np.argmax(pred2)]\r\n<\/pre>\n<\/li>\n<\/ul>\n<p><strong>Output<\/strong>:<\/p>\n<p>(&#8216;real&#8217;, &#8216;fake&#8217;)<\/p>\n<ul>\n<li>Using model.predict we can predict the output from an image.<\/li>\n<li>In the output, we can see that our model has successfully predicted whether the pan cards are real or fake.\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Export the model\r\nmodel.save(\"pan-card-fraud-detection-DataFlair.h5\")\r\n<\/pre>\n<\/li>\n<li>Finally, we export the model using model.save() and save it in h5 format.<\/li>\n<\/ul>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/pan-card-prediction.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-103889 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/pan-card-prediction.webp\" alt=\"python pan card fraud detection\" width=\"1920\" height=\"936\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/pan-card-prediction.webp 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/pan-card-prediction-768x374.webp 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/pan-card-prediction-1536x749.webp 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/h3>\n<h3>Summary:<\/h3>\n<p>In this project, we\u2019ve built pan card fraud detection using Python Deep learning. We\u2019ve used Tensorflow- sequential API to build the model architecture and OpenCV for other image processing techniques. Through this project, we\u2019ve learned to build our own image classifier using deep learning. Using the same model architecture we can create a classifier that can predict more than 2 classes.<\/p>\n<p>This project is important for banks, verification systems, and digital KYC. It teaches learners how to work with document images, extract data, and apply validation. You will understand real-world fraud patterns, text extraction, and data security. It\u2019s a powerful project that blends OpenCV, OCR, and Python for social and industrial applications.<\/p>\n<p>Note: This project is only for educational purposes. Pan card fraud detection is a very complex problem and it cannot be solved by just using computer vision or deep learning. Nowadays fake pan cards look exactly like the original ones. So, to properly distinguish between real or fake pan cards, government verification is needed.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:2536,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1iU4eBNGdVsX0Mh2suiKnE5GgrW9CR6hL\\\/view?usp=drive_link&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20260601065614\\\/https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1iU4eBNGdVsX0Mh2suiKnE5GgrW9CR6hL\\\/view?usp=drive_link&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-06-02 06:49:35&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-09 10:50:13&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-14 07:50:36&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-18 07:32:11&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-18 07:32:11&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nowadays frauds are everywhere. From cyber technology to legal documents, everywhere is fraud. So here, we\u2019re going to build a pan card fraud detection project using Computer Vision with OpenCV &#8211; Python and Deep&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":103882,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[20697,25733,25735,25734,25732,25729],"class_list":["post-101003","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-machine-learning-project","tag-pan-card-fraud-detection","tag-pan-card-fraud-detection-machine-learning","tag-pan-card-fraud-detection-opencv","tag-pan-card-fraud-detection-python","tag-python-opencv-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pan Card Fraud Detection using Python &amp; OpenCV - DataFlair<\/title>\n<meta name=\"description\" content=\"Build pan card fraud detection using Python OpenCV &amp; Tensorflow- sequential API for image processing techniques.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pan Card Fraud Detection using Python &amp; OpenCV - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Build pan card fraud detection using Python OpenCV &amp; Tensorflow- sequential API for image processing techniques.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-27T04:20:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-01T06:56:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/pan-card-fraud-detection-python-opencv.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pan Card Fraud Detection using Python &amp; OpenCV - DataFlair","description":"Build pan card fraud detection using Python OpenCV & Tensorflow- sequential API for image processing techniques.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/","og_locale":"en_US","og_type":"article","og_title":"Pan Card Fraud Detection using Python &amp; OpenCV - DataFlair","og_description":"Build pan card fraud detection using Python OpenCV & Tensorflow- sequential API for image processing techniques.","og_url":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-10-27T04:20:16+00:00","article_modified_time":"2026-06-01T06:56:00+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/pan-card-fraud-detection-python-opencv.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Pan Card Fraud Detection using Python &amp; OpenCV","datePublished":"2021-10-27T04:20:16+00:00","dateModified":"2026-06-01T06:56:00+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/"},"wordCount":1209,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/pan-card-fraud-detection-python-opencv.webp","keywords":["machine learning project","pan card fraud detection","pan card fraud detection machine learning","pan card fraud detection opencv","pan card fraud detection python","python opencv project"],"articleSection":["Machine Learning Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/","url":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/","name":"Pan Card Fraud Detection using Python &amp; OpenCV - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/pan-card-fraud-detection-python-opencv.webp","datePublished":"2021-10-27T04:20:16+00:00","dateModified":"2026-06-01T06:56:00+00:00","description":"Build pan card fraud detection using Python OpenCV & Tensorflow- sequential API for image processing techniques.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/pan-card-fraud-detection-python-opencv.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/09\/pan-card-fraud-detection-python-opencv.webp","width":1200,"height":628,"caption":"pan card fraud detection python opencv"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/pan-card-fraud-detection-python-opencv\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Machine Learning Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/machine-learning\/"},{"@type":"ListItem","position":3,"name":"Pan Card Fraud Detection using Python &amp; OpenCV"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/101003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=101003"}],"version-history":[{"count":9,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/101003\/revisions"}],"predecessor-version":[{"id":148610,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/101003\/revisions\/148610"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/103882"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=101003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=101003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=101003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}