본문 바로가기

파이썬/이미지데이터 처리

detectron2 튜토리얼

728x90
반응형
pip install torch torchvision torchaudio -f https://download.pytorch.org/whl/cu111/torch_stable.html​
 

How to Install Detectron2 on Windows 10 or 11 –2021(AUG) with the latest build(v0.5).

Installing Detectron2 on windows is not so easy but an achievement indeed! I am writing this story after so many hurdles which I faced…

medium.com

 

튜토리얼 — detectron2 latest documentation

© Copyright 2019-2020, detectron2 contributors.

detectron2-kr.netlify.app

 

 

Windows 10 Detectron2 설치하기

졸업작품 관련하여 Detectron2를 설치했는데, windows에서는 설치하는 방법 을 소개하려 한다. 해당, 외국 사이트를 참조하였다.Install Environment : Python : 3.8.3Cuda : 10.2 verAndaconda : python 3.8

velog.io

 

첫번째, Anaconda 설치하기

설치후 Anaconda Prompt를 사용할 것 입니다.

 

Free Download | Anaconda

Anaconda's open-source Distribution is the easiest way to perform Python/R data science and machine learning on a single machine.

www.anaconda.com

GPU를 사용하는 모듈이기 때문에 관련 툴 킷을 설치하기

엔비디아의 경우 아래 링크에서 local 버전으로 설치해 줍니다.

 

CUDA Toolkit 10.2 Download

Get CUDA Toolkit 10.2 for Windows, Linux, and Mac OSX.

developer.nvidia.com

 


Conda 가상환경 만들기

Anaconda Prompt에서
(CUDA와 Tensor Flow 그리고 Pytorch에서 서로 호환되는 파이썬 버전을 확인하고 가상환경 만들 것)

# 가상 환경 생성
conda create -n detectron2 python=3.8

# 가상 환경 활성화
conda activate detectron2

#가상 환경 설치 확인, 활성화된 Conda환경을 확인
conda info --envs

 


Detectron2 설치하기

Anaconda Prompt에서 Detectron2 클론 및 설치 : 

pip install torch torchvision torchaudio -f https://download.pytorch.org/whl/cu111/torch_stable.html

GIT을 설치

 

Git - Git 설치

이 책은 Git 2.0.0 버전을 기준으로 썼다. 대부분의 명령어는 그 이전 버전에서도 잘 동작하지만, 몇 가지 기능은 아예 없거나 미묘하게 다를 수 있다. Git의 하위 호환성은 정말 훌륭하기 때문에 2.0

www.git-scm.com

 

Windows에 Git을 설치하는 방법은 여러 가지다. 공식 배포판은 Git 웹사이트에서 내려받을 수 있다. http://git-scm.com/download/win에 가면 자동으로 다운로드가 시작된다. 이 프로젝트가 'Git for Windows’인데, Git 자체와는 다른 별도의 프로젝트다. 자세한 정보는 https://git-for-windows.github.io/에서 확인한다.

자동화된 설치 방식은 Git Chocolatey 패키지를 통해 이용해볼 수 있다. 패키지는 커뮤니티에 의해 운영되는 프로그램인 점을 알려드린다.

Windows에서도 Git을 사용하는 또 다른 방법으로 'GitHub Desktop’을 설치하는 방법이 있다. 이 인스톨러는 CLI와 GUI를 모두 설치해준다. 설치하면 Git을 Powershell에서 사용할 수 있다. 인증정보(Credential) 캐싱과 CRLF 설정까지 잘 된다. 이런 것들은 차차 배우게 될 것인데, Git 사용자라면 쓰게 될 기능들이다. 'GitHub Desktop’은 GitHub Desktop 웹사이트에서 내려받는다.


git clone https://github.com/facebookresearch/detectron2.git --branch v0.6
cd detectron2
pip install -e .

추가의존성 설치하기

Anaconda Prompt에서 :

pip install opencv-python
pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'

관련 모듈설치 하기

Anaconda Prompt에서 :

pip install opencv-python
pip install opencv-contrib-python
#conda를 사용한 설치 (Anaconda 환경인 경우):
conda install -c conda-forge opencv
#또는
conda install -c conda-forge opencv-contrib

테스트

1. Detectron2 튜토리얼 및 예제 실행:
Detectron2에는 풍부한 튜토리얼과 예제가 포함되어 있습니다. 이를 활용하여 Detectron2의 기능을 익힐 수 있습니다. Detectron2 GitHub 리포지토리의 demo/ 폴더에는 다양한 작업을 수행할 수 있는 예제 코드들이 있습니다.

#detectron2/demo 디렉토리에 데모 py파일이 있다.
python demo/demo.py --config-file demo/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml --input1 demo/input.jpg --output demo/output.jpg --opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl

 

728x90
반응형

'파이썬 > 이미지데이터 처리' 카테고리의 다른 글

Jupyter Notebook에 가상환경 구성하기  (0) 2023.12.17
TensorFlow 설치하기  (0) 2023.12.17
Pytorch 설치하기  (0) 2023.12.17
YOLO (You Only Look Once)  (0) 2023.12.08