Towards Open World Object Detection的訓練
代碼地址:https://github.com/JosephKJ/OWOD
https://github.com/JosephKJ/OWOD
1.創建一個conda環境python > 3.6, 安裝 Pytorch > 4 和opencv
2.下載detectron2(也可以根據電腦配置下載不同版本的detectron2)
git clone https://github.com/facebookresearch/detectron2.git
不同版本下載地址:https://github.com/facebookresearch/detectron2/releases
3.接下來在OWOD檔案夾下安裝detectron2
python -m pip install -e detectron2


注意此處不要使用該檔案夾外部構建的Detectron2,否則運行代碼時會報錯,一定要在OWOD內構建Detectron2,
4.資料集的制作:先進入google drive的命令下載資料, 然后再根據下面兩個步驟把資料和預訓練的模型放到指定的位置(這一步要仔細)
google drive地址https://drive.google.com/drive/folders/1Sr4_q0_m2f2SefoebB25Ix3N1VIAua0w
(1)主檔案夾下新建datasets/VOC2007檔案夾
(2)下載的Annotations與JPEGImages檔案夾放在VOC2007下
(3)新建datasets/VOC2007/ImageSets/Main檔案夾
(4)將datasets/OWOD_imagesets下的所有檔案放到datasets/VOC2007/ImageSets/Main下
5.開始訓練
8gpu:
python tools/train_net.py --num-gpus 8 --dist-url='tcp://127.0.0.1:52125' --resume --config-file ./configs/OWOD/t1/t1_train.yaml SOLVER.IMS_PER_BATCH 8 SOLVER.BASE_LR 0.01 OUTPUT_DIR "./output/t1"
4gpu:
python tools/train_net.py --num-gpus 4 --dist-url='tcp://127.0.0.1:52125' --resume --config-file ./configs/OWOD/t1/t1_train.yaml SOLVER.IMS_PER_BATCH 4 SOLVER.BASE_LR 0.005 OUTPUT_DIR "./output/t1"
單gpu:
python tools/train_net.py --num-gpus 1 --dist-url='tcp://127.0.0.1:52125' --resume --config-file ./configs/OWOD/t1/t1_train.yaml SOLVER.IMS_PER_BATCH 8 SOLVER.BASE_LR 0.0025 OUTPUT_DIR "./output/t1"
在運行時可能會出現缺少包的情況,直接pip安裝即可:
No module named 'reliability'
pip install reliabilityNo module named 'shortuuid'
pip install shortuuid


運行成功!!!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/385447.html
標籤:其他
