관리 메뉴

me made it !

MMDetection 환경세팅 본문

TIL

MMDetection 환경세팅

yeoney 2023. 8. 5. 01:05
반응형

MM Detection 환경세팅


1. 가상 환경 구축

conda create -n mmdetection python=3.11

2. pytorch 설치

conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

3.  MMCV-FULL  설치 

우선, 

https://mmcv.readthedocs.io/en/latest/get_started/installation.html
 

Installation — mmcv 2.0.1 documentation

Docs > Installation 以中文阅读 Shortcuts

mmcv.readthedocs.io

에서 자신의 cuda 버전 확인하고 맞는 버전으로 설치 

(확인하는 방법 - 사이트 연결 후 ) 

에서 자신의 환경에 맞게 선택 . 복붙 해오기
pip install mmcv==2.0.0 -f https://download.openmmlab.com/mmcv/dist/cu117/torch2.0/index.html

 

4. github  에서 detecion.zip 다운로드 후 만든 가상환경으로 인터프린터 생성

https://github.com/open-mmlab/mmdetection/archive/refs/heads/main.zip

4 -1 ) 경로 잡기

cd C:\Users\labadmin\Desktop\0803\mmdetection-main

5. install MMDetection (수동 설치) 

pip install -r requirement/build.txt
pip install -v -e .

5 -1 ) 설치 확인

pip install mmdet

 

6. 테스트 코드 이용하여 환경 세팅 여부 체크

from mmdet.apis import init_detector, inference_detector

config_file ='./configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py'
checkpoint_file = './checkpoint/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118 (1).pth'

device = 'cuda:0'

model = init_detector(config_file, checkpoint_file, device=device)

test = inference_detector(model, './demo/demo.jpg')

print(test)

Model_zoo : https://github.com/open-mmlab/mmdetection/blob/main/docs/en/model_zoo.md

반응형