longcw / yolo2-pytorch

YOLOv2 in PyTorch
1.54k stars 421 forks source link

cpu only #128

Open qq1243196045 opened 2 years ago

qq1243196045 commented 2 years ago

I want to use it with pytorch-cuponly ,what should I do? thanks!!

robator0127 commented 1 year ago

first create a conda virtual environment, where python version is 3.6 conda create -n pytorch_cpu python=3.6 then confirm it conda activate pytorch_cpu,python --version(it should be ) second,install torch and torchvision, note the version must be matched,in this project,torch version is 0.4.0(cpu),torchvision version is 0.2.0 pip install http://download.pytorch.org/whl/cpu/torch-0.4.0-cp36-cp36m-linux_x86_64.whl pip install torchvision==0.2.0 third, other packages should also be matched,whose version is earlier than now.the packages is numpy,cffi,cython,the version which i used is as follows: pip install cffi==1.8.2 -i https://mirror.baidu.com/pypi/simple pip install numpy==1.15.0 pip install cython==0.27.3 -i https://mirror.baidu.com/pypi/simple then,you can pass the first step 'sh make.sh',but the whole project is based on gpu,so cpu version can't work without any change.if you delete the cuda related code ,it may work