공지: 게시글 마지막에 있는 ‘참고 사이트3’ 을 참고해서 detectron2를 설치하였습니다.
Install Detectron2
Meta에서 나온 ‘detectron2’를 윈도우11 및 CUDA 11 환경에서 설치하는 과정을 설명합니다.
운영체제: Window 11 Pro
GPU: NVIDIA GeForce RTX 3080 Ti (sm_86 CUDA 지원, 3080 Ti에 호환되는 CUDA Toolkit은 11.2 이상)
CUDA: 11.6
anaconda: 2022.10 windows-x86_64 release
python: 3.9.13
Pytorch: 1.12.0
Microsoft Visual Studio: Community 2022
공식 홈페이지 detectron2 요구사항: https://detectron2.readthedocs.io/en/latest/tutorials/install.html
- Linux or macOS with Python ≥ 3.7
- PyTorch ≥ 1.8 and torchvision that matches the PyTorch installation. Install them together at pytorch.org to make sure of this
- OpenCV is optional but needed by demo and visualization
anaconda
anaconda 구버전 다운받기: https://repo.anaconda.com/archive/
anaconda 버전 확인 방법
conda info
CUDA
CUDA 버전: 11.6 (다운그레이드)
CUDA 버전 변경 방법: https://tw0226.tistory.com/79
[CUDA] 윈도우 환경에서 CUDA 버전 변경
어떤 github의 딥러닝 코드는 tensorflow 1.14 버전을 썼는데, 1.14 버전은 CUDA 11버전이 호환되지 않아서 1. python 버전 변경 2. tensorflow 재설치 3. CUDA 버전 번경 (11 -> 10) 의 절차가 필요하였다. 나의 상황
tw0226.tistory.com
CUDA 환경변수 설정 -> 사용자변수>path>편집>아래 3줄 본인의 버전에 맞게 추가
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\extras\CUPTI\libx64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include
CUDA 버전 확인
nvcc --version
가상환경 설정 및 Pytorch 설치
conda info --envs
conda create -n det2
conda activate det2
conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.6 -c pytorch -c conda-forge
Pytorch
Pytorch 버전 리스트: https://pytorch.org/get-started/previous-versions/
Previous PyTorch Versions
Installing previous versions of PyTorch
pytorch.org
파이토치 버전 확인
python
import torch; print(torch.__version__)
exit()
Microsoft Visual Studio 2022
설정>앱>설치된 앱 에서 Microsoft visual C++ 관련 삭제 후, visual studio 2022버전 설치해주기 <- 참고사이트3 참고하기
Cython, Pycocotools, Detectron2, OpenCV
detectron2 설치할 때, git 없으면 공식페이지에서 직접 Download ZIP 다운받기: https://github.com/facebookresearch/detectron2?tab=readme-ov-file
GitHub - facebookresearch/detectron2: Detectron2 is a platform for object detection, segmentation and other visual recognition t
Detectron2 is a platform for object detection, segmentation and other visual recognition tasks. - facebookresearch/detectron2
github.com
install -e detectron2 하기 전에 다운받은 detectron2 폴더에 setup.py파일 수정하기: 79번째 줄 다음에 “-DWITH_CUDA”, 를 추가. <- 따옴표 포함해서 복사/붙여넣기
pip install cython
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2
pip install opencv-python
Test
detectron2/tests/에 test_window.py 파일 추가: https://github.com/yogeshkumarpilli/detectron2/blob/master/tests/test_window.py
detectron2/tests/test_window.py at master · yogeshkumarpilli/detectron2
Detectron2 is FAIR's next-generation platform for object detection, segmentation and other visual recognition tasks. - yogeshkumarpilli/detectron2
github.com
cd detectron2\tests
python test_model_zoo.py
python test_window.py
결과사진
참고 게시글
DLL load failed 오류가 나온 경우: https://3rdscholar.tistory.com/81
[파이썬 에러 해결 Tip] ImportError: DLL load failed: 시스템에서 파일에 액세스할 수 없습니다.
작업 환경 Windows 사용 Anaconda 사용 Visual Studio Code 사용 Jupyter notebook 사용 Python 3.6.12 사용 가상 환경 생성하여 사용 ImportError: DLL load failed: 시스템에서 파일에 액세스할 수 없습니다. 영어로는 'Impor
3rdscholar.tistory.com
CUDA 환경구성 방법: https://velog.io/@mactto3487/%EB%94%A5%EB%9F%AC%EB%8B%9D-GPU-%ED%99%98%EA%B2%BD-%EA%B5%AC%EC%84%B1%ED%95%98%EA%B8%B0
GPU 사용을 위한 CUDA 환경 구성하기
이번에 데스크탑을 맞추면서 Geforce RTX 3080 그래픽카드를 구매하였다.근데 GPU를 딥러닝에 학습에 사용하기 위해선 여러 환경 구성이 필요하다는 걸 깨닫고 설치하는데5일이 걸렸다;;글카 가격만
velog.io
그래픽드라이버 삭제 후 재설치: https://m.blog.naver.com/ideungam/222695810463
그래픽카드 드라이버 완전 삭제 후 다시 설치 과정 정리
그래픽 카드의 효율적인 사용을 위해서는 안정적인 드라이버의 역할이 중요합니다. 그런데 요즘엔 업그레이...
blog.naver.com
NVIDIA 드라이버 다운로드: https://www.nvidia.com/ko-kr/drivers/
최신 정식 NVIDIA 드라이버 다운로드
최신 정식 NVIDIA 드라이버를 다운로드하여 PC 게임 경험을 향상시키고 앱을 더 빠르게 실행하세요.
www.nvidia.com
CUDA툴킷 아카이브: https://developer.nvidia.com/cuda-toolkit-archive
CUDA Toolkit Archive
Previous releases of the CUDA Toolkit, GPU Computing SDK, documentation and developer drivers can be found using the links below. Please select the release you want from the list below, and be sure to check www.nvidia.com/drivers for more recent production
developer.nvidia.com
Detectron2 사용후기
안그래도 최근 Mask R-CNN에 관해서 논문을 읽어보고 관련하여 PPT로 만들며 자료제작중이였는데, Detectron2에 관해서도 접하게 되어 '오? 이건 뭐지?' 라는 생각으로 자료를 미친듯이 긁어모아보며
velog.io
참고 사이트 2: https://velog.io/@seoyoon130/Windows-10-Detectron2-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0
Windows 10 Detectron2 설치하기
졸업작품 관련하여 Detectron2를 설치했는데, windows에서는 설치하는 방법 을 소개하려 한다. 해당, 외국 사이트를 참조하였다.Install Environment : Python : 3.8.3Cuda : 10.2 verAndaconda : python 3.8
velog.io
How to make Detectron2 work on Windows 11 and Nvidia RTX gpu using Anaconda
Windows 11 Nvidia RTX 3060
medium.com
'딥러닝 > 컴퓨터비전' 카테고리의 다른 글
[컴퓨터비전] 데이터 증강 종류 및 코드 (Pytorch, Albumentations, Imgaug) (1) | 2024.12.06 |
---|---|
[컴퓨터비전] Cityscapes annotation을 COCO (.json)로 변경하는 방법 (2) | 2024.09.19 |
[컴퓨터비전] KITTI dataset label (.txt) 파일을 PASCAL VOC label (.xml)로 변경하는 방법 (0) | 2024.09.19 |