【发布时间】:2021-12-26 22:46:12
【问题描述】:
所以这是用 ML 制作的数字识别器..
所以我收到了这个错误,我的程序在发出这个命令后就退出了。
尝试安装 tensorflow-cpu 和通常的 tensorflow..
我有一个 AMD GPU 和一个 Core i5-10th Gen CPU
2021-11-16 18:53:54.873365: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
另外我已经保存了模型,代码如下:
model = tf.keras.models.load_model('handwritten.model')
image_number = 1
while os.path.isfile(f'Image\\Digits{image_number}.png'):
try:
img = cv2.imread(f'Image\\Digits{image_number}.png')[:,:,0]
img = np.invert(np.array([img]))
prediction = model.predict(img)
speak(f"This Digit is Probably a {np.argmax(prediction)}")
plt.imshow(img[0], cmap=plt.cm.binary)
except:
speak("Error!")
finally:
image_number += 1
【问题讨论】:
标签: python tensorflow machine-learning computer-vision cv2