detectron2安裝填坑--2020-05-14

安裝detectron2

python3.6,cuda10.1,


1 )? 安裝detectron2參考下面幾個文檔,

但出現(xiàn)RuntimeError:Not compiled with GPU support,一直沒解決(更改了detectron的clone方式和安裝方式不再出現(xiàn)),

便新建conda環(huán)境,使用第二種方法ok

https://blog.csdn.net/sophia_xw/article/details/102561410


conda create -n d2p36 python=3.6

source activate d2p36??// use every reboot


pip install -U torch torchvision

conda install -c menpo opencv3

pip install -U

'git+https://github.com/facebookresearch/fvcore'

pip install cython

pip install

'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'



//git clone https://github.com/facebookresearch/detectron2detectron2_repo這個沒有試過

//pip install -e detectron2_repo



https://blog.csdn.net/jgj123321/article/details/105475027

git clone https://github.com/facebookresearch/detectron2.git?

cd detectron2

python -m pip install -e .


https://blog.csdn.net/m0_37709262/article/details/102732057? 也不行

//pip install'git+https://github.com/facebookresearch/detectron2.git'? //linux找不到被clone到哪里了

?//(add --user if youdon't have permission)

// Or, to install it from a local clone:

git clone https://github.com/facebookresearch/detectron2.git

cd detectron2 && pip install -e .



https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md

//python -m pip install detectron2 -fhttps://dl.fbaipublicfiles.com/detectron2/wheels/cu101/index.html? //linux找不到被clone到哪里了




2)安裝參考這個,能正常運(yùn)行demo,

conda create -n dt2p36 python=3.6

source activate dt2p36??// use every reboot


https://www.aiuai.cn/aifarm1288.html

依次參考安裝依賴庫

...

方式二:

git clone https://github.com/facebookresearch/detectron2.git

cd detectron2

python -m pip install -e .


出現(xiàn)一些錯誤或有些庫使用的是python3.5的,用下面的命令更新解決

pip install -U torch torchvision

pip install -U torch pycocotools

pip install cython


3) demo腳本? 每次要重啟激活環(huán)境source activate dt2p36?? // use every reboot


原文鏈接:https://blog.csdn.net/sophia_xw/article/details/102561410

//python demo/demo.py --config-file

configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml --input 001.jpg

--output results --opts MODEL.WEIGHTS models/model_final_f10217.pkl

注意點(diǎn):


測試圖片自己找,我的是000043.jpg,放在當(dāng)前工程自己新建的文件夾images中;

當(dāng)前工程下,新建results文件夾存儲結(jié)果圖片,我在服務(wù)器環(huán)境中,沒有顯示器,因此給個輸出文件夾;

當(dāng)前工程下,新建models文件夾用來放測試模型,當(dāng)然,模型自己在model zoo鏈接中去下載;


其他參數(shù):



在攝像頭測試

用–webcam替代–input



視頻文件測試

用–video-input替代–input



存儲結(jié)果

給–output參數(shù)就行


https://blog.csdn.net/enwuone/article/details/104983976

python demo/demo.py --config-file

configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml --input 001.jpg

--output results --opts MODEL.WEIGHTS

detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl

參數(shù)解釋

demo/demo.py:demo文件

–config-file:選擇配置文件

–output:輸出位置(如果想直接查看,刪除這個參數(shù)即可)

MODEL.WEIGHTS:預(yù)先訓(xùn)練好的模型


pip install opencv-python --user? // no module named cv2


4) others

RuntimeError: Not compiled with GPU support


//不生效,可以參考begin

https://www.cnblogs.com/marsggbo/p/11916859.html

官方提供的檢驗(yàn)代碼查看CUDA路徑:

python -c 'import torch; from torch.utils.cpp_extension

import CUDA_HOME; print(torch.cuda.is_available(), CUDA_HOME)'


vim ~/.bashrc

export CUDA_HOME=/usr/local/cuda

source ~/.bashrc


Docker Runtime Error: Not Compiled with GPU support

https://github.com/facebookresearch/maskrcnn-benchmark/issues/167

https://blog.csdn.net/u011420347/article/details/85111815


https://ask.csdn.net/questions/769137

print(t.version.cuda)

print(t.cuda.device_count())


import torch as t

tensor=t.Tensor(3,4)

tensor.cuda(0)



google搜索,參考

https://github.com/facebookresearch/detectron2/issues/62

https://github.com/facebookresearch/detectron2/issues/267

//end

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容