Nuclio 모델배포 : mmdetect

Published by onesixx on

Main.py

main.py를 만들기 위해 참고할 inference코드

inference demo

main.py의 handler작성을 위해 inference demo확인
– init_detector
– inference_detector

Python
init_context

2. 로컬에서 DL모델을 실행하기 위한 소스코드를 Nuclio 플랫폼에 적용

2-1 모델을 메모리에 로딩 (init_context(context)함수를 사용하여)

https://nuclio.io/docs/latest/concepts/best-practices-and-common-pitfalls/#use-init_context-instead-of-global-variable-declarations-or-function-calls

2-2 아래 프로세스를 위해 handler에 entry point를 정의하고, main.py에 넣는다.

  • accept incoming HTTP requests
  • run inference
  • reply with detection results

main.py

Python
main.py

2. function.yaml

base dockerfile

Shell

base docker 이미지를 기반으로 새로운 이미지 생성

YAML/YML
function.yaml

(부가적으로) 외부에서 해당 모델을 통해 접근을 위한 설정

nuclio function의 포트번호와 cvat network를 지정

spec.triggers.myHttpTrigger.attributes에 특정 port를 추가하고, 
spec.platform.attributes 에 도커 컴포즈를 실행했을 때 생성된 도커 네트워크(cvat_cvat)를 추가.

YAML/YML
function.yaml

3. Model_handler.py

4. Nuclio에 Deploy

방법1)

Shell

방법2)

Shell
Shell

Categories: vision

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x