Created
January 28, 2021 09:09
Digit prediction with a pretrained model
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
roi = cv2.resize(digit_image, (28, 28)) | |
roi = roi.astype("float") / 255.0 | |
roi = img_to_array(roi) | |
roi = np.expand_dims(roi, axis=0) | |
preds = self.model.predict(roi) | |
for c in self.exclude_classes: | |
preds[0][c] = 0 | |
return preds.argmax(axis=1)[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment