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. 




  1. You’ll need a free account. Sign up and confirm your email to login.
  2. 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. 



Train ticket OCR API



  • 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 ‘create a new API’ 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:



Set up your Train Ticket OCR API


Once you’re ready, click on the “next” 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.


define your model train ticket ocr



Passenger name: String type that never contains numeric characters.


Passenger name field for train ticket OCR



Reservation number: String type without specifications. 


Reservation number field for train ticket OCR



Departure Date: Date type with US format.


Departure date field for train ticket OCR



Departure Station Code: String type that never contains numeric characters.


Departure station code field for train ticket OCR


Arrival Station Code: type String that never contains numeric characters.


Arrival station code field for train ticket OCR



Departure Time: type String without specifications.


departure time field for train ticket OCR



Once you’re done setting up your data model, press the Start training your model button at the bottom of the screen.


trai ticket ocr



Train your Boarding Pass OCR



Deep learning train ticket OCR training



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 chat!