12306 CAPTCHA Recognition

Heqing Ya, Haonan Sun

Background

12306.cn is the ticketing website for China National Railway.

Since there are 1.2 billion people in China, and railway is the best traveling choice for most people due to low price and convenience. Thus, the tickets become kind of scarce resources especially during national vacations, such as Spring Festival: billions of people go home across the country to meet their family.

Scalpers could use low latency network and image recognition methods to get the tickets as soon as they were released, and resell for a profit.

To avoid this, 12306 has established a special kind of CAPTCHA to prevent automatic queries from scalpers.

Problem

The goal is to use unsupervised methods to break the CAPTCHA by picking out the images of the target category.

Image Description

Two CAPTCHAs are shown below:

It consists of two parts:

Each time it randomly shows 8 images, and ask users to click all the images of a certain category, like "road", "car", "potato", etc.

Input

CAPTCHA image.

Output

The positions of all target images.

Constraint

Running time: 1s

Accuracy: Over 50%

Preliminary Study

I have downloaded about 100, 000 CAPTCHAs from the website, which contains 800, 000 sub-images.

Importance

CAPTCHA is critical for online systems to avoid brute force attack. Breaking this kind of CAPTCHAs not only provide ideas on how to produce more reliable CAPTCHAs, but also offer some new thoughts on application of computer vision, machine learning, data mining on large dataset. In addition, this is also a good programming practice for cloud computing.

Algorithm Flow

Model Construction

  1. Estimate the total number of images
  2. Collect enough CAPTCHAs to construct image-image and image-label graphical models
  3. Construct graph model with cooccurrence information and features of the images.
  4. Cluster images and labels according to the graph.

CAPTCHA Recognition

  1. Match the new CAPTCHA with clustered and labeled images and labels in the database.

Plan

  1. Gathering Data (End of April)

    Download 20 million CAPTACHAs to form the dataset. Collect basic statistics of the dataset, including total number of unique images and labels, the (possible) distribution of how the images appear.

  2. Construct Graphical Model and Cluster (End of June)

    According to the cooccurrence information and the image similarity, construct a graph model that describes the closeness among images. Do clustering on this graph model.

  3. Coding (End of July)

    Fist, implement a single-thread version that runs on small dataset to validate the correctness and effectiveness. Then, parallelize the algorithm and run it on the whole training set.

  4. Run Clustering and Parameter Tuning (End of August)

    Tune parameters based on the performance, and find the best combination of parameters.

  5. Class-Label OCR (End of September)

    Class-Labels are twisted Chinese characters in the CAPTCHAs, so we need to convert them into semantic labels, and connect them to the images.

  6. Collect Experiment Data (End of October)

    In this stage, we need to run our model on the test set, and get the final result.

  7. Writing Report (End of November)

System Design

Distributed Spider

Repeat
    1. Get CAPTCHAs and break into images
    2. Calculate hash values
    3. Query all images with same hash values from DB
    4. Compare current image with the recorded image from DB
    5. Add weight to Edges into DB
End

Clustering

Set a threshold of weight to eliminate the edges and form clusters.

Database

Graph database.

Materials

Slides Download