GoogLeNet 영상 인식

BERT·2023년 5월 3일
0

Computer Vision

목록 보기
53/56

OpenCV 딥러닝 활용

GoogLeNet 영상 인식
모델 내부보다는 입출력에 집중할 것
입력 : 224x224 BGR 컬러 영상, 픽셀 값 범위는 [0, 255], 평균 색상은 (104, 117, 123)
출력 : 1x1000 행렬, 1000개 클래스에 대한 확률 값

학습된 GoogLeNet 학습 모델 및 구성 파일

googlenet
├── beagle.jpg
├── bvlc_googlenet.caffemodel
├── classification_classes_ILSVRC2012.txt
├── cup.jpg
├── deploy.prototxt
├── googlenet-12.onnx
├── main.cpp
├── pineapple.jpg
├── scooter.jpg
└── space_shuttle.jpg

OpenCV DNN Wiki

OpenCV DNN Wiki

Caffe Model Zoo

모델 파일
bvlc_googlenet.caffemodel 다운로드

구성 파일
deploy.prototxt 다운로드

ONNX model zoo

https://github.com/onnx/models
googlenet
googlenet-12.onnx 다운로드

클래스 이름 파일

1~1000번 클래스에 대한 설명을 저장한 텍스트 파일
classification_classes_ILSVRC2012.txt

구글넷 영상 인식 예제

bvlc_googlenet.caffemodel

googlenet-12.onnx

mp4 재생이 안될 때

코덱 문제
ubuntu-restricted-extras 패키지를 설치하여 많은 멀티미디어 코덱을 포함

sudo apt-get install ubuntu-restricted-extras

cvShowImage 안될 때

error: (-2:Unspecified error) The function is not implemented. Rebuild the 
library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or 
Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure 
script in function 'cvShowImage'
sudo apt update
sudo apt install libgtk2.0-dev -y
cmake -DCMAKE_BUILD_TYPE=Release \
	  -DCMAKE_INSTALL_PREFIX=../install \
      -D WITH_CUDA=ON \
      -D WITH_CUDNN=ON \
      -D OPENCV_DNN_CUDA=ON \
      -D CUDA_FAST_MATH=ON \
      -D WITH_CUBLAS=ON \
      -D WITH_CUFFT=ON \
      -D WITH_FFMPEG=ON \
      -D OPENCV_GENERATE_PKGCONFIG=ON \
      -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.5.5/modules/ \
      -D OPENCV_ENABLE_NONFREE=ON \
      ../opencv-4.5.5
make -j
sudo make install      

GTK+ 모듈을 로드 못할 때

sudo apt install libcanberra-gtk-module
echo "export GTK_MODULES=$GTK_MODULES:canberra-gtk-module" >> ~/.bashrc
source ~/.bashrc

0개의 댓글