November 2019
Intermediate to advanced
346 pages
9h 36m
English
Having completed our preprocessing of CAPTCHAs in the previous recipe, we are now ready to utilize these to train a CAPTCHA breaker. We start by setting a variable to the path of all of our individual characters extracted from CAPTCHAs. We import the image manipulation libraries we will be using (step 2) and then define a function to resize an image in step 3. This is a relatively standard method for character recognition, which allows training to proceed faster, and memory utilization to be reduced. In step 4, we define a convenience function to read in files as NumPy arrays, for training purposes, and then, in step 5, we iterate through all the letters and record their labels. Next, we normalize all of the images (step 6