pdoublerainbow / bisenet-tensorflow

A re-implement of bisenet by tensorflow
MIT License
30 stars 17 forks source link

Google Colab usging plt "Error dtype=float32 is not a valid value for name" #10

Open HienTran1997 opened 4 years ago

HienTran1997 commented 4 years ago

- I'm running on predict.py on colab (because i don't have GPU), colab cannot run the cv2.imshow() so i change the code like that: plt.imshow('Image', predict)

cv2.waitKey(0)

    plt.imsave('./example/1.png', predict)
HienTran1997 commented 4 years ago

Ok I Just find the way to fix this predict.py on google colab Step1: Just choose the Tensorflow 1.x %tensorflow_version 1.x Step 2: Edit code on predict.py like that (because colab cannot use cv2.imshow) from matplotlib import pyplot as plt

predict = sess.run(predict, feed_dict={model.images_feed: img}) predict = cv2.cvtColor(predict, cv2.COLOR_RGB2BGR) max=np.max(predict) final=predict/max plt.title("Image") plt.imshow(final)

cv2.waitKey(0)

    plt.imsave('./example/1.png', final)