win10系统下安装theano+lasagne

win10系统下安装theano+lasagne

由于最近需要跑一个全景视频显著性检测的网络SalGan360,是用theano搭建的,比较古老的一种框架,很多博客写的都不是很全,之前也尝试过配置环境,但都以失败告终,这几天又重新配置了环境居然成功了!

一、 前提准备

下载theano和lasagne安装包,很多都是直接用conda或pip命令安装,这种方法好像会出现两者不匹配的情况,在运行网络的时候会出现cannot import name ‘xxx’ from 'lasagne.layers’之类的错误。
解决办法:从github中提前下载好theano和lasagne安装包。

theano安装包:https://github.com/Theano/Theano/archive/master.zip
lasagne安装包:https://github.com/Lasagne/Lasagne/archive/master.zip

二、 安装python2.7、numpy和scipy

这里要注意的是在安装theano和lassgne之前需要提前安装好对应版本的python、numpy和scipy
在这里插入图片描述

  1. 新建虚拟环境并激活
conda create --name theano-py27 python=2.7
activate theano-py27
  1. 安装numpy、scipy
conda install numpy=0.12.0
conda install scipy=0.17.0 mkl-service

三、 安装theano、lasagne

  1. 解压theano、lasagne的Zip安装包
  2. 安装theano、lasagne
    从虚拟环境中进入安装包所在的盘,比如这里放在D盘,转到D盘
(theano-py27) C:\User\xxx\D:
(theano-py27) D:\>cd D:\Theano-master (theano、lasagne安装包所在路径)

解压后的theano、lasagne的ZIP文件里可以看到setup.py文件
在这里插入图片描述

(theano-py27) D:\Theano-master>python setup.py install
  1. 等待安装,安装完成后会出现
    在这里插入图片描述
    lasagne的安装也同理。

  2. 验证是否安装成功

import theano
import theano.tensor as T

在这里插入图片描述
无报错信息说明安装成功。

四、 在网络运行过程中出现的问题

  1. undefined reference to__imp_PyExc_TypeError以及collect2.exe: error: ld returned 1 exit status m2w64-toolchain

解决办法:安装libpython

conda install libpython
  1. 读取.pkl文件出现EOFError

之前的代码是这样写的:

vgg16 = pickle.load(open(path_to_model_weights))

更改代码,错误解决

vgg16 = pickle.load(open(path_to_model_weights, 'rb'))
  1. no module named cv2

缺少opencv库

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python==4.2.0.32
  1. 其他库的安装
pip install parameterized

至此,整个网络可以成功跑通了!

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值