吴恩达深度学习课后作业-目标检测的环境配置

吴恩达深度学习-目标检测课后作业中使用的是tensorflow 1.X的版本,现在使用tf 2.x会出现各种报错问题,比较简单的方法是创建虚拟环境,然后安装tf 1.x运行代码

  • 使用anaconda创建虚拟环境,并在jupyter notebook中运行代码
  • 安装tensorflow和keras后,numpy和h5py这两个包的版本过高,在运行代码时会出现警告和错误,需要降级
  • keras的版本过高也可能会有错误

tensorflow因numpy版本过高引起的警告:FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated…
h5py版本太高引起报错: AttributeError: ‘str’ object has no attribute ‘decode’

在虚拟环境中安装指定版本的依赖库
# 创建并激活虚拟环境(yolov2_keras是虚拟环境名称)
conda create -n yolov2_keras
activate yolov2_keras

# 安装可以运行代码的各版本依赖库 (使用清华源安装)
pip install tensorflow==1.13.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install keras==2.3 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install numpy==1.16.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install pillow -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install h5py==2.10.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install imageio -i https://pypi.tuna.tsinghua.edu.cn/simple

#将虚拟环境添加到jupypter notebook的kernel中
python -m ipykernel install --name yolov2_keras 

# 安装插件使jupyter支持虚拟环境 
conda install nb_conda   
  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值