Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due
IMSE7140 Assignment 2
Cracking CAPTCHAs
(20 points)
2.1 Brief Introduction
because of its popularity in preventing bot attacks or spam everywhere. This assignment, however, will guide you in implementing a deep learning model that can crack a commercial-level captcha!
You deliverables for this assignment should include
Of course, GPUs can facilitate your experiments—Don’t worry if you don’t have any, the training requirement is deliberately simplified.
2.2 Training your model
The captchas we will crack is the multicolorcaptcha. Please pip install the exact version 1.2.0 (the current latest one) in case there might be any incompatibility for other releases.
In this snippet, CaptchaGenerator(0) configures the image size to 256 × 144 pixels, and the difficult level is set to 0 so that the captchas only contains four 0–9 digits.
Please run the code snippet on your computer. If the captcha is successfully generated, it should look like Figure 2.1.
The training and the validation datasets are generated and attached in folders capts train and capts val. For any machine learning problem, before you start to devise a solution, it is always a good idea to observe the data and gain some intuition first. You may immediately recognize some difficulties in this task:
• The digits have a set of random fonts and colors;• Some certain range of random rotations are applied to the digits;• Some line segments are randomly added to the image.
Such a task is considered impossible for traditional pattern recognition methods, which may tackle the problem in a process like this: image thresholding, segmentation, handcrafted filter design, and pattern matching. We can conjecture that “filter design” may fail in capturing useful features and “pattern matching” may have a poor performance.
Fortunately, in the deep learning era, we can delegate the pattern or feature extraction job to deep neural networks. As introduced in the previous lecture “Deep Learning for Computer Vision,” the slide “Understand feature maps: CAPTCHA recognition” shows that a typical architecture for the task consists of two parts:
1. A backbone model to extract a feature map from the captcha image, and2. A certain amount of prediction heads to interpret the feature map to readable forms.
We will follow this architecture in this assignment. I encourage you to search opensource solutions and learn from their experience. Here we follow this Kaggle post by Ashadullah Shawon.
PT| Use capts train as the training dataset, capts val as the validation dataset, and Keras as the deep learning framework, referring to Shawon’s solution, provide the training code train.py that fulfills the following requirements. “Copy and paste” the codes from the original post is allowed, as well as other AI-generated codes.
3. The trained model should be saved as a file my model.keras after training. Though, this model file my model.keras doesn’t need to be uploaded.
2.3 Example: A practical model
Q10| Since the accuracy for one digit is about 99%, the overall accuracy for a captcha is 0.994 ≈ 96%. This performance would be better than humans. Can you propose some methods that can even further improve the performance?
Please note that, not all the questions above have a definite answer. You may also need to do some research as the course doesn’t cover all the details in class. The source code for training this model and the reference answers will be available on Moodle or sent by email after all the students completing the submission.