Train Ticket OCR
This article shows you how to build an OCR API that extracts data from train tickets (or eTickets) using our deep learning engine. It will work for any train ticket format or template, paper or digital. Improve your workflow by extracting data directly from your train ticket documents.
- You’ll need a free beta account. Sign up and confirm your email to login.
- You’ll need at least 20 train ticket images or PDFs to train your OCR.
Define your Train Ticket use case
First, we’re going to define the fields we'd like to extract from our train tickets.
- Passenger name: The full name of the passenger traveling (Jane Martin)
- Reservation number: The reservation number of your train ticket (925D90)
- Departure Date: The date of departure
- Departure station code: The 3 letters identification code for your departure station (WAS)
- Arrival station code: The 3 letters identification code for your arrival station (NYP)
- Departure Time: The train departure time from the departure station (01:50 PM)
That’s it for our use case. Feel free to add any other relevant data to fit your requirements.
Deploy your API
Once you have defined all of the fields you want to extract, head over to the platform and press the ‘build a new endpoint’ button.
You now land on the setup page. Here is the image you can use for setting up the API, and my setup looks like this:
Once you’re ready, click on the “next step” button. We are going to specify the data types for each of the fields we want our API to extract.
To go further, you can download this json config to automatically set up your data model by pressing the Upload a json config button or by building it manually.
Passenger name: String type that never contains numeric characters.
Reservation number: String type without specifications.
Departure Date: Date type as String without specifications.
Departure Station Code: String type that never contains numeric characters.
Arrival Station Code: type String that never contains numeric characters.
Departure Time: type String without specifications.
Once you’re done setting up your data model, press the Data model ready? Deploy your API button at the top of the screen.
Train your Boarding Pass OCR
You’re all set!
Now is the time to train your train ticket deep learning model in the Training section of your API.
In a few hours (minutes if you're swift), you’ll get your first model trained and will be able to use your custom OCR API for parsing train tickets in your application.
To get more information about the training phase, please refer to the Getting Started tutorial.
If you have any questions regarding your use case, feel free to reach out on the Mindee Community on Slack!