Faster-rcnn
大致步骤:
1.先将代码下载解压到pycharm
百度网盘链接:https://pan.baidu.com/s/1cCZ_W35v70IlfVBPyM0eBw?pwd=4f3g
提取码:4f3g
2.在电脑使用Anaconda创建一个虚拟环境(打开conda)
依此输入指令:
conda create -n fastrcnn python=(电脑python当前版本) //可用python -V命令进行查看
conda activate fastrcnn //激活环境
3.在虚拟环境中(通过清华源和cuda)来安装pytorch
(下载gpu版本)
👆在这个教程中下好下图版本的cudn和cudnn即可。
👉接着配置清华源(cuda配置)
在Anaconda中或者Win+R+cmd中输入以下命令
conda config --add channels <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/>
conda config --add channels <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/>
conda config --add channels <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud//pytorch/>
conda config --add channels <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/>
conda config --set show_channel_urls yes
配置好后就可以用cuda指令下载pytorch了
👇指令:
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
(
windows系统指令)其他系统切换即可
4.根据requirement文件安装程序所需要的包
这是pip指令👉
pip install -r requirements.txt
这是conda指令(两个都可以)👉
conda install --yes --file requirements.txt
5.完成后可以在conda输入命令以便检查是否安装成功
import torch
import torch.nn as nn
print(torch.cuda.is_available())# 如果输出是True,那意味着你的PyTorch安装已经正确配置了CUDA支持,如果是False,则表示CUDA不可用
print(torch.**version**) # 打印出当前安装的PyTorch版本
print(torch.cuda_version) # 显示了PyTorch所使用的CUDA版本
print(torch.cuda.current_device()) # 当前激活的CUDA设备的索引号
print(torch.cuda.device_count()) # 返回可用的CUDA设备数量
成功后的效果:
恭喜完成!
最后的最后,如果requirement文件可能没下全可能还得另外pip
(例如)安装tensorboard
使用http访问清华源不行时
pip install tensorboard --index-url <https://pypi.tuna.tsinghua.edu.cn/simple>