MMDetection을 사용하여 쉽게 학습이 가능합니다.

간단한 사용법 정리

 

서론

 

Computer Vision에서 주로 사용되는 Object Detection을 무작정 따라해보았다.

 

Detection 하기 위한 class는 Car(자동차)로 목표를 잡았고, Car Object Detection 을 구현하기 위해

 

Kaggle의 데이터셋을 받아 mrcnn을 구현해보기로 결정하였다.

 

Dataset

https://www.kaggle.com/sshikamaru/car-object-detection

 

Car Object Detection

YOLO Object Detection Playground | 1000+ Videos

www.kaggle.com

 

Code

이를 구현하기 위한 참고 코드로

 

https://www.kaggle.com/ashishsingh226/car-detection-using-maskrcnn/data

 

Car-Detection-Using-MaskRCNN

Explore and run machine learning code with Kaggle Notebooks | Using data from Car Object Detection

www.kaggle.com

 

이분의 코드를 참고하였다.

 

환경 설정

mrcnn은 버전이 2가지가 있다

  • tensorflow 1.x (tf1) version

https://github.com/matterport/Mask_RCNN

 

GitHub - matterport/Mask_RCNN: Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow - GitHub - matterport/Mask_RCNN: Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow

github.com

  • tensorflow 2.x (tf2) version

https://github.com/akTwelve/Mask_RCNN

 

GitHub - akTwelve/Mask_RCNN: Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow - GitHub - akTwelve/Mask_RCNN: Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow

github.com

 

나의 컴퓨터의 환경에 맞게 잘 선택해야한다...!

요즘 그래픽카드를 고려하면 대부분 tf2 버전을 사용할 것이다.

 

!git clone https://github.com/akTwelve/Mask_RCNN.git [가상환경 DIR]Copy Icon

github에서 저장소를 복제해오거나 다운받아 가상환경에 설치하도록 한다.

 

설치가 완료되었으면 기본 세팅을 해준다.

[가상환경 DIR]$ cd Mask_RCNN
[가상환경 DIR]/Mask_RCNN$ pip install -r requirements.txt
[가상환경 DIR]/Mask_RCNN$ python setup.py installCopy Icon

mrcnn에 필요한 라이브러리를 설치하고(설정되어 있으면 안해도 상관없다)

setup.py를 통해 mrcnn을 설치한다.

 

이후 위에서 참고한 코드를 토대로 나의 DIR에 맞게 작성한 후 코드 실행 결과

 


Error 목록

  • Could not load dynamic library 'libcusolver.so.10'

https://github.com/tensorflow/tensorflow/issues/44777

 

Could not load dynamic library 'libcusolver.so.10' - TF-2.4.0RC, Cuda,CudNN, RTX 3080 · Issue #44777 · tensorflow/tensorflow

Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:...

github.com

 

여기를 참고하여

cd /.virtualenvs/myvenvname/lib/python3.8/site-packages/tensorflow/python
ln -s /path/to/my/cuda/lib/libcusolver.so.11 libcusolver.so.10Copy Icon

나의 [가상환경]의 python 환경에서 cuda 에 있는 libcusolver.so.11 파일을 libcusolver.so.10 링크파일(ln -s)로 연결하였다. (버전을 upgrade 하면서 11로 이름이 변경되어서 파일을 못찾아 나타나는 오류같다.)

욱근욱