bit가 눈 앞에서 왔다갔다

컴퓨터 비전 - MaskRCNN 본문

인턴십/KISTI

컴퓨터 비전 - MaskRCNN

헬린인형 2022. 2. 22. 01:51

 

파이썬 버전 3.6.0
텐서플로우 1.15.0
환경 Anaconda3

 

1. Dependency file에 있는 것들을 모두 설치한다.

# dependency file에 있는 설치 리스트 numpy scipy cython h5py Pillow scikit-image tensorflow-gpu==1.5 keras jupyter

tensorflow와 keras를 먼저 설치하고 나머지를 설치한다.

pip install tensorflow-gpu==1.5 pip install keras pip install numpy scipy cython Matplotlib h5py Pillow scikit-image jupyter pandas pip install opencv-python ipython
  1. Mask R-CNN을 clone한다.
conda install -c anaconda git git clone https://github.com/matterport/Mask_RCNN.git
  1. Pycocotools 다운로드

Visual C++ Build tools가 설치되어 있어야 한다.

설치 되어 있지 않으면 설치 후에 아래 명령어를 입력한다.

git clone https://github.com/philferriere/cocoapi.git pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

설치가 성공적으로 완료 시 Successfully installed pycocotools-2.0가 뜬다.

  1. imgaug 다운로드

(imgaug - 이미지 처리를 위한 라이브러리)

git clone https://github.com/aleju/imgaug.git pip install imgaug
  1. 모델 가중치 파일 다운로드
wget https://github.com/matterport/Mask_RCNN/releases/download/v2.1/mask_rcnn_balloon.h5

mask_rcnn_balloon파일을 깃허브 clone을 통해 생긴 Mask_RCNN 파일에 옮긴다.

  1. 실행
jupyter notebook    # 주피터 노트북 실행

Mask_RCNN/samples로 이동해 demo.ipynb 파일을 연다.

위의 코드를 아래와 같이 변경하면 결과 이미지가 뜬다.

 

*

참고

Failed to load the native TensorFlow runtime.

라는 에러가 뜬 경우, 여러 원인이 있을 수 있다.

cudnn, cuda, visual c++ build tools 등에 문제가 있을 수 있다.

1) 텐서플로우가 문제였던 경우 - 텐서플로우 재설치

pip3 install tensorflow-gpu==1.5.0

*재설치 하는 텐서플로우 버전에 유의할 것.

(특히 텐서플로우1, 2는 각각 사용하는 함수와 문법이 달라서 교차해서 설치하면 안됨)

2) Visual C++ 패키지 문제의 경우

https://docs.microsoft.com/ko-KR/cpp/windows/latest-supported-vc-redist?view=msvc-170

위 링크에 접속해 Visual C++ 2015-2019 재배포 패키지를 설치한다.

64비트 운영체제 사용 시 x86 x64 모두 설치해야 함.

https://code.visualstudio.com/docs/setup/linux

**

Reference

https://reyrei.tistory.com/11

https://youtu.be/2TikTv6PWDw

https://kst1.tistory.com/44

matterport/Mask_RCNN: https://junha1125.github.io/blog/pytorch-docker-git/2020-09-03-2kerasMask/

Uploaded by Notion2Tistory v1.1.0

반응형
Comments