Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from PIL import Image
- from tensorflow import keras
- import tensorflow as tf
- def format_y(y):
- return ''.join(map(lambda x: chr(int(x)), y))
- im = Image.open('./image_data/4.jpg')
- images = []
- image = np.array(im) / 255.0
- images.append(np.array(image))
- images = np.array(images)
- model = keras.models.load_model('./captcha_model_keras_90.h5')
- # image = model.predict_on_batch(images)
- y_pred = model.predict(images)
- y_pred = tf.math.argmax(y_pred, axis=-1)
- captcha = format_y(y_pred[0])
- print(captcha)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement