TensorFlow Lite를 이용한 동작 인식

2022. 10. 30. 06:01아이폰 개발

TensorFlow Lite 예제 중에 동작 인식을 구현하기 위해서는 pose_estimation 예제를 참고하면 된다. 참고로 안드로이드용은 Pose Classification을 하는 부분이 붙어 있지만, iOS용은 별도로 붙여주어야 한다.

https://github.com/tensorflow/examples/tree/master/lite/examples/pose_estimation

https://github.com/tensorflow/examples

 

GitHub - tensorflow/examples: TensorFlow examples

TensorFlow examples. Contribute to tensorflow/examples development by creating an account on GitHub.

github.com

 

입력받은 이미지를 이용하여 Classification을 하는 예제. 0.3.2에서는 다른 방법을 사용하기 때문에, TFLite Model Maker 0.2.4를 다운받아야 한다. 

https://github.com/tensorflow/examples/archive/refs/tags/tflmm/v0.2.4.zip

https://codelabs.developers.google.com/codelabs/recognize-flowers-with-tensorflow-on-ios?hl=ko#0 

 

Recognize Flowers with TensorFlow Lite on iOS  |  Google Codelabs

In this codelab you will take an image classifier, and run it on an iOS device or simulator using TensorFlow Lite.

codelabs.developers.google.com

 

ML 모델을 이용한 로직 구현시, Python의 경우 Numpy를 이용하여 다양한 연산을 수행하게 되는데 Swift에서는 Matft를 이용하면 손쉽게 포팅할 수 있다. 단, pod install로는 0.2.8 버전이 설치되며 Swift Packages를 이용해야 0.3.2 버전을 설치할 수 있다. 0.2.8 버전에서 지원이 안되는 함수들이 있기 때문에, 최신 버전을 설치해야 한다.

https://github.com/jjjkkkjjj/Matft

 

GitHub - jjjkkkjjj/Matft: Numpy-like library in swift. (Multi-dimensional Array, ndarray, matrix and vector library)

Numpy-like library in swift. (Multi-dimensional Array, ndarray, matrix and vector library) - GitHub - jjjkkkjjj/Matft: Numpy-like library in swift. (Multi-dimensional Array, ndarray, matrix and vec...

github.com

 

TensorFlow Swift 레퍼런스

https://www.tensorflow.org/lite/api_docs/swift/Classes

 

TensorFlowLiteSwift Framework Reference  |  TensorFlow Lite

TensorFlowLiteSwift Framework Reference Stay organized with collections Save and categorize content based on your preferences. Classes The following classes are available globally. A delegate that uses the Core ML framework for performing TensorFlow Lite g

www.tensorflow.org