Python学习
1nsights
这个作者很懒,什么都没留下…
展开
-
libstdc++.so.6: version `GLIBCXX_3.4.30‘ not found
glibcxx-3-4-30-not-found-for-librosa-in-conda-virtual-environment原创 2022-07-01 10:05:24 · 5598 阅读 · 4 评论 -
解决IndexError: too many indices for tensor of dimension 3
如果不小心搞错了tensor的维度,就会出现以下错误> IndexError: too many indices for tensor of dimension 3很有可能是你是一个三维的tensor,但是你在调用索引时使用了第四维的索引作切片,这时应该检查是不是因为粗心而导致tensor的维度出错例如:x = torch.randn(1, 2, 3)x[0, 0, 0, 0]这样就会报 IndexError: too many indices for tensor of dimen原创 2022-03-02 21:44:58 · 15445 阅读 · 0 评论 -
ModuleNotFoundError: No module named ‘absl‘
安装absl-pypip install absl-py原创 2022-03-01 20:03:08 · 2246 阅读 · 0 评论 -
ERROR: No matching distribution found for grpc
报错ERROR: No matching distribution found for grpc安装conda install -c conda-forge grpcio或者pip install grpcio原创 2022-03-01 19:59:15 · 1485 阅读 · 0 评论 -
ModuleNotFoundError: No module named ‘past‘
File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\torch\utils\tensorboard\__init__.py", line 6, in <module> from .writer import FileWriter, SummaryWriter # noqa F401 File "C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\torch..原创 2022-03-01 17:43:02 · 1591 阅读 · 0 评论 -
CycleGAN Pytorch code
网络效果网络结构这部分主要参考:https://github.com/aladdinpersson/Machine-Learning-Collection/tree/master/ML/Pytorch/GANs/CycleGANGeneratorimport torchimport torch.nn as nnclass ConvBlock(nn.Module): def __init__(self, in_channels, out_channels, down=True, use原创 2022-02-23 14:58:50 · 423 阅读 · 0 评论 -
安装ClearMap2
https://www.yuque.com/duzh929/blog/hit6s8原创 2021-10-21 21:12:03 · 320 阅读 · 0 评论 -
Pycharm实用设置
文章目录Pycharm preference0、配置虚拟环境1、设置背景色2、matplotlib图像自动弹出3、在console里运行程序4、在同一个console里运行程序Pycharm preference0、配置虚拟环境个人喜欢不同的项目在不同的虚拟环境下运行,Anaconda用来管理包,Pycharm用来码代码。1、设置背景色个人觉得比较舒适的背景色:米黄色十六进制编号:F7EED6淡绿色:E1F4E42、matplotlib图像自动弹出内嵌到pycharm里不大方便查原创 2021-05-07 19:22:05 · 387 阅读 · 0 评论 -
灰度最邻近的K个邻点平均法(Python实现)
基本原理编程实现导入相应的库文件%matplotlib inlineimport numpy as npimport matplotlib.pyplot as pltimport skimage.util as utilfrom skimage import data, img_as_floatfrom skimage.metrics import structural_similarity as ssimfrom skimage.metrics import mean_squared_原创 2020-12-29 10:08:29 · 1274 阅读 · 4 评论 -
绘制色调、饱和度渐变排列的图像(利用Python实现)
数字图像处理作业1绘制色调、饱和度渐变排列的图像(利用Python实现)作业的思路:绘制色调、饱和度渐变排列的图像 —> 随着图像像素坐标的变换,色调的值、饱和度的值按一定规律变化即可 —> 利用循环,随着像素坐标变化,赋予不同的色调,饱和度的值PIL的ImageDraw模块中的point函数可以对图像单个像素赋予hsl形式的值,使用的格式为:ImageDraw.point(xy, fill=None)其中xy是表示坐标的元组,fill是填充的颜色我们需要利用色调和饱和度的信息原创 2020-12-10 21:24:53 · 2253 阅读 · 0 评论 -
Python形态学处理
主要是利用scikit-image进行形态学操作产生结构元素结构元素的类型有:square, rectangle, diamond, disk, cube,octahedron, ball, octagon, starimport skimage.morphology as mpgse = mpg.disk(5)结构元素官网说明原创 2020-12-09 20:37:29 · 730 阅读 · 0 评论 -
个人Numpy操作合集
创建1×1×3的三维数组delta_zz = np.array([[[1]],[[-2]],[[1]]])原创 2020-10-31 10:03:45 · 104 阅读 · 0 评论 -
Python和MATLAB读取和写入multi-tiff 格式图片(tiff堆栈图)
读取multi-tiff图像cv2from skimage import ioim = io.imread('an_image.tif')imread函数直接将图像加载到numpy数组中。此外,结果数组的尺寸是按顺序排列的(z,y,x),其中z代表深度,y代表高度,x代表宽度。因此,要从堆栈中获取单个切片scikit-imageimport cv2im,mat = cv2.imreadmulti(tif_file_path)...原创 2020-10-29 08:59:29 · 2007 阅读 · 0 评论 -
Jupyter Notebook 文件默认目录的查看以及更改
https://blog.csdn.net/nico2333/article/details/84186063转载 2020-09-26 12:02:42 · 291 阅读 · 0 评论 -
个人 conda常用命令
创建虚拟环境conda create -n env_name python=3.7删除虚拟环境conda remove -n env_name --all激活虚拟环境conda activate env_name查看虚拟环境中安装了哪些packageconda list更改虚拟环境名称在windows上直接改envs目录下的环境名称可以参考博客1、https://zhuanlan.zhihu.com/p/947449292、https://blog.csdn.net/tsq2原创 2020-09-26 11:47:29 · 115 阅读 · 0 评论 -
anaconda python安装tifffile库
打开anaconda Prompt,输入以下命令中的一行:conda install -c conda-forge tifffileconda install -c conda-forge/label/gcc7 tifffileconda install -c conda-forge/label/cf201901 tifffileconda install -c conda-forge/label/cf202003 tifffile如果出现以下情况:Python装包报错:无法定位程序输入点OPE原创 2020-06-29 14:37:47 · 2824 阅读 · 0 评论 -
python类的创建和使用
Python是一种面向对象编程的语言,使用类可以模拟使用情景。由于很多成熟的项目中都大量的使用类,希望通过一些实例,对类的概念有一些基本的了解。简介类中有两个重要的概念,属性(attribute)和方法(method)属性是与对象绑定的一组数据,可以只读,只写,或者读写,使用时不加括号方法是与属性绑定的一组函数,需要使用括号,作用于对象本身创建一个restaurant类在Python中,大家约定俗成:首字母大写的名称是类,下面定义了一个Restaurant类class Restaurant()原创 2020-08-26 13:07:43 · 270 阅读 · 0 评论