January 2019
Intermediate to advanced
342 pages
9h 17m
English
The trained GAN network can be loaded at run time to generate street view housing numbers like CAPTCHA for use. The generate_captcha function can be used to generate CAPTCHAs for use, illustrated as follows:
def generate_captcha(gen_input_dim,alpha, num_images,model_dir,outdir): g = generator(gen_input_dim,alpha) g.load_weights(model_dir + 'generator') noise = np.random.normal(loc=0, scale=1, size=(num_images,gen_input_dim)) generated_images = g.predict(noise, verbose=1) for i in range(num_images): img = generated_images[i,:] img = np.uint8(((img+1)/2)*255) img = Image.fromarray(img) img.save(outdir + 'captcha_' + str(i) + '.png')
You may be wondering how it is possible to have the ...
Read now
Unlock full access