Python2.7+virtualenv+CUDA 10.0版的pytorch v1.3.0 +运行人群计数crowdcount-mcnn网络
Posted 汤姆啾
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python2.7+virtualenv+CUDA 10.0版的pytorch v1.3.0 +运行人群计数crowdcount-mcnn网络相关的知识,希望对你有一定的参考价值。
Python2.7
$ python2 -m virtualenv pytorchenv
$ source pytorchenv/bin/activate
$ pip install ipython
pytorch v1.3.0 # CUDA 10.0
$ pip install torch==1.3.0+cu100 torchvision==0.4.1+cu100 -f https://download.pytorch.org/whl/torch_stable.html
........................................................................................................................
Downloading https://download.pytorch.org/whl/cu100/torch-1.3.0%2Bcu100-cp27-cp27mu-linux_x86_64.whl (744.5MB)
Downloading https://download.pytorch.org/whl/cu100/torchvision-0.4.1%2Bcu100-cp27-cp27mu-linux_x86_64.whl (10.1MB)
......................................................................................................................
$ pip install ipython
或打开pycharm
====输入例子====
import torch as t
x = t.rand(5,3)
y = t.rand(5,3)
if t.cuda.is_available():
x = x.cuda()
y = y.cuda()
print(x+y)
=====有结果代表成功====
crowdcount-mcnn人群计数https://github.com/svishwa/crowdcount-mcnn,需要额外安装依赖:
pip2 install pandas
pip2 install opencv-python
pip2 install h5py
注意修改train.py代码:
# train_loss += loss.data[0] is pytorch0.3.1 codes, and >pytorch0.5 is error.
train_loss += loss.item()
以上是关于Python2.7+virtualenv+CUDA 10.0版的pytorch v1.3.0 +运行人群计数crowdcount-mcnn网络的主要内容,如果未能解决你的问题,请参考以下文章
virtualenv中或机器中python2.6和2.7版本同时存在时,执行python2.7报错
centos6.9安装virtualenv并配置python2.7环境
如何在python2.7中安装MySQLdb 在virtualenv中安装
Nginx+uwsgi+virtualenv+Django+Mysql架构
sh 在Ubuntu 12.04上将Pygame 1.9.1安装到Python2.7 virtualenv中的脚本。确保在运行thi之前激活了virtualenv