Created
May 18, 2020 16:56
-
-
Save hzitoun/f12a9ada18394be271fa849d3a0c2568 to your computer and use it in GitHub Desktop.
Source code for medium story šServe a TensorFlow 2 Deep Learning Image Classifier as a REST API and Dockerize it! (with GPUĀ support)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test_image = read_image("../data/raw/test/82_automobile.png", image_size) | |
plt.imshow(test_image) | |
plt.title('test image') | |
plt.show() | |
pred_softmax = model.predict(test_image.reshape(1, image_size[0], image_size[1], 3)) | |
pred_class_index = np.argmax(pred_softmax, axis=1) | |
target_names = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck'] | |
print("CNN sees", target_names[pred_class_index.item()]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment