swimmingcarp / swimming

0 stars 0 forks source link

NNAPI #2

Open swimmingcarp opened 5 years ago

swimmingcarp commented 5 years ago

Ramp Up Plan: 1, get knowledge of Android Neural Network Runtime and API

2, read Vulkan Tutorial.pdf to get knowledge of Vulkan

3, study source code and test sample

4, setup development enviroment, clone source code and build/run Celadon on KBL NUC

5, tried to write shader program for Tensor operations

Source Code source code github:https://github.com/projectceladon/nn_gpu

test github: https://github.com/googlesamples/android-ndk/tree/master/nn_sample

Documents: Android NN Introduction: https://developer.android.com/ndk/guides/neuralnetworks/

https://blog.csdn.net/qkhhyga2016/article/details/78800912 - Chinese translation

http://jackwish.net/on-android-nnapi.html

Vulkan books: Vulkan Tutorial.pdf - need go through whole book

Vulkan+Programming+Guide+-+Graham+Sellers.pdf - only be used when you need search some specific topic

Environment Setup: Introduction of Celadon Project.pptx

PROJECT-CELADON

swimmingcarp commented 5 years ago

Introduction of Celadon Project.pptx README.txt

Vulkan Tutorial.pdf

swimmingcarp commented 5 years ago
  1. application --> ML framework -(NN API)-> Android Neural Network Runtime --> HW ML framework ???

  2. training data??? images

swimmingcarp commented 5 years ago
  1. 构建模型 -- ANeuralNetworksModel_create()

ANeuralNetworksModel *model = NULL; ANeuralNetworksModel_create(&model);

  1. 调用ANeuralNetworks_addOperand()将操作数添加到模型

ANeuralNetworksOperandType tensor3x4Type; tensor3x4Type.type = ANEURALNETWORKS_TENSOR_FLOAT32; tensor3x4Type.scale = 0.f; tensor3x4Type.zeroPoint = 0; tensor3x4Type.dimensionCount = 2; uint32_t dims[2] = {3, 4}; tensor3x4Type.dimensions = dims;

// We also specify operands that are activation function specifiers. ANeuralNetworksOperandType activationType; activationType.type = ANEURALNETWORKS_INT32; activationType.scale = 0.f; activationType.zeroPoint = 0; activationType.dimensionCount = 0; activationType.dimensions = NULL;

// Now we add the seven operands, in the same order defined in the diagram. ANeuralNetworksModel_addOperand(model, &tensor3x4Type); // operand 0 ANeuralNetworksModel_addOperand(model, &tensor3x4Type); // operand 1 ANeuralNetworksModel_addOperand(model, &activationType); // operand 2 ANeuralNetworksModel_addOperand(model, &tensor3x4Type); // operand 3 ANeuralNetworksModel_addOperand(model, &tensor3x4Type); // operand 4 ANeuralNetworksModel_addOperand(model, &activationType); // operand 5 ANeuralNetworksModel_addOperand(model, &tensor3x4Type); // operand 6

https://developer.android.com/ndk/guides/neuralnetworks/

swimmingcarp commented 5 years ago

NN Network