記錄mac在gpu服務器遠程部署pytorch版本的yolov3(含安裝anaconda)

一、 在mac終端登錄遠程服務器python

ssh xxx@xxxx.xxxx.xxxx.xxxx

二、 建好放yolov3項目的文件夾,進入,並克隆yolov3項目;
項目鏈接:https://github.com/ultralytic...git

git clone https://github.com/ultralytics/yolov3.git

三、下載依賴github

pip install -r requirements.txt

遇到問題以下:
image.png
緣由:當前python版本是2.7的,pip安裝的依賴版本達不到requestments.txt文件裏的要求
解決: 下載python3,並遇到以下問題
image.png
緣由:當前gpu服務器給個人賬號沒有root權限
解決: 安裝anaconda來兼容多版本python
四、安裝anaconda:
我這裏是命令行方式下載,個人系統是ubuntu18.04ubuntu

wget https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh
  • 再運行
bash Anaconda3-2020.07-Linux-x86_64.sh #後面的文件名看本身下載的是什麼就寫什麼

按enter鍵進入,遇到提問輸入yes繼續,至安裝完畢bash

  • 在終端測試python3是否存在,沒有的話就安裝python3
conda install python3

遇到問題:顯示conda命令不識別
image.png服務器

緣由:沒有配置環境路徑
解決: 肯定本身anaconda的安裝路徑,通常是/home/xxx(你的遠程服務用戶名)/anaconda3
運行ssh

echo 'export PATH="/home/xxx/anaconda3/bin:$PATH"' >> ~/.bashrc #xxx要記得根據本身的狀況改

再重啓一下服務,使配置生效測試

source ~/.bashrc

這時候就可使用conda命令了!ui

至此python3問題解決
五、從新安裝requestments.txt裏的依賴spa

pip3 install -r requestments.txt

image.png
待安裝完成,至此,pythroch版本的yolov3項目部署完成,下載yolov3權重文件來測試一下

wget -c https://pjreddie.com/media/files/yolov3.weights

運行

python3 detect.py --cfg cfg/yolov3.cfg --weights yolov3.weights --source  data/samples/bus.jpg

原項目yolov3/data/samples下有兩張樣圖,運行完畢後會在yolov3文件夾下生成一個文件夾output,裏面即有剛預測出來的圖片,下圖是個人預測圖片結果image.png

相關文章
相關標籤/搜索