First commit for release documents of compiler (#9354)
author남궁석/On-Device Lab(SR)/Engineer/삼성전자 <sk.namkoong@samsung.com>
Wed, 4 Dec 2019 01:28:19 +0000 (10:28 +0900)
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 4 Dec 2019 01:28:19 +0000 (10:28 +0900)
This commit includes `tutorial.md` and `getting_started.md`.
`tutorial.md` contains the simple actions for compiling inception_v3
`getting_started.md` contains more detailed sections about compiler

Signed-off-by: Seok NamKoong <sk.namkoong@samsung.com>
docs/nncc/Release_2019/getting_started.md [new file with mode: 0644]
docs/nncc/Release_2019/tutorial.md [new file with mode: 0644]

diff --git a/docs/nncc/Release_2019/getting_started.md b/docs/nncc/Release_2019/getting_started.md
new file mode 100644 (file)
index 0000000..ee80140
--- /dev/null
@@ -0,0 +1,59 @@
+# Getting Started
+
+## Environments
+
+Currently, Ubuntu 16.04 is officially supported as development environment.
+Other environments may be available but not confirmed.
+
+## How to compile your own model
+
+### What should we preapare
+
+- Tensorflow model file (`.pb` file)
+    - TensorFlow model file should be frozen. [[How to freeze?]](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py)
+    - Only inference operations are supported. Training operations are not supported yet.
+    - Quantization is not yet supported.
+    - `device` attribute should not have `GPU` value.
+- Model information file (`.info` file)
+    - `.info` file should include 4 things.
+        - Specification of input or output
+        - name of input/output node
+        - type of input/output node
+        - shape of input/output node
+    - Example format is written below.
+        ```
+        # input/output, node_name, node_type, node_shape
+        
+        input,  input:0,  TF_FLOAT,  [1, 299, 299, 3]
+        output, InceptionV3/Predictions/Reshape_1:0,  TF_FLOAT,  [1, 1001]
+        ```
+
+### How to compile
+
+1. Generate `nnpkg` using `.pb` file and `.info` file.
+    ```sh
+    tf2nnpkg --graphdef <model.pb> --info <model.info> -o <path/to/generate>
+    ```
+
+1. Check if all files are generated correctly.
+    - Directory name of `nnpkg` is prefix of `.pb` file.
+    - For example, if there is `model.pb` file, directory name will be `model`.
+        ```
+        path/to/generate
+            └ model
+                ├ model.circle
+                └ metadata
+                    └ MANIFEST
+        ```
+
+1. Check if `MANIFEST` contents are correct.
+    ```sh
+    $ cat path/to/generate/model/metadata/MANIFEST
+    {
+    "major-version" : "1",
+    "minor-version" : "0",
+    "patch-version" : "0",
+    "models"      : [ "model.circle" ],
+    "model-types" : [ "circle" ]
+    }
+    ```
diff --git a/docs/nncc/Release_2019/tutorial.md b/docs/nncc/Release_2019/tutorial.md
new file mode 100644 (file)
index 0000000..9d1f97e
--- /dev/null
@@ -0,0 +1,49 @@
+# Tutorial
+
+Let's compile Inception_v3 model and make a nnpackage!
+
+## Prepare inception_v3 files
+
+1. Download pre-trained `inception_v3.pb` model file.
+    ```sh
+    $ wget https://storage.googleapis.com/download.tensorflow.org/models/tflite/model_zoo/upload_20180427/inception_v3_2018_04_27.tgz
+    $ tar -xvf inception_v3_2018_04_27.tgz
+    ```
+1. Create model information file as `inception_v3.info`.
+    ```
+    $ cat > inception_v3.info << "END"
+    input,  input:0,  TF_FLOAT,  [1, 299, 299, 3]
+    output, InceptionV3/Predictions/Reshape_1:0,  TF_FLOAT,  [1, 1001]
+    END
+    ```
+
+## Let's compile inception_v3
+
+1. Generate `nnpkg`. In this tutorial, let's generate to current directory.
+    ```sh
+    tf2nnpkg --use-tf2circle \
+    --graphdef inception_v3.pb \
+    --info inception_v3.info \
+    -o .
+    ```
+
+## Check whether compilation is well done
+
+- Check if all files are generated correctly.
+    ```
+    inception_v3
+        ├ inception_v3.circle
+        └ metadata
+            └ MANIFEST
+    ```
+- Check if `MANIFEST` contents are correct.
+    ```sh
+    $ cat inception_v3/metadata/MANIFEST
+    {
+    "major-version" : "1",
+    "minor-version" : "0",
+    "patch-version" : "0",
+    "models"      : [ "inception_v3.circle" ],
+    "model-types" : [ "circle" ]
+    }
+    ```