You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# randomly select a few testing characters
for i in np.random.choice(np.arange(0, len(testY)), size=(49,)):
# classify the character
probs = model.predict(testX[np.newaxis, i])
prediction = probs.argmax(axis=1)
label = labelNames[prediction[0]]
# extract the image from the test data and initialize the text
# label color as green (correct)
image = (testX[i] * 255).astype("uint8")
color = (0, 255, 0)
# otherwise, the class label prediction is incorrect
if prediction[0] != np.argmax(testY[i]):
color = (0, 0, 255)
# merge the channels into one image, resize the image from 32x32
# to 96x96 so we can better see it and then draw the predicted
# label on the image
image = cv2.merge([image] * 3)
image = cv2.resize(image, (96, 96), interpolation=cv2.INTER_LINEAR)
cv2.putText(image, label, (5, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.75,
color, 2)
# add the image to our list of output images
images.append(image)
It should be:
# randomly select a few testing characters
for i in np.random.choice(np.arange(0, len(testY)), size=(49,)):
# classify the character
probs = model.predict(testX[np.newaxis, i])
prediction = probs.argmax(axis=1)
label = labelNames[prediction[0]]
# extract the image from the test data and initialize the text
# label color as green (correct)
image = (testX[i] * 255).astype("uint8")
color = (0, 255, 0)
# otherwise, the class label prediction is incorrect
if prediction[0] != np.argmax(testY[i]):
color = (0, 0, 255)
# merge the channels into one image, resize the image from 32x32
# to 96x96 so we can better see it and then draw the predicted
# label on the image
image = cv2.merge([image] * 3)
image = cv2.resize(image, (96, 96), interpolation=cv2.INTER_LINEAR)
cv2.putText(image, label, (5, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.75,
color, 2)
# add the image to our list of output images
images.append(image)
The text was updated successfully, but these errors were encountered:
leonsery
changed the title
Another identetion bug in train_model.py
Another indentation bug in train_model.py
Aug 26, 2021
Identation mistake. Instead of:
It should be:
The text was updated successfully, but these errors were encountered: