본문으로 바로가기

 

 

사전작업

 

카메라 모듈이 필요합니다.

 

라즈베리파이(Raspberry Pi) 카메라 모듈 사용하기 -1 : h264 to mp4

카메라 모듈명 WAD-JYL-ZH-CAMERAC 카메라 모듈 설정 다음 명령어로 설정환경 진입 sudo raspi-config (언어가 잘못선택되어있는데 왼쪽이 OK) Enable 설정을 하면 재부팅하라는 화면이 나옵니다. OK 모듈 사..

jvvp.tistory.com

 

 

설치

 

깃허브에서 소스코드를 다운로드합니다.

git clone https://github.com/EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi

 

해당 디렉터리로 이동

cd TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi

 

Virtualenv 를 사용하여 가상환경을 생성하고 Activate 합니다.

virtualenv venv

source venv/bin/activate

 

가상환경을 Activate 하면 터미널에 다음과 같은 형태로 나타납니다.

(venv) pi@raspberrypi:~ $ 

 

제공해주는 스크립트를 실행하면 자동으로 필요한 패키지들이 설치됩니다.

pip 명령어도 들어있으므로 가상환경은 Activate 한 상태로 진행합니다.

sh get_pi_requirements.sh

 

스크립트 안에 pip install tensorflow 가 주석으로 막혀있습니다.

명령어로 설치합니다. 

pip install tensorflow

 

모델을 다운로드합니다.

wget https://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip

 

모델 디렉터리로 압축을 풀어줍니다.

unzip coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip -d Sample_TFLite_model -d model

 

테스트해봅니다.

python TFLite_detection_webcam.py --modeldir=model

 

 

라즈베리파이3 환경에서는 프레임이 낮습니다.

 

 

 

참고

 

EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi

A tutorial showing how to train, convert, and run TensorFlow Lite object detection models on Android devices, the Raspberry Pi, and more! - EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Andro...

github.com