summaryrefslogtreecommitdiff
path: root/docs/nncc/v1.0.0/getting_started.md
blob: ee8014042c23ee0a31f85b32950a38a066b65bfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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" ]
    }
    ```