kookmin-sw / 2019-cap1-2019_4

Flex Ads to implement advertising system in offline market
MIT License
10 stars 7 forks source link

Shell Script Trigger 를 이용한 Jetson - AWS 연동 #19

Closed james-sungjae-lee closed 5 years ago

james-sungjae-lee commented 5 years ago

기존의 시나리오는 Jetson 의 Detectnet-camera.cpp 혹은 연관 코드의 내부에 aws-sdk 와 image crop 을 위한 패키지를 include 하여 이미지 전처리 및 이미지의 aws 전송이 한 번에 이루어지도록 할 예정이었다. 하지만, 외부 패키지에 대한 build 가 어려운 동시에 이미지 저장을 위한 기능이 관련 코드에 이미 존재한다는 점을 확인하여 새로운 시나리오를 구상하였다.

새로운 시나리오는 담당 교수님과 의논한 적이 있었는데, crop 된 face image 만 local directory 에 저장하고 데이터가 저장된 순간 이를 detect 하는 shell script 를 이용하여 해당 데이터를 aws s3 저장소로 전달하는 방안이다. 이를 구현하기 위해서 detectnet.cpp 에 loadimage.h 를 include 하고 crop 영역의 이미지만 local 의 특정 위치에 이미지 데이터로 저장하는 것을 시행해 본다

james-sungjae-lee commented 5 years ago

첫 번째로 테스트 해 볼 것은 shell script 를 이용하여 데이터가 특정 dir 에 생성되었을 때 자동으로 aws s3 에 전달되도록 하는 것이다.

이에 관하여 inotify-tools 를 사용하는 것이 일반적이다. https://stackoverflow.com/questions/4060212/how-to-run-a-shell-script-when-a-file-or-directory-changes

동시에 진행되야 하는 부분은 cropped face image 가 특정 dir 에 저장되는 것이다. crop 과 관련하여 해당 코드의 메인터넌스인 dusty-nv 의 issue 가 도움이 되었다 https://github.com/dusty-nv/jetson-inference/issues/227

HSOOJ commented 5 years ago

특정 디렉토리의 변경 사항이 발생하는지 감시할 때 inotify를 주로 사용한다. python코드를 이용하여 aws s3에 crop된 이미지 파일을 저장하는데 이를 위해 inotify를 python으로 작성하기로 하였다. https://github.com/dsoprea/PyInotify

james-sungjae-lee commented 5 years ago

Jetson 환경에서 inotify for python 을 이용하여 구현 완료하였음

https://github.com/kookmin-sw/2019-cap1-2019_4/tree/face_detection/src/face_detection/local_aws_trigger