- 错误[Could not load dynamic library cudart64_101.dll]
我的cudart是在anaconda中安装的,他没有在pycharm的环境中。pycharm中点击run->Edit Configurations,在Environment variables添加自己CUDA安装的位置。添加后就成功了。
-
from matplotlib import pyplot as plt
报错:ImportError: cannot import name ‘ft2font’ from partially initialized module ‘matplotlib’ (most likely due to a circular import)
不知道错误怎么改,网上也没找到教程,尝试了matplotlib3.1和3.2都报错。但是我改用python3.6之后运行没问题。 -
mnist数据集下载失败
参考:https://blog.youkuaiyun.com/qq_34840129/article/details/86436162?utm_medium=distribute.pc_relevant.none-task-blog-title-3&spm=1001.2101.3001.4242
手动下载
但是在python3.7中,同样的语句mnist又可以下载成功了。玄学。
清华的数据包https://pypi.tuna.tsinghua.edu.cn/simple/ -
记录一些用过的函数
# 读取图片
image = tf.io.read_file('datasets/2.jpg')
# 解码
image = tf.image.decode_jpeg(image)
# 转成灰度。转成灰度的话最后保存的时候整张图片是黑色的不知道为什么
# image = tf.image.rgb_to_grayscale(image)
# 裁剪
# image = tf.image.resize_with_crop_or_pad(image, 28, 28)
# 图片质量?
# image = tf.image.adjust_jpeg_quality(image, (30))
# 像素转换
image = tf.image.resize(image, (50, 50)).numpy()
print('像素后:',image)
# 编码
image = tf.image.encode_jpeg(image)
print(image)
# 保存图片
with tf.io.gfile.GFile('datasets/22.jpg', 'wb') as file:
file.write(image.numpy())
图片数据集读取https://blog.youkuaiyun.com/zhou_438/article/details/103321871?utm_medium=distribute.pc_relevant.none-task-blog-title-2&spm=1001.2101.3001.4242