判断是否为图像文件

def is_image_file(fileName): ls = [fileName.endswith(extension) for extension in ['.jpg', '.png', '.jpeg']] print(ls) print(any(ls))fileName = '01.jpg'is_image_file(fileName)
分类: 其他 发布时间: 03-31 10:03 阅读次数: 0

pytorch中pixelshuffle的具体操作方式

分类: 其他 发布时间: 03-31 10:03 阅读次数: 0

torch.autograd.variable()实例用法

import numpy as npimport torchimport torch.nndatas = np.array([[1, 2], [3, 4]])labels = np.array([[2, 3], [4, 5]])loss_fn = torch.nn.MSELoss()input = torch.autograd.Variable(torch.from_numpy(datas).float(), requires_grad=True)target = torch.autog.
分类: 其他 发布时间: 03-31 10:03 阅读次数: 0

pytorch image to tensor

from PIL import Imageimport os.path as ospimport osfrom torchvision.transforms import ToTensortest_path = '../dataset/BSD500/images/test'images_ls = os.listdir(test_path)images_all_path = []for image in images_ls: s_images_path = osp.join(test_.
分类: 其他 发布时间: 03-31 10:03 阅读次数: 0

python Image.convert()中YCbCr模式解析

YCbCr颜色空间及与RGB的变换关系
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

jupyter notebook 使用新环境无法连接,终端报错[W 20:14:43.988 NotebookApp] KernelRestarter: restart failed

jupyter notebook 显示无法连接(无法运行程序):终端报错:解决方法如下:1、在cmd终端输入:pip install --upgrade ipykernel
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

tensorflow1.15.0(1.x最新版本)and tensorflow1.15.0-gpu下载与安装详细过程

一、创建虚拟环境见博客:python创建虚拟环境(一):使用conda创建虚拟环境python创建虚拟环境(二):使用终端命令创建虚拟环境python创建虚拟环境(三):用pycharm创建虚拟环境and使用二、下载tensorflow1.15.0按照一中方法我创建了一个tensorflow1.0的虚拟环境:使用如下命令下载tensorflow1.15.0:conda install -n tensorflow1.0 tensorflow==1.15.0下载过程中遇到选择时输入y下
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问的解决方法

今天使用:pip3 install --upgrade --force-reinstall --no-cache-dir jupyter报错:ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: ‘d:\anaconda3\lib\site-packages\~mq\backend\cython\constants.cp37-win_amd64.pyd’Consider using the
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

ERROR: Cannot uninstall ‘ipython-genutils‘.的解决方法

今天使用:pip3 install --upgrade --force-reinstall --no-cache-dir jupyter报错:ERROR: Cannot uninstall ‘ipython-genutils’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial u
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

卸载jupyter notebook 重新安装

最近jupyter note book总是出现各种问题,干脆直接重新安装来的简单。1、彻底卸载jupyter note book注意:使用pip uninstall jupyter是卸不掉jupyter的。需要使用如下命令卸载 jupyter:pip install pip-autoremovepip-autoremove jupyter -y2、重新安装jupyter notebookpip3 install --upgrade --force-reinstall --no-cach
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

ERROR: After October 2020 you may experience errors when installing or updating packages.解决方法

在使用:pip3 install -user --upgrade --force-reinstall --no-cache-dir jupyter报错如下:ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.解决方法
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

初学深度学习(一)TensorFlow基本开发步骤之准备数据and搭建模型(正向+反向)

本文以逻辑回归拟合二维数据为例进行演示tensorflow的基本开发步骤。实例:从一组看似混乱的数据中找出y≈2x的规律实例描述:假设有一组数据集,其x和y的对应关系为y≈2x。深度学习大概有如下四个步骤:(1) 准备数据(2) 搭建模型(3) 迭代训练(4) 使用模型1、准备数据这里使用y=2x这个公式来作为主体,通过加入一些干扰噪声让“=”变成“≈”具体代码实现:#导入所需要的包import tensorflow as tfimport numpy as npimport
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

初学深度学习(一)TensorFlow基本开发步骤之迭代训练and使用模型

本文以逻辑回归拟合二维数据为例进行演示tensorflow的基本开发步骤。实例:从一组看似混乱的数据中找出y≈2x的规律实例描述:假设有一组数据集,其x和y的对应关系为y≈2x。深度学习大概有如下四个步骤:(1) 准备数据(2) 搭建模型(3) 迭代训练(4) 使用模型3、迭代训练(1)训练模型通过初学深度学习(一)TensorFlow基本开发步骤之准备数据and搭建模型(正向+反向)的第二步搭建模型中建立好的模型,就可以通过迭代来训练模型了。注意:tensorflow中的任务是通过
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

初学R入门(三):多元数据的R调用:从剪切板、文本文件和Excel表格读取数据

1、从剪切板读取(1)选择需要进行计算的数据块,对其进行复制:(2)在编译器中使用read.table()函数:data = read.table("clipboard",header=T)head(data)这样就成功读取了复制在剪切板中的数据。2、从文本文件中读取仍然使用read.table()函数,只是将“clipboard”改为文件路径和文件名。其中,最安全和通用的文本数据是csv格式,可直接使用read.csv()函数。(1)读入文本文件data_2 = read.ta
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

初学深度学习(一)TensorFlow基本开发步骤之总结篇

通过博客:初学深度学习(一)TensorFlow基本开发步骤之准备数据and搭建模型(正向+反向)和初学深度学习(一)TensorFlow基本开发步骤之迭代训练and使用模型的介绍。现在可以将tensorflow开发的基本步骤总结如下:定义tensorflow输入节点定义“学习参数”变量定义“运算”优化函数,优化目标初始化所有变量迭代更新参数到最优解测试模型使用模型1、定义tensorflow输入节点的方法tensorflow中有如下几种定义输入节点的方法:通过占位符来定义:
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

初学爬虫(三):使用selenium模拟浏览器抓取动态网页之(2)selenium项目实战——深圳短租数据

本项目目的是获取Airbnb深圳前五页的短租房源数据。目标网址:Airbnb深圳短租数据一、分析网站HTML代码标签1、在网页任意地方右击鼠标 > 检查2、找到“房子所有数据”对应的HTML代码找到房子所有数据的地址为:div.gigle73、找到“房子价格”对应的HTML代码找到房子价格的地址为:span.krjbj4、找到“房子分数,房子评论数”对应的HTML代码找到房子分数,房子评论数的地址为:span._1clmxfj5、找到“房子名称”对应的HTML代码找到
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

Windows下安装R

一、下载R安装包进入R下载官网:添加链接描述选择download下的cran(镜像)建议下拉选择国内镜像,速度会快很多。选择Windows版本下载选择版本,我这里选择base版本。下载对应版本的R,建议读者下载最新版本即可,我之前已经下载了3.6.2然后就是等待下载完成即可。二、安装R双击下载好的安装包选择语言点击下一步选择安装路径(可自己修改),点击下一步可以选择32位版本和64位版本,如果电脑是32位的,最好把64位的去掉,如果64位的电脑,可以全部选择。然
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

将新建的虚拟环境导入jupyter notebook中使用

1、打开cmd终端2、安装插件nb_conda输入命令:conda install nb_conda等待安装完成。3、打开jupyter notebook可以发现我的所有虚拟环境都在jupyter notebook中了。
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

R报错:Failed to install ‘IRkernel‘ from GitHub: Git does not seem to be installed on your system.

今天安装devtools时,出现如下报错:错误: Failed to install ‘IRkernel’ from GitHub:Git does not seem to be installed on your system.报错详情:为解决以上问题,需要下载安装Git1、下载GitGit下载网址:添加链接描述我这里选择Windows版本。选择64位版本,等待下载完毕。2、安装Git双击打开下载好的安装包点击next选择文件存取路径,点击next勾选自己需要的配置文
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0

R报错:WARNING: Rtools is required to build R packages, but is not currently installed.

今天在安装IRkernel时使用如下命令:devtools::install_github('IRkernel/IRkernel')出现报错:WARNING: Rtools is required to build R packages, but is not currently installed.Please download and install Rtools 3.5 from https://cran.r-project.org/bin/windows/Rtools/.Skipping
分类: 其他 发布时间: 03-31 10:02 阅读次数: 0