license:bigscience-openrail-m region:us
---
license: bigscience-openrail-m
metrics:
- accuracy
---


# Document Classification with LayoutLM

This repository contains code for a document classification project using the LayoutLM model. The goal of this project is to accurately classify various types of documents, such as birth certificates, driving licenses, social security numbers, and tax documents, using layout-aware deep learning techniques.

## Table of Contents

- [Introduction](#introduction)
- [Features](#features)
- [Getting Started](#getting-started)
  - [Prerequisites](#prerequisites)
  - [Installation](#installation)
- [Usage](#usage)
- [Data Preprocessing](#data-preprocessing)
- [Training](#training)
- [Evaluation](#evaluation)
- [Model Inference](#model-inference)
- [Contributing](#contributing)
- [License](#license)

## Introduction

Document classification is a crucial task in various domains, including legal, finance, and healthcare. This project leverages the LayoutLM model, which is designed to understand the content and structure of documents by considering both text and bounding box information. With this model, we achieved an impressive accuracy of 89% on our test dataset.

## Features

- Document classification using LayoutLM.
- Data preprocessing scripts for handling text and bounding box information.
- Training pipeline for fine-tuning the LayoutLM model.
- Evaluation scripts to measure model performance.
- Model inference code for classifying new documents.

## Getting Started

### Prerequisites

Before running the code, make sure you have the following prerequisites installed:

- Python 3.x
- PyTorch
- Transformers library by Hugging Face
- Datasets library by Hugging Face

### Installation

1. Clone this repository to your local machine:

   ```bash
   git clone https://github.com/atulpokharel-gp/Document-Classification-using-LayoutLM
   cd Document-Classification-using-LayoutLM
