
Python
文章平均质量分 69
留在风中的巧克力
收获,分享
展开
-
python图像处理常用方法以及可能会遇到的问题
1.图片打开与显示默认导入名称import cv2from PIL import Imageimport matplotlib.pyplot as pltimport matplotlib.image as mpimg问题1、cv2读取的图像用plt.imshow显示时颜色不一致。原理及解决方案cv2.imread(‘图片位置’) 所读取的图像格式:每个像素为[B,G,R]的形式,通道值默认范围0-255。# 可以用cvtColor()函数转换:img原创 2022-03-15 20:09:50 · 591 阅读 · 0 评论 -
Python常用知识点/面试题(装饰器、*args,**kwargs、lambda函数)
python常用知识点原创 2021-05-04 21:08:57 · 174 阅读 · 0 评论 -
通过CNN 分类 Fashion MNIST 图像(内含实现代码)
编译环境 Anaconda3, python3.7.9, tensorFlow2.3.1Fashion MNIST数据集,包含70000个灰度图像分类。我们将使用60000张图片进行培训,10000张图片用于评估#导入相关的库from __future__ import absolute_import, division, print_functionimport tensorflow as tfimport tensorflow_datasets as tfdstf.compat.v1原创 2020-11-30 15:36:24 · 1851 阅读 · 0 评论 -
Anaconda下的清华镜像添加、Tensorflow2.3安装以及pip&conda基本命令
安装Anaconda之后,添加清华镜像:打开Anaconda prompt,输入命令: conda config --set show_channel_urls yes在C:\Users\administer目录下生成**.condarc** 文件(Windows用户)打开.condarc 文件修改:channels:defaults show_channel_urls: true channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anac原创 2020-11-20 21:58:15 · 4596 阅读 · 0 评论 -
用python实现图片批量重命名
这里图片都是.jpg格式的,可以根据需要做相应修改import osclass BatchRename(): def __init__(self): self.path = r'D:\imagesRename' #图片的路径 def rename(self): filelist = os.listdir(self.path) filelist.sort() total_num = len(filelist)原创 2020-11-20 02:00:24 · 893 阅读 · 2 评论 -
用python实现图片批量剪切(像素)
用python实现图片批量修改像素:from PIL import Imagefrom glob import globimport osclass BatchCut(object): def __init__(self, width, height): self.imgPath = r'D:\imagesCut\*.jpg' #要修改图片的 self.width = width self.height = width self.savePath = r'D:\\imagesCu原创 2020-11-20 01:55:04 · 1466 阅读 · 0 评论 -
AttributeError: module ‘tensorflow‘ has no attribute ‘enable_eager_execution‘
AttributeError: module ‘tensorflow’ has no attribute 'enable_eager_execution’Tensorflow 2.0在默认情况下启用了eager_执行,因此不需要运行tf.enable_eager_执行. 只有在运行的版本低于2.0时,才应该启用立即执行.把tf.enable_eager_execution()删去就好。...转载 2020-11-15 00:40:53 · 4808 阅读 · 0 评论