当前位置:网站首页>Detectron2 installation and testing
Detectron2 installation and testing
2022-07-28 16:17:00 【Xiao Wang who sells newspapers】
Just touched detectron2 frame , In general, the framework consists of Facebook Open source , The quality is very good , Worth learning . Today, I will sort out and summarize some problems encountered in installation and testing . It will be continuously updated later .
Detectron2 install
Detectron2 Project links :https://github.com/facebookresearch/detectron2
Official installation tutorial :https://github.com/facebookresearch/detectron2/blob/main/INSTALL.md
Requirements
Python ≥ 3.6 ( This experiment Ubuntu16.04 Proceed under , Use Python3.7)
Pytorch ≥ 1.5 Corresponding version torchvision( This experiment is installed Pytorch 1.6,torchvision 0.7)
CUDA 10.1 ( Please choose with Pytorch Matching cudatoolkit edition , In order to successfully install the framework )
GCC >= 4.9( This is C/C++ Requirements of compilation environment , If you don't , In the compilation process, it will basically fail )
Environmental installation
anaconda Create an environment
conda create -n detectron2 python=3.7
conda activate detectron2
install pytorch 1.6 cuda10.1
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch
# Test it
import torch, torchvision
print(torch.__version__, torch.cuda.is_available())
Install other dependencies
pip install cython pyyaml==5.1
pip install opencv-python==3.4.2
pip install cython
# fvcore The following version is installed in this experiment , You can also refer to the official installation tutorial to install other versions :https://github.com/facebookresearch/fvcore/
pip install fvcore==0.1.1.post20200716
# install pycocotools, If the following code runs with an error , You can refer to the link for installation :https://blog.csdn.net/xiongzai2016/article/details/106855544
pip install -U 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
install detectron2
# Install from local clone
git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2
Download like this detectron2 It's the latest version , As required in the official installation documents PyTorch ≥ 1.8 , Therefore, an error will be reported during installation . You can visit detectron2 Historical version link of :https://github.com/facebookresearch/detectron2/releases
According to the installed PyTorch and cuda Version to install the corresponding version detectron2, Here is PyTorch1.6 The corresponding installation command line :
python -m pip install detectron2==0.4 -f \
https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/torch1.6/index.html
test - Instance segmentation
stay detectron2 Create a new folder testimage Folder , Save several test pictures .
function demo.py
python demo/demo.py \
--config-file ./configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml \
--input ./testimage/2007_003020.jpg --output ./output/ \
--opts MODEL.WEIGHTS ./model/model_final_f10217.pkl
config-file :configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml This is the configuration information ,detectron2 There is already in that folder .input: ./testimage/2007_003020.jpg Test the path of the image .output: Define an output path by yourself .opts :MODEL.WEIGHTS models/model_final_f10217.pkl This is a trained model , Go according to your own requirements model zoom Download it . It can also be set directly to MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl Sometimes the download speed is very slow when you have time , Affect the test speed , So it's better to download it in advance .
Look at the test results :

Training test
Use the self-contained small version dataset , function ./datasets/prepare_for_tests.sh, And then execute ./dev/run_instant_tests.sh, If the following result appears , Congratulations on the successful installation . The following is a screenshot of the running results of other bloggers :
Reference article :
Link to the original text :https://blog.csdn.net/weixin_41298484/article/details/119914362
Link to the original text :https://blog.csdn.net/XX_123_1_RJ/article/details/103779787
Link to the original text :https://blog.csdn.net/qq_33047753/article/details/107022768
边栏推荐
- js 双向链表 01
- Encoder high speed pulse counter Modbus RTU module ibf150
- 2021 肯特面试题3
- Basic structure and operation principle of solar street lamp
- Rust Getting Started Guide (crite Management)
- Using SYSTEMd to manage services
- Implementation of skip table
- js中的for循环总结
- Knowledge points qwer
- Pyqt5 rapid development and practice 5.1 tables and trees
猜你喜欢

QT打包

MicTR01 Tester 开发套件(振弦采集读数仪)使用说明

Solve the problem that the right-click menu "edit with idle" of the 『 py 』 file is invalid or missing

Rust 入门指南(crate 管理)

带你来浅聊一下!单商户功能模块汇总

2021 Yahong pen test questions

One channel encoder, two channels Di speed measurement, RS485 serial port connected to one channel do alarm module ibf151

Instructions for mictr01 Tester development kit (vibrating wire acquisition reader)

MLX90640 红外热成像仪测温传感器模块开发笔记(八)

Telecommuting can be easily realized in only three steps
随机推荐
How to measure the vibrating wire sensor by vibrating wire acquisition module?
12V pulse speed measurement to 24V level signal conversion transmitter
js中的for循环总结
Fifth uncle's thinking
食品安全 | 这两类瓜果宜改善便秘 孕妇人群尤其建议
Redis系列4:高可用之Sentinel(哨兵模式)
[live broadcast reservation] a new challenge under the evolution of data architecture - Shanghai railway station
以太网转RS485串口计数器WiFI模块 LED灯光控制器IBF165
IFD-x 微型红外成像仪(模块)的温度测量和成像精度
Remember the common JS methods of projects
R语言使用fs包的file_delete函数删除指定文件夹下的指定文件、举一反三、dir_delete函数、link_delete函数可以用来删除文件夹和超链接
js 链表 02
High precision absolute angle sensor application high speed angle monitoring
2021 肯特面试题3
What are the process specifications of software testing? How to do it?
Redis series 4: sentinel (sentinel mode) with high availability
JS queue
2021-10-21 notes
2021 亚鸿笔试题
Event express | Apache Doris Performance Optimization Practice Series live broadcast course is open at the beginning. You are cordially invited to participate!