├── program ├── kann │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ ├── preprocess.py │ └── postprocess.py └── .cm │ ├── alias-a-kann │ └── alias-u-842c1b1e69052423 ├── .cm ├── alias-a-soft ├── alias-u-5e1100048ab875d7 ├── alias-a-package ├── alias-a-program ├── alias-a-script ├── alias-u-1dc07ee0f4742028 ├── alias-u-84e27ad9dd12e734 ├── alias-u-b0ac08fe1d3c2615 ├── alias-a-platform.init └── alias-u-38a2f5438d8555b6 ├── script ├── caffe2kann │ ├── .cm │ │ ├── desc.json │ │ ├── meta.json │ │ └── info.json │ └── convert.sh ├── explore-models │ ├── .cm │ │ ├── desc.json │ │ ├── meta.json │ │ └── info.json │ ├── explore-models-benchmarking.py │ └── explore-models-testing-accuracy.py ├── imagenet2kann │ ├── .cm │ │ ├── desc.json │ │ ├── meta.json │ │ └── info.json │ └── convert.sh └── .cm │ ├── alias-a-caffe2kann │ ├── alias-a-imagenet2kann │ ├── alias-u-6dc41d90eec4d0c9 │ ├── alias-u-7974189a79ff82b1 │ ├── alias-a-explore-models │ └── alias-u-46f3ad7d45d1fba9 ├── soft ├── model.kann │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ └── customize.py ├── sdk.kann │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ └── customize.py ├── .cm │ ├── alias-a-model.kann │ ├── alias-a-sdk.kann │ ├── alias-u-14afcbf65773e9bb │ ├── alias-u-2025bf79b2048719 │ ├── alias-a-dataset.imagenet.val.kann │ └── alias-u-8db14d6a8ccd42fe └── dataset.imagenet.val.kann │ ├── .cm │ ├── desc.json │ ├── info.json │ └── meta.json │ └── customize.py ├── platform.init ├── emb02 │ ├── .cm │ │ ├── desc.json │ │ ├── meta.json │ │ └── info.json │ ├── ck-set-cpu-performance │ ├── ck-set-cpu-powersave │ ├── ck-set-ddr-performance │ ├── ck-set-ddr-powersave │ ├── ck-print-freq │ ├── ck-set-powersave │ ├── ck-set-performance │ ├── ck-print-cpu-freq │ ├── ck-print-ddr-freq │ ├── ck-set-cpu-frequency │ └── ck-set-ddr-frequency └── .cm │ ├── alias-a-emb02 │ └── alias-u-a9c952d27a86b805 ├── package ├── kannmodel-bvlc-alexnet │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ └── deploy.prototxt ├── kannmodel-bvlc-googlenet │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ └── deploy.prototxt ├── .cm │ ├── alias-a-kannmodel-bvlc-alexnet │ ├── alias-u-adfbecade7145bf6 │ ├── alias-a-kannmodel-bvlc-googlenet │ ├── alias-u-b84a2fbb8237805d │ ├── alias-a-kanndataset-imagenet-val-bvlc-alexnet │ ├── alias-a-kannmodel-deepscale-squeezenet-1.0 │ ├── alias-a-kannmodel-deepscale-squeezenet-1.1 │ ├── alias-u-62031424b3f98614 │ ├── alias-u-834bd9822b4d1bb7 │ ├── alias-u-e40637941dee427a │ ├── alias-a-kanndataset-imagenet-val-bvlc-googlenet │ ├── alias-u-8f831fdd4948e344 │ ├── alias-a-kanndataset-imagenet-val-deepscale-squeezenet-1.0 │ ├── alias-a-kanndataset-imagenet-val-deepscale-squeezenet-1.1 │ ├── alias-u-29fdc049f4b87a3f │ └── alias-u-d5e4995b2f02cbeb ├── kannmodel-deepscale-squeezenet-1.0 │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ └── deploy.prototxt ├── kannmodel-deepscale-squeezenet-1.1 │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ └── deploy.prototxt ├── kanndataset-imagenet-val-bvlc-alexnet │ └── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json ├── kanndataset-imagenet-val-bvlc-googlenet │ └── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json ├── kanndataset-imagenet-val-deepscale-squeezenet-1.0 │ └── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json └── kanndataset-imagenet-val-deepscale-squeezenet-1.1 │ └── .cm │ ├── desc.json │ ├── info.json │ └── meta.json ├── COPYRIGHT.txt ├── .gitignore ├── .ckr.json ├── LICENSE.txt └── README.md /program/kann/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.cm/alias-a-soft: -------------------------------------------------------------------------------- 1 | 5e1100048ab875d7 2 | -------------------------------------------------------------------------------- /.cm/alias-u-5e1100048ab875d7: -------------------------------------------------------------------------------- 1 | soft 2 | -------------------------------------------------------------------------------- /script/caffe2kann/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /script/caffe2kann/.cm/meta.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /soft/model.kann/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /soft/sdk.kann/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.cm/alias-a-package: -------------------------------------------------------------------------------- 1 | 1dc07ee0f4742028 2 | -------------------------------------------------------------------------------- /.cm/alias-a-program: -------------------------------------------------------------------------------- 1 | b0ac08fe1d3c2615 2 | -------------------------------------------------------------------------------- /.cm/alias-a-script: -------------------------------------------------------------------------------- 1 | 84e27ad9dd12e734 2 | -------------------------------------------------------------------------------- /.cm/alias-u-1dc07ee0f4742028: -------------------------------------------------------------------------------- 1 | package 2 | -------------------------------------------------------------------------------- /.cm/alias-u-84e27ad9dd12e734: -------------------------------------------------------------------------------- 1 | script 2 | -------------------------------------------------------------------------------- /.cm/alias-u-b0ac08fe1d3c2615: -------------------------------------------------------------------------------- 1 | program 2 | -------------------------------------------------------------------------------- /platform.init/emb02/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /platform.init/emb02/.cm/meta.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /script/explore-models/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /script/explore-models/.cm/meta.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /script/imagenet2kann/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /script/imagenet2kann/.cm/meta.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.cm/alias-a-platform.init: -------------------------------------------------------------------------------- 1 | 38a2f5438d8555b6 2 | -------------------------------------------------------------------------------- /.cm/alias-u-38a2f5438d8555b6: -------------------------------------------------------------------------------- 1 | platform.init 2 | -------------------------------------------------------------------------------- /program/.cm/alias-a-kann: -------------------------------------------------------------------------------- 1 | 842c1b1e69052423 2 | -------------------------------------------------------------------------------- /program/.cm/alias-u-842c1b1e69052423: -------------------------------------------------------------------------------- 1 | kann 2 | -------------------------------------------------------------------------------- /soft/.cm/alias-a-model.kann: -------------------------------------------------------------------------------- 1 | 2025bf79b2048719 2 | -------------------------------------------------------------------------------- /soft/.cm/alias-a-sdk.kann: -------------------------------------------------------------------------------- 1 | 14afcbf65773e9bb 2 | -------------------------------------------------------------------------------- /soft/.cm/alias-u-14afcbf65773e9bb: -------------------------------------------------------------------------------- 1 | sdk.kann 2 | -------------------------------------------------------------------------------- /soft/.cm/alias-u-2025bf79b2048719: -------------------------------------------------------------------------------- 1 | model.kann 2 | -------------------------------------------------------------------------------- /package/kannmodel-bvlc-alexnet/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /package/kannmodel-bvlc-googlenet/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /platform.init/.cm/alias-a-emb02: -------------------------------------------------------------------------------- 1 | a9c952d27a86b805 2 | -------------------------------------------------------------------------------- /platform.init/.cm/alias-u-a9c952d27a86b805: -------------------------------------------------------------------------------- 1 | emb02 2 | -------------------------------------------------------------------------------- /script/.cm/alias-a-caffe2kann: -------------------------------------------------------------------------------- 1 | 6dc41d90eec4d0c9 2 | -------------------------------------------------------------------------------- /script/.cm/alias-a-imagenet2kann: -------------------------------------------------------------------------------- 1 | 7974189a79ff82b1 2 | -------------------------------------------------------------------------------- /script/.cm/alias-u-6dc41d90eec4d0c9: -------------------------------------------------------------------------------- 1 | caffe2kann 2 | -------------------------------------------------------------------------------- /script/.cm/alias-u-7974189a79ff82b1: -------------------------------------------------------------------------------- 1 | imagenet2kann 2 | -------------------------------------------------------------------------------- /soft/dataset.imagenet.val.kann/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /COPYRIGHT.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 cTuning foundation 2 | -------------------------------------------------------------------------------- /script/.cm/alias-a-explore-models: -------------------------------------------------------------------------------- 1 | 46f3ad7d45d1fba9 2 | -------------------------------------------------------------------------------- /script/.cm/alias-u-46f3ad7d45d1fba9: -------------------------------------------------------------------------------- 1 | explore-models 2 | -------------------------------------------------------------------------------- /package/.cm/alias-a-kannmodel-bvlc-alexnet: -------------------------------------------------------------------------------- 1 | adfbecade7145bf6 2 | -------------------------------------------------------------------------------- /package/.cm/alias-u-adfbecade7145bf6: -------------------------------------------------------------------------------- 1 | kannmodel-bvlc-alexnet 2 | -------------------------------------------------------------------------------- /package/kannmodel-deepscale-squeezenet-1.0/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /package/kannmodel-deepscale-squeezenet-1.1/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /soft/.cm/alias-a-dataset.imagenet.val.kann: -------------------------------------------------------------------------------- 1 | 8db14d6a8ccd42fe 2 | -------------------------------------------------------------------------------- /soft/.cm/alias-u-8db14d6a8ccd42fe: -------------------------------------------------------------------------------- 1 | dataset.imagenet.val.kann 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *tmp.* 3 | *tmp/ 4 | .ipynb_checkpoints/ 5 | -------------------------------------------------------------------------------- /package/.cm/alias-a-kannmodel-bvlc-googlenet: -------------------------------------------------------------------------------- 1 | b84a2fbb8237805d 2 | -------------------------------------------------------------------------------- /package/.cm/alias-u-b84a2fbb8237805d: -------------------------------------------------------------------------------- 1 | kannmodel-bvlc-googlenet 2 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-bvlc-alexnet/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-bvlc-googlenet/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /package/.cm/alias-a-kanndataset-imagenet-val-bvlc-alexnet: -------------------------------------------------------------------------------- 1 | 834bd9822b4d1bb7 2 | -------------------------------------------------------------------------------- /package/.cm/alias-a-kannmodel-deepscale-squeezenet-1.0: -------------------------------------------------------------------------------- 1 | 62031424b3f98614 2 | -------------------------------------------------------------------------------- /package/.cm/alias-a-kannmodel-deepscale-squeezenet-1.1: -------------------------------------------------------------------------------- 1 | e40637941dee427a 2 | -------------------------------------------------------------------------------- /package/.cm/alias-u-62031424b3f98614: -------------------------------------------------------------------------------- 1 | kannmodel-deepscale-squeezenet-1.0 2 | -------------------------------------------------------------------------------- /package/.cm/alias-u-834bd9822b4d1bb7: -------------------------------------------------------------------------------- 1 | kanndataset-imagenet-val-bvlc-alexnet 2 | -------------------------------------------------------------------------------- /package/.cm/alias-u-e40637941dee427a: -------------------------------------------------------------------------------- 1 | kannmodel-deepscale-squeezenet-1.1 2 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-deepscale-squeezenet-1.0/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-deepscale-squeezenet-1.1/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /package/.cm/alias-a-kanndataset-imagenet-val-bvlc-googlenet: -------------------------------------------------------------------------------- 1 | 8f831fdd4948e344 2 | -------------------------------------------------------------------------------- /package/.cm/alias-u-8f831fdd4948e344: -------------------------------------------------------------------------------- 1 | kanndataset-imagenet-val-bvlc-googlenet 2 | -------------------------------------------------------------------------------- /package/.cm/alias-a-kanndataset-imagenet-val-deepscale-squeezenet-1.0: -------------------------------------------------------------------------------- 1 | 29fdc049f4b87a3f 2 | -------------------------------------------------------------------------------- /package/.cm/alias-a-kanndataset-imagenet-val-deepscale-squeezenet-1.1: -------------------------------------------------------------------------------- 1 | d5e4995b2f02cbeb 2 | -------------------------------------------------------------------------------- /package/.cm/alias-u-29fdc049f4b87a3f: -------------------------------------------------------------------------------- 1 | kanndataset-imagenet-val-deepscale-squeezenet-1.0 2 | -------------------------------------------------------------------------------- /package/.cm/alias-u-d5e4995b2f02cbeb: -------------------------------------------------------------------------------- 1 | kanndataset-imagenet-val-deepscale-squeezenet-1.1 2 | -------------------------------------------------------------------------------- /platform.init/emb02/ck-set-cpu-performance: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Collective Knowledge (CK) 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer: Anton Lokhmotov, anton@dividiti.com 10 | # 11 | 12 | cd "$(dirname "${BASH_SOURCE[0]}")" 13 | . ck-set-cpu-frequency 500 14 | -------------------------------------------------------------------------------- /platform.init/emb02/ck-set-cpu-powersave: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Collective Knowledge (CK) 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer: Anton Lokhmotov, anton@dividiti.com 10 | # 11 | 12 | cd "$(dirname "${BASH_SOURCE[0]}")" 13 | . ck-set-cpu-frequency 400 14 | -------------------------------------------------------------------------------- /platform.init/emb02/ck-set-ddr-performance: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Collective Knowledge (CK) 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer: Anton Lokhmotov, anton@dividiti.com 10 | # 11 | 12 | cd "$(dirname "${BASH_SOURCE[0]}")" 13 | . ck-set-ddr-frequency 1333 14 | -------------------------------------------------------------------------------- /platform.init/emb02/ck-set-ddr-powersave: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Collective Knowledge (CK) 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer: Anton Lokhmotov, anton@dividiti.com 10 | # 11 | 12 | cd "$(dirname "${BASH_SOURCE[0]}")" 13 | . ck-set-ddr-frequency 1066 14 | -------------------------------------------------------------------------------- /platform.init/emb02/ck-print-freq: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Collective Knowledge (CK) 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer: Anton Lokhmotov, anton@dividiti.com 10 | # 11 | 12 | cd "$(dirname "${BASH_SOURCE[0]}")" 13 | . ck-print-cpu-freq 14 | . ck-print-ddr-freq 15 | -------------------------------------------------------------------------------- /platform.init/emb02/ck-set-powersave: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Collective Knowledge (CK) 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer: Anton Lokhmotov, anton@dividiti.com 10 | # 11 | 12 | cd "$(dirname "${BASH_SOURCE[0]}")" 13 | . ck-set-cpu-powersave 14 | . ck-set-ddr-powersave 15 | -------------------------------------------------------------------------------- /platform.init/emb02/ck-set-performance: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Collective Knowledge (CK) 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer: Anton Lokhmotov, anton@dividiti.com 10 | # 11 | 12 | cd "$(dirname "${BASH_SOURCE[0]}")" 13 | . ck-set-cpu-performance 14 | . ck-set-ddr-performance 15 | -------------------------------------------------------------------------------- /soft/model.kann/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "2025bf79b2048719", 3 | "backup_module_uid": "5e1100048ab875d7", 4 | "backup_module_uoa": "soft", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-04-27T00:52:58.183263", 8 | "version": [ 9 | "1", 10 | "8", 11 | "7", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "model.kann" 16 | } 17 | -------------------------------------------------------------------------------- /program/kann/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "842c1b1e69052423", 3 | "backup_module_uid": "b0ac08fe1d3c2615", 4 | "backup_module_uoa": "program", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-04-27T01:27:03.688013", 8 | "version": [ 9 | "1", 10 | "8", 11 | "7", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "kann" 16 | } 17 | -------------------------------------------------------------------------------- /soft/sdk.kann/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "14afcbf65773e9bb", 3 | "backup_module_uid": "5e1100048ab875d7", 4 | "backup_module_uoa": "soft", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-19T22:05:24.849986", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "sdk.kann" 16 | } 17 | -------------------------------------------------------------------------------- /script/caffe2kann/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "6dc41d90eec4d0c9", 3 | "backup_module_uid": "84e27ad9dd12e734", 4 | "backup_module_uoa": "script", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-19T23:04:18.961645", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "caffe2kann" 16 | } 17 | -------------------------------------------------------------------------------- /platform.init/emb02/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "a9c952d27a86b805", 3 | "backup_module_uid": "38a2f5438d8555b6", 4 | "backup_module_uoa": "platform.init", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-16T22:32:13.129497", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "emb02" 16 | } 17 | -------------------------------------------------------------------------------- /script/imagenet2kann/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "7974189a79ff82b1", 3 | "backup_module_uid": "84e27ad9dd12e734", 4 | "backup_module_uoa": "script", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-22T12:48:55.030872", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "imagenet2kann" 16 | } 17 | -------------------------------------------------------------------------------- /script/explore-models/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "46f3ad7d45d1fba9", 3 | "backup_module_uid": "84e27ad9dd12e734", 4 | "backup_module_uoa": "script", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-25T00:07:53.196124", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "explore-models" 16 | } 17 | -------------------------------------------------------------------------------- /.ckr.json: -------------------------------------------------------------------------------- 1 | { 2 | "data_uid": "aa8299de464392e3", 3 | "data_name": "ck-kann", 4 | "dict": { 5 | "shared": "git", 6 | "sync": "yes", 7 | "repo_deps": [ 8 | { 9 | "repo_uoa": "ck-caffe", 10 | "repo_url": "http://github.com/dividiti/ck-caffe" 11 | } 12 | ], 13 | "url": "http://github.com/ctuning/ck-kann" 14 | }, 15 | "data_alias": "ck-kann", 16 | "data_uoa": "ck-kann" 17 | } 18 | -------------------------------------------------------------------------------- /package/kannmodel-bvlc-alexnet/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "adfbecade7145bf6", 3 | "backup_module_uid": "1dc07ee0f4742028", 4 | "backup_module_uoa": "package", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-22T16:21:13.320678", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "kannmodel-bvlc-alexnet" 16 | } 17 | -------------------------------------------------------------------------------- /soft/dataset.imagenet.val.kann/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "8db14d6a8ccd42fe", 3 | "backup_module_uid": "5e1100048ab875d7", 4 | "backup_module_uoa": "soft", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-04T00:47:04.312909", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "dataset.imagenet.val.kann" 16 | } 17 | -------------------------------------------------------------------------------- /soft/sdk.kann/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "auto_detect": "yes", 3 | "customize": { 4 | "ck_version": 10, 5 | "env_prefix": "CK_ENV_SDK_KANN", 6 | "limit_recursion_dir_search": { 7 | "linux": 1 8 | }, 9 | "soft_file": { 10 | "linux": "python/caffe_to_kann.py" 11 | } 12 | }, 13 | "soft_name": "KaNN Development Package", 14 | "tags": [ 15 | "kann", 16 | "sdk", 17 | "kalray" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /package/kannmodel-bvlc-googlenet/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "b84a2fbb8237805d", 3 | "backup_module_uid": "1dc07ee0f4742028", 4 | "backup_module_uoa": "package", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-22T15:18:35.236828", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "kannmodel-bvlc-googlenet" 16 | } 17 | -------------------------------------------------------------------------------- /package/kannmodel-deepscale-squeezenet-1.0/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "62031424b3f98614", 3 | "backup_module_uid": "1dc07ee0f4742028", 4 | "backup_module_uoa": "package", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-22T11:56:52.730793", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "kannmodel-deepscale-squeezenet-1.0" 16 | } 17 | -------------------------------------------------------------------------------- /package/kannmodel-deepscale-squeezenet-1.1/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "e40637941dee427a", 3 | "backup_module_uid": "1dc07ee0f4742028", 4 | "backup_module_uoa": "package", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-20T17:16:18.556622", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "kannmodel-deepscale-squeezenet-1.1" 16 | } 17 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-bvlc-alexnet/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "834bd9822b4d1bb7", 3 | "backup_module_uid": "1dc07ee0f4742028", 4 | "backup_module_uoa": "package", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-22T16:30:11.822800", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "kanndataset-imagenet-val-bvlc-alexnet" 16 | } 17 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-bvlc-googlenet/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "8f831fdd4948e344", 3 | "backup_module_uid": "1dc07ee0f4742028", 4 | "backup_module_uoa": "package", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-22T15:31:40.027160", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "kanndataset-imagenet-val-bvlc-googlenet" 16 | } 17 | -------------------------------------------------------------------------------- /soft/model.kann/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "auto_detect": "yes", 3 | "customize": { 4 | "ck_version": 10, 5 | "env_prefix": "CK_ENV_MODEL_KANN", 6 | "limit_recursion_dir_search": { 7 | "linux": 2 8 | }, 9 | "soft_file": { 10 | "linux": "multibin_bin.mpk" 11 | } 12 | }, 13 | "soft_name": "KaNN model (net and weights)", 14 | "tags": [ 15 | "kann", 16 | "net", 17 | "weights", 18 | "kannmodel", 19 | "kalray" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-deepscale-squeezenet-1.0/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "29fdc049f4b87a3f", 3 | "backup_module_uid": "1dc07ee0f4742028", 4 | "backup_module_uoa": "package", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-22T13:11:42.611133", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "kanndataset-imagenet-val-deepscale-squeezenet-1.0" 16 | } 17 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-deepscale-squeezenet-1.1/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "d5e4995b2f02cbeb", 3 | "backup_module_uid": "1dc07ee0f4742028", 4 | "backup_module_uoa": "package", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2017-05-04T00:13:04.949015", 8 | "version": [ 9 | "1", 10 | "9", 11 | "1", 12 | "1" 13 | ] 14 | }, 15 | "data_name": "kanndataset-imagenet-val-deepscale-squeezenet-1.1" 16 | } 17 | -------------------------------------------------------------------------------- /platform.init/emb02/ck-print-cpu-freq: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Collective Knowledge (CK) 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer: Anton Lokhmotov, anton@dividiti.com 10 | # 11 | 12 | echo "*** Current CPU frequency:" 13 | /usr/local/k1tools/bin/k1-dt-tool --chip-freq 14 | 15 | echo "*** Min CPU frequency:" 16 | echo "400" 17 | 18 | echo "*** Max CPU frequency:" 19 | echo "500" 20 | 21 | echo "*** Available CPU frequencies:" 22 | echo "400 500" 23 | -------------------------------------------------------------------------------- /platform.init/emb02/ck-print-ddr-freq: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Collective Knowledge (CK) 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer: Anton Lokhmotov, anton@dividiti.com 10 | # 11 | 12 | echo "*** Current DDR frequency:" 13 | /usr/local/k1tools/bin/k1-dt-tool --ddr-freq 14 | 15 | echo "*** Min DDR frequency:" 16 | echo "1066" 17 | 18 | echo "*** Max DDR frequency:" 19 | echo "1333" 20 | 21 | echo "*** Available DDR frequencies:" 22 | echo "1066 1333" 23 | -------------------------------------------------------------------------------- /soft/dataset.imagenet.val.kann/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "auto_detect": "yes", 3 | "customize": { 4 | "check_that_exists": "yes", 5 | "ck_version": 10, 6 | "ck_features_file":"ck-features.json", 7 | "env_prefix": "CK_ENV_DATASET_IMAGENET_VAL_KANN", 8 | "limit_recursion_dir_search": { 9 | "linux": 3, 10 | "win": 3 11 | }, 12 | "soft_file": { 13 | "linux": "ILSVRC2012_val_00000001.kann_input", 14 | "win": "ILSVRC2012_val_00000001.kann_input" 15 | } 16 | }, 17 | "deps": {}, 18 | "soft_name": "ImageNet dataset (validation, KaNN)", 19 | "tags": [ 20 | "dataset", 21 | "imagenet", 22 | "val-kann", 23 | "kann" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /platform.init/emb02/ck-set-cpu-frequency: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Collective Knowledge (CK) 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer: Anton Lokhmotov, anton@dividiti.com 10 | # 11 | 12 | if [ "$CK_CPU_FREQ" != "" ]; then 13 | freq=$CK_CPU_FREQ 14 | fi 15 | 16 | if [ "$1" != "" ]; then 17 | freq="$1" 18 | fi 19 | 20 | if [[ "$freq" =~ ^(400|500)$ ]]; then 21 | echo " Setting CPU frequency=$freq ..." 22 | /usr/local/k1tools/bin/k1-dt-tool --chip-freq -v $freq 23 | else 24 | echo " CPU frequency must be 400 or 500! Ignoring ..." 25 | fi 26 | 27 | echo " Current CPU frequency=$(/usr/local/k1tools/bin/k1-dt-tool --chip-freq)" 28 | -------------------------------------------------------------------------------- /platform.init/emb02/ck-set-ddr-frequency: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Collective Knowledge (CK) 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer: Anton Lokhmotov, anton@dividiti.com 10 | # 11 | 12 | if [ "$CK_DDR_FREQ" != "" ]; then 13 | freq=$CK_DDR_FREQ 14 | fi 15 | 16 | if [ "$1" != "" ]; then 17 | freq="$1" 18 | fi 19 | 20 | if [[ "$freq" =~ ^(1066|1333)$ ]]; then 21 | echo " Setting DDR frequency=$freq ..." 22 | /usr/local/k1tools/bin/k1-dt-tool --ddr-freq -v $freq 23 | else 24 | echo " DDR frequency must be 1066 or 1333! Ignoring ..." 25 | fi 26 | 27 | echo " Current DDR frequency=$(/usr/local/k1tools/bin/k1-dt-tool --ddr-freq)" 28 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-bvlc-googlenet/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "aux_uoa": "4e3e9dd897f125bb", 3 | "check_exit_status": "yes", 4 | "customize": { 5 | "force_ask_path": "no", 6 | "install_env": {}, 7 | "no_os_in_suggested_path": "yes", 8 | "no_ver_in_suggested_path": "no", 9 | "version": "bvlc-googlenet" 10 | }, 11 | "deps": { 12 | "dataset-imagenet-raw": { 13 | "add_to_path": "no", 14 | "local": "yes", 15 | "name": "ImageNet dataset (raw)", 16 | "sort": 30, 17 | "tags": "dataset,imagenet,raw" 18 | }, 19 | "kannmodel": { 20 | "add_to_path": "no", 21 | "local": "yes", 22 | "name": "KaNN model (net and weights)", 23 | "sort": 10, 24 | "tags": "kannmodel,bvlc,googlenet" 25 | } 26 | }, 27 | "end_full_path": { 28 | "linux": "ILSVRC2012_val_00000001.kann_input", 29 | "win": "ILSVRC2012_val_00000001.kann_input" 30 | }, 31 | "need_cpu_info": "no", 32 | "process_script": "convert", 33 | "remove_deps": "yes", 34 | "soft_uoa": "8db14d6a8ccd42fe", 35 | "suggested_path": "dataset-imagenet-ilsvrc2012-val-kann", 36 | "tags": [ 37 | "dataset", 38 | "imagenet", 39 | "val", 40 | "kann", 41 | "bvlc", 42 | "googlenet" 43 | ], 44 | "use_scripts_from_another_entry": { 45 | "data_uoa": "imagenet2kann", 46 | "module_uoa": "script", 47 | "use_repo": "ck-kann" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-bvlc-alexnet/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "aux_uoa": "4e3e9dd897f125bb", 3 | "check_exit_status": "yes", 4 | "customize": { 5 | "force_ask_path": "no", 6 | "install_env": {}, 7 | "no_os_in_suggested_path": "yes", 8 | "no_ver_in_suggested_path": "no", 9 | "version": "bvlc-alexnet" 10 | }, 11 | "deps": { 12 | "dataset-imagenet-raw": { 13 | "add_to_path": "no", 14 | "local": "yes", 15 | "name": "ImageNet dataset (raw)", 16 | "sort": 30, 17 | "tags": "dataset,imagenet,raw" 18 | }, 19 | "kannmodel": { 20 | "add_to_path": "no", 21 | "local": "yes", 22 | "name": "KaNN model (net and weights)", 23 | "sort": 10, 24 | "tags": "kannmodel,bvlc,alexnet" 25 | } 26 | }, 27 | "end_full_path": { 28 | "linux": "ILSVRC2012_val_00000001.kann_input", 29 | "win": "ILSVRC2012_val_00000001.kann_input" 30 | }, 31 | "need_cpu_info": "no", 32 | "process_script": "convert", 33 | "remove_deps": "yes", 34 | "soft_uoa": "8db14d6a8ccd42fe", 35 | "suggested_path": "dataset-imagenet-ilsvrc2012-val-kann", 36 | "tags": [ 37 | "dataset", 38 | "imagenet", 39 | "val", 40 | "kann", 41 | "bvlc", 42 | "alexnet" 43 | ], 44 | "use_scripts_from_another_entry": { 45 | "data_uoa": "imagenet2kann", 46 | "module_uoa": "script", 47 | "use_repo": "ck-kann" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-deepscale-squeezenet-1.0/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "aux_uoa": "4e3e9dd897f125bb", 3 | "check_exit_status": "yes", 4 | "customize": { 5 | "force_ask_path": "no", 6 | "install_env": {}, 7 | "no_os_in_suggested_path": "yes", 8 | "no_ver_in_suggested_path": "no", 9 | "version": "deepscale-squeezenet-1.0" 10 | }, 11 | "deps": { 12 | "dataset-imagenet-raw": { 13 | "add_to_path": "no", 14 | "local": "yes", 15 | "name": "ImageNet dataset (raw)", 16 | "sort": 30, 17 | "tags": "dataset,imagenet,raw" 18 | }, 19 | "kannmodel": { 20 | "add_to_path": "no", 21 | "local": "yes", 22 | "name": "KaNN model (net and weights)", 23 | "sort": 10, 24 | "tags": "kannmodel,deepscale,squeezenet,v1.0" 25 | } 26 | }, 27 | "end_full_path": { 28 | "linux": "ILSVRC2012_val_00000001.kann_input", 29 | "win": "ILSVRC2012_val_00000001.kann_input" 30 | }, 31 | "need_cpu_info": "no", 32 | "process_script": "convert", 33 | "remove_deps": "yes", 34 | "soft_uoa": "8db14d6a8ccd42fe", 35 | "suggested_path": "dataset-imagenet-ilsvrc2012-val-kann", 36 | "tags": [ 37 | "dataset", 38 | "imagenet", 39 | "val", 40 | "kann", 41 | "deepscale", 42 | "squeezenet", 43 | "v1.0", 44 | "v1" 45 | ], 46 | "use_scripts_from_another_entry": { 47 | "data_uoa": "imagenet2kann", 48 | "module_uoa": "script", 49 | "use_repo": "ck-kann" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /package/kanndataset-imagenet-val-deepscale-squeezenet-1.1/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "check_exit_status": "yes", 3 | "aux_uoa": "4e3e9dd897f125bb", 4 | "customize": { 5 | "force_ask_path": "no", 6 | "install_env": {}, 7 | "no_os_in_suggested_path": "yes", 8 | "no_ver_in_suggested_path": "no", 9 | "version": "deepscale-squeezenet-1.1" 10 | }, 11 | "deps": { 12 | "kannmodel": { 13 | "local": "yes", 14 | "add_to_path": "no", 15 | "name": "KaNN model (net and weights)", 16 | "sort": 10, 17 | "tags": "kannmodel,deepscale,squeezenet,v1.1" 18 | }, 19 | "dataset-imagenet-raw": { 20 | "local": "yes", 21 | "add_to_path": "no", 22 | "name": "ImageNet dataset (raw)", 23 | "sort": 30, 24 | "tags": "dataset,imagenet,raw" 25 | } 26 | }, 27 | "end_full_path": { 28 | "linux": "ILSVRC2012_val_00000001.kann_input", 29 | "win": "ILSVRC2012_val_00000001.kann_input" 30 | }, 31 | "need_cpu_info": "no", 32 | "process_script": "convert", 33 | "remove_deps": "yes", 34 | "soft_uoa": "8db14d6a8ccd42fe", 35 | "suggested_path": "dataset-imagenet-ilsvrc2012-val-kann", 36 | "tags": [ 37 | "dataset", 38 | "imagenet", 39 | "val", 40 | "kann", 41 | "deepscale", 42 | "squeezenet", 43 | "v1.1", 44 | "v1" 45 | ], 46 | "use_scripts_from_another_entry": { 47 | "use_repo": "ck-kann", 48 | "module_uoa": "script", 49 | "data_uoa": "imagenet2kann" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /script/imagenet2kann/convert.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # Installation script for the 2012 ImageNet Large Scale Visual Recognition 5 | # Challenge (ILSVRC'12) validation dataset converted into the KaNN format. 6 | # 7 | # See CK LICENSE.txt for licensing details. 8 | # See CK COPYRIGHT.txt for copyright details. 9 | # 10 | # Developer(s): 11 | # - Anton Lokhmotov, anton@dividiti.com, 2016-2017 12 | # - Grigori Fursin, Grigori.Fursin@cTuning.org, 2016 13 | 14 | # PACKAGE_DIR 15 | # INSTALL_DIR 16 | 17 | export CK_KANN_INPUT_PREPARATOR=${CK_ENV_MODEL_KANN_INPUT_PREPARATOR} 18 | export CK_KANN_IMAGENET_VAL=${INSTALL_DIR}/data/ 19 | mkdir -p ${CK_KANN_IMAGENET_VAL} 20 | 21 | ################################################################################ 22 | echo "" 23 | echo "Converting images ..." 24 | echo "- from directory: ${CK_CAFFE_IMAGENET_VAL}" 25 | echo "- to directory: ${CK_KANN_IMAGENET_VAL}" 26 | echo "- using script: ${CK_KANN_INPUT_PREPARATOR}" 27 | echo "" 28 | 29 | for filename in ${CK_CAFFE_IMAGENET_VAL}/ILSVRC2012_val_*.JPEG; do 30 | echo "Converting '$(basename "$filename")' ..." 31 | python ${CK_KANN_INPUT_PREPARATOR} $(basename "$filename" .JPEG).kann_input "$filename" 32 | done 33 | echo "" 34 | 35 | ################################################################################ 36 | if [ "${?}" != "0" ] ; then 37 | echo "Error: Converting one or more images in ${PWD} failed!" 38 | exit 1 39 | fi 40 | 41 | echo "Successfully converted images ..." 42 | exit 0 43 | -------------------------------------------------------------------------------- /program/kann/preprocess.py: -------------------------------------------------------------------------------- 1 | # 2 | # Prepare temporary KaNN input by concatenating several images. 3 | # 4 | # Developer(s): 5 | # - Anton Lokhmotov, dividiti, 2017 6 | # 7 | 8 | import glob 9 | import os 10 | import shutil 11 | import subprocess 12 | 13 | 14 | def ck_preprocess(i): 15 | 16 | ck=i['ck_kernel'] 17 | deps=i['deps'] 18 | env=i['env'] 19 | 20 | # Get the maximum number of images. 21 | max_num_images=int(env.get('CK_KANN_MAX_NUMBER_IMAGES', 1)) 22 | 23 | # Create temporary input using random max_num_images from the kann-val dataset. 24 | # TODO: Use images with consecutive numbering? 25 | imagenet_val=deps['kanndataset'] 26 | imagenet_val_dir=imagenet_val['dict']['env']['CK_ENV_DATASET_IMAGENET_VAL_KANN'] 27 | imagenet_val_files=glob.glob(imagenet_val_dir+'/ILSVRC2012_val_*.kann_input') 28 | 29 | kann_input_file=os.path.join(os.getcwd(), 'tmp-kann-input.tmp') 30 | kann_paths_file=os.path.join(os.getcwd(), 'tmp-kann-paths.tmp') 31 | with open(kann_input_file, 'wb') as kann_input_f, open(kann_paths_file, 'w') as kann_paths_f: 32 | num_images = 0 33 | for imagenet_val_file in imagenet_val_files: 34 | with open(imagenet_val_file, 'rb') as imagenet_val_f: 35 | shutil.copyfileobj(imagenet_val_f, kann_input_f) 36 | kann_paths_f.write(os.path.basename(imagenet_val_file) + '\n') 37 | num_images += 1 38 | if num_images >= max_num_images: break 39 | 40 | b='' 41 | return {'return':0, 'bat':b} 42 | 43 | # Do not add anything here! 44 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2018 cTuning foundation 2 | All rights reserved 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the cTuning foundation 15 | nor the names of its contributors may be used to endorse 16 | or promote products derived from this software without 17 | specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /package/kannmodel-deepscale-squeezenet-1.1/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "check_exit_status": "yes", 3 | "customize": { 4 | "extra_dir": "", 5 | "skip_file_check": "yes", 6 | "force_ask_path": "no", 7 | "no_os_in_suggested_path": "yes", 8 | "no_ver_in_suggested_path": "no", 9 | "install_env": { 10 | }, 11 | "params": { 12 | "deploy": { 13 | "template": "deploy.prototxt", 14 | "substitute": { 15 | "batch_size": 1 16 | } 17 | } 18 | }, 19 | "version": "deepscale-squeezenet-1.1" 20 | }, 21 | "deps": { 22 | "sdk-kann": { 23 | "local": "yes", 24 | "name": "KaNN Development Package", 25 | "sort": 10, 26 | "tags": "sdk,kann" 27 | }, 28 | "caffemodel": { 29 | "local": "yes", 30 | "name": "SqueezeNet 1.1", 31 | "sort": 20, 32 | "tags": "caffemodel,squeezenet,v1.1" 33 | } 34 | }, 35 | "end_full_path": { 36 | "linux": "generated/multibin_bin.mpk" 37 | }, 38 | "features": { 39 | "accuracy": 0.58388, 40 | "accuracy_top5": 0.810123, 41 | "model_size_mb": 5 42 | }, 43 | 44 | "only_for_host_os_tags": [ 45 | "linux" 46 | ], 47 | "only_for_target_os_tags": [ 48 | "linux" 49 | ], 50 | "process_script": "convert", 51 | "soft_uoa": "2025bf79b2048719", 52 | "suggested_path": "kannmodel", 53 | "package_extra_name":" (deepscale, squeezenet, 1.1)", 54 | "tags": [ 55 | "kann", 56 | "kannmodel", 57 | "deepscale", 58 | "squeezenet", 59 | "v1.1", 60 | "v1" 61 | ], 62 | "use_scripts_from_another_entry": { 63 | "repo_uoa": "ck-kann", 64 | "module_uoa": "script", 65 | "data_uoa": "caffe2kann" 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /package/kannmodel-deepscale-squeezenet-1.0/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "check_exit_status": "yes", 3 | "customize": { 4 | "extra_dir": "", 5 | "force_ask_path": "no", 6 | "install_env": {}, 7 | "no_os_in_suggested_path": "yes", 8 | "no_ver_in_suggested_path": "no", 9 | "params": { 10 | "deploy": { 11 | "substitute": { 12 | "batch_size": 1 13 | }, 14 | "template": "deploy.prototxt" 15 | } 16 | }, 17 | "skip_file_check": "yes", 18 | "version": "deepscale-squeezenet-1.0" 19 | }, 20 | "deps": { 21 | "caffemodel": { 22 | "local": "yes", 23 | "name": "SqueezeNet 1.0", 24 | "sort": 20, 25 | "tags": "caffemodel,squeezenet,v1.0" 26 | }, 27 | "sdk-kann": { 28 | "local": "yes", 29 | "name": "KaNN Development Package", 30 | "sort": 10, 31 | "tags": "sdk,kann" 32 | } 33 | }, 34 | "end_full_path": { 35 | "linux": "generated/multibin_bin.mpk" 36 | }, 37 | "features": { 38 | "accuracy": 0.576801, 39 | "accuracy_top5": 0.803903, 40 | "model_size_mb": 5 41 | }, 42 | "only_for_host_os_tags": [ 43 | "linux" 44 | ], 45 | "only_for_target_os_tags": [ 46 | "linux" 47 | ], 48 | "package_extra_name": " (deepscale, squeezenet, 1.0)", 49 | "process_script": "convert", 50 | "soft_uoa": "2025bf79b2048719", 51 | "suggested_path": "kannmodel", 52 | "tags": [ 53 | "kann", 54 | "kannmodel", 55 | "deepscale", 56 | "squeezenet", 57 | "v1.0", 58 | "v1" 59 | ], 60 | "use_scripts_from_another_entry": { 61 | "data_uoa": "caffe2kann", 62 | "module_uoa": "script", 63 | "repo_uoa": "ck-kann" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /package/kannmodel-bvlc-alexnet/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "check_exit_status": "yes", 3 | "customize": { 4 | "extra_dir": "", 5 | "force_ask_path": "no", 6 | "install_env": {}, 7 | "no_os_in_suggested_path": "yes", 8 | "no_ver_in_suggested_path": "no", 9 | "params": { 10 | "deploy": { 11 | "substitute": { 12 | "batch_size": 1 13 | }, 14 | "template": "deploy.prototxt" 15 | } 16 | }, 17 | "skip_file_check": "yes", 18 | "version": "bvlc-alexnet" 19 | }, 20 | "deps": { 21 | "caffemodel": { 22 | "local": "yes", 23 | "name": "alexnet", 24 | "sort": 20, 25 | "tags": "caffemodel,bvlc,alexnet" 26 | }, 27 | "dataset-imagenet-aux": { 28 | "add_to_path": "no", 29 | "local": "yes", 30 | "name": "ImageNet dataset (aux)", 31 | "sort": 30, 32 | "tags": "dataset,imagenet,aux" 33 | }, 34 | "sdk-kann": { 35 | "local": "yes", 36 | "name": "KaNN Development Package", 37 | "sort": 10, 38 | "tags": "sdk,kann" 39 | } 40 | }, 41 | "end_full_path": { 42 | "linux": "generated/multibin_bin.mpk" 43 | }, 44 | "features": { 45 | "accuracy":0.568279, 46 | "accuracy_top5":0.799501, 47 | "model_size_mb":244 48 | }, 49 | "only_for_host_os_tags": [ 50 | "linux" 51 | ], 52 | "only_for_target_os_tags": [ 53 | "linux" 54 | ], 55 | "package_extra_name": " (bvlc, alexnet)", 56 | "process_script": "convert", 57 | "soft_uoa": "2025bf79b2048719", 58 | "suggested_path": "kannmodel", 59 | "tags": [ 60 | "kann", 61 | "kannmodel", 62 | "bvlc", 63 | "alexnet" 64 | ], 65 | "use_scripts_from_another_entry": { 66 | "data_uoa": "caffe2kann", 67 | "module_uoa": "script", 68 | "repo_uoa": "ck-kann" 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /package/kannmodel-bvlc-googlenet/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "check_exit_status": "yes", 3 | "customize": { 4 | "extra_dir": "", 5 | "force_ask_path": "no", 6 | "install_env": {}, 7 | "no_os_in_suggested_path": "yes", 8 | "no_ver_in_suggested_path": "no", 9 | "params": { 10 | "deploy": { 11 | "substitute": { 12 | "batch_size": 1 13 | }, 14 | "template": "deploy.prototxt" 15 | } 16 | }, 17 | "skip_file_check": "yes", 18 | "version": "bvlc-googlenet" 19 | }, 20 | "deps": { 21 | "caffemodel": { 22 | "local": "yes", 23 | "name": "GoogleNet", 24 | "sort": 20, 25 | "tags": "caffemodel,bvlc,googlenet" 26 | }, 27 | "dataset-imagenet-aux": { 28 | "add_to_path": "no", 29 | "local": "yes", 30 | "name": "ImageNet dataset (aux)", 31 | "sort": 30, 32 | "tags": "dataset,imagenet,aux" 33 | }, 34 | "sdk-kann": { 35 | "local": "yes", 36 | "name": "KaNN Development Package", 37 | "sort": 10, 38 | "tags": "sdk,kann" 39 | } 40 | }, 41 | "end_full_path": { 42 | "linux": "generated/multibin_bin.mpk" 43 | }, 44 | "features": { 45 | "accuracy":0.689299, 46 | "accuracy_top5":0.891441, 47 | "model_size_mb":54 48 | }, 49 | "only_for_host_os_tags": [ 50 | "linux" 51 | ], 52 | "only_for_target_os_tags": [ 53 | "linux" 54 | ], 55 | "package_extra_name": " (bvlc, googlenet)", 56 | "process_script": "convert", 57 | "soft_uoa": "2025bf79b2048719", 58 | "suggested_path": "kannmodel", 59 | "tags": [ 60 | "kann", 61 | "kannmodel", 62 | "bvlc", 63 | "googlenet" 64 | ], 65 | "use_scripts_from_another_entry": { 66 | "data_uoa": "caffe2kann", 67 | "module_uoa": "script", 68 | "repo_uoa": "ck-kann" 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /program/kann/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "473c67d70ebe45a9", 3 | "build_compiler_vars": { 4 | }, 5 | "compile_deps": { 6 | }, 7 | "print_files_after_run": [ 8 | "tmp-stdout.tmp", 9 | "tmp-stderr.tmp" 10 | ], 11 | "process_in_tmp": "yes", 12 | "program": "yes", 13 | "run_cmds": { 14 | "default": { 15 | "ignore_return_code": "no", 16 | "run_time": { 17 | "fine_grain_timer_file": "tmp-ck-timer.json", 18 | "post_process_cmds": [ 19 | "python $#src_path_local#$postprocess.py" 20 | ], 21 | "post_process_via_ck": "yes", 22 | "pre_process_via_ck": { 23 | "script_name": "preprocess" 24 | }, 25 | "run_cmd_main": "/home/accesscore/CK_REPOS/ck-kann/platform.init/emb02/ck-set-cpu-frequency $<>$; /home/accesscore/CK_REPOS/ck-kann/platform.init/emb02/ck-set-ddr-frequency $<>$; $<>$ $<>$ io_bin tmp-kann-input.tmp tmp-kann-output.tmp $<>$ $<>$", 26 | "run_cmd_out1": "tmp-stdout.tmp", 27 | "run_cmd_out2": "tmp-stderr.tmp", 28 | "run_correctness_output_files": [], 29 | "run_input_files": [ 30 | ], 31 | "run_output_files": [ 32 | "tmp-ck-timer.json" 33 | ] 34 | } 35 | } 36 | }, 37 | "run_deps": { 38 | "imagenet-aux": { 39 | "force_target_as_host": "yes", 40 | "local": "yes", 41 | "name": "KaNN dataset labels (ImageNet aux)", 42 | "sort": 30, 43 | "tags": "dataset,imagenet,aux" 44 | }, 45 | "kanndataset": { 46 | "force_target_as_host": "yes", 47 | "local": "yes", 48 | "name": "KaNN dataset (ImageNet val)", 49 | "sort": 20, 50 | "tags": "dataset,imagenet,val,kann" 51 | }, 52 | "kannmodel": { 53 | "force_target_as_host": "yes", 54 | "local": "yes", 55 | "name": "KaNN model (net and weights)", 56 | "sort": 10, 57 | "tags": "kannmodel" 58 | } 59 | }, 60 | "run_vars": { 61 | "CK_CPU_FREQ":400, 62 | "CK_DDR_FREQ":1066, 63 | "CK_KANN_MAX_NUMBER_IMAGES":1 64 | }, 65 | "skip_bin_ext": "yes", 66 | "source_files": [ 67 | ], 68 | "tags": [ 69 | "kann", 70 | "evaluation", 71 | "client" 72 | ], 73 | "version": "1.2" 74 | } 75 | -------------------------------------------------------------------------------- /soft/model.kann/customize.py: -------------------------------------------------------------------------------- 1 | # 2 | # Collective Knowledge - KaNN model setup. 3 | # 4 | # See CK LICENSE.txt for licensing details 5 | # See CK COPYRIGHT.txt for copyright details 6 | # 7 | # Developer: Anton Lokhmotov, dividiti, 2017 8 | # 9 | 10 | import os 11 | 12 | ############################################################################## 13 | # setup environment 14 | 15 | def setup(i): 16 | """ 17 | Input: { 18 | cfg - meta of this soft entry 19 | self_cfg - meta of module soft 20 | ck_kernel - import CK kernel module (to reuse functions) 21 | 22 | host_os_uoa - host OS UOA 23 | host_os_uid - host OS UID 24 | host_os_dict - host OS meta 25 | 26 | target_os_uoa - target OS UOA 27 | target_os_uid - target OS UID 28 | target_os_dict - target OS meta 29 | 30 | target_device_id - target device ID (if via ADB) 31 | 32 | tags - list of tags used to search this entry 33 | 34 | env - updated environment vars from meta 35 | customize - updated customize vars from meta 36 | 37 | deps - resolved dependencies for this soft 38 | 39 | interactive - if 'yes', can ask questions, otherwise quiet 40 | } 41 | 42 | Output: { 43 | return - return code = 0, if successful 44 | > 0, if error 45 | (error) - error text if return > 0 46 | 47 | bat - prepared string for bat file 48 | } 49 | 50 | """ 51 | 52 | import os 53 | 54 | # Get CK variables. 55 | ck=i['ck_kernel'] 56 | env=i['env'] 57 | 58 | cus=i.get('customize',{}) 59 | fp=cus.get('full_path','') 60 | ep=cus.get('env_prefix','') 61 | 62 | # The generated files get copied under '$CK_ENV_MODEL_KANN_ROOT/generated'. 63 | generated_dir=os.path.dirname(fp) 64 | env[ep+'_INPUT_PREPARATOR']=os.path.join(generated_dir, 'input_preparator.py') 65 | env[ep+'_MULTIBIN_BIN']=os.path.join(generated_dir, 'multibin_bin.mpk') 66 | env[ep+'_PARAMS_BIN']=os.path.join(generated_dir, 'params.bin') 67 | env[ep+'_HOST_BIN']=os.path.join(generated_dir, 'host_bin') 68 | env[ep+'_IO_BIN']=os.path.join(generated_dir, 'io_bin') 69 | env[ep+'_ROOT']=os.path.dirname(generated_dir) 70 | 71 | s='' 72 | return {'return':0, 'bat':s} 73 | -------------------------------------------------------------------------------- /soft/dataset.imagenet.val.kann/customize.py: -------------------------------------------------------------------------------- 1 | # 2 | # Collective Knowledge (individual environment - setup) 3 | # 4 | # See CK LICENSE.txt for licensing details 5 | # See CK COPYRIGHT.txt for copyright details 6 | # 7 | # Developer(s): 8 | # - Grigori Fursin, Grigori.Fursin@cTuning.org, 2016 9 | # - Anton Lokhmotov, anton@dividiti.com, 2017 10 | # 11 | 12 | import os 13 | 14 | ############################################################################## 15 | # setup environment 16 | 17 | def setup(i): 18 | """ 19 | Input: { 20 | cfg - meta of this soft entry 21 | self_cfg - meta of module soft 22 | ck_kernel - import CK kernel module (to reuse functions) 23 | 24 | host_os_uoa - host OS UOA 25 | host_os_uid - host OS UID 26 | host_os_dict - host OS meta 27 | 28 | target_os_uoa - target OS UOA 29 | target_os_uid - target OS UID 30 | target_os_dict - target OS meta 31 | 32 | target_device_id - target device ID (if via ADB) 33 | 34 | tags - list of tags used to search this entry 35 | 36 | env - updated environment vars from meta 37 | customize - updated customize vars from meta 38 | 39 | deps - resolved dependencies for this soft 40 | 41 | interactive - if 'yes', can ask questions, otherwise quiet 42 | } 43 | 44 | Output: { 45 | return - return code = 0, if successful 46 | > 0, if error 47 | (error) - error text if return > 0 48 | 49 | bat - prepared string for bat file 50 | } 51 | 52 | """ 53 | 54 | import os 55 | 56 | # Get CK variables. 57 | ck=i['ck_kernel'] 58 | s='' 59 | 60 | # Even if the original is removed, we still have a copy to figure out the number of images. 61 | cdeps=i['deps_copy'] 62 | 63 | # Check the host platform. 64 | hosd=i['host_os_dict'] 65 | hplat=hosd.get('ck_name','') 66 | hproc=hosd.get('processor','') 67 | #sdirs=hosd.get('dir_sep','') 68 | 69 | cus=i.get('customize',{}) 70 | fp=cus.get('full_path','') 71 | pi=os.path.dirname(fp) 72 | 73 | ep=cus.get('env_prefix','') 74 | env=i['env'] 75 | env[ep]=pi 76 | env['CK_KANN_IMAGENET_VAL']=pi 77 | 78 | # Check the number of images. 79 | pff=cus['ck_features_file'] 80 | pf=os.path.join(pi, pff) 81 | features=cus.get('features',{}) 82 | 83 | pim=cdeps.get('dataset-imagenet-raw',{}).get('dict',{}).get('env',{}).get('CK_CAFFE_IMAGENET_VAL','') 84 | if pim=='': 85 | if os.path.isfile(pf): 86 | r=ck.load_json_file({'json_file':pf}) 87 | if r['return']>0: return r 88 | cus['features']=r['dict'] 89 | else: 90 | return {'return':1, 'error':'CK features for KaNN input dataset are not defined and file \''+pff+'\' does not exist'} 91 | else: 92 | num=cus.get('first_images','') 93 | if num!='': 94 | num=int(num) 95 | else: 96 | dl=os.listdir(pim) 97 | num=0 98 | for fn in dl: 99 | if fn.endswith('.JPEG') or fn.endswith('.jpeg'): 100 | num+=1 101 | features['number_of_original_images']=num 102 | 103 | cus['features']=features 104 | 105 | r=ck.save_json_to_file({'json_file':pf, 'dict':features}) 106 | if r['return']>0: return r 107 | 108 | return {'return':0, 'bat':s} 109 | -------------------------------------------------------------------------------- /soft/sdk.kann/customize.py: -------------------------------------------------------------------------------- 1 | # 2 | # Collective Knowledge (individual environment - setup) 3 | # 4 | # See CK LICENSE.txt for licensing details 5 | # See CK COPYRIGHT.txt for copyright details 6 | # 7 | # Developer: Anton Lokhmotov, dividiti, 2017 8 | # 9 | 10 | import os 11 | 12 | ############################################################################## 13 | # detect version from full path 14 | 15 | ver_prefix='KaNN_Development_Package_v' 16 | 17 | def version_cmd(i): 18 | fp=i['full_path'] 19 | 20 | p1=os.path.dirname(fp) 21 | p2=os.path.dirname(p1) 22 | 23 | ver=os.path.basename(p2)[len(ver_prefix):] 24 | 25 | return {'return':0, 'cmd':'', 'version':ver} 26 | 27 | ############################################################################## 28 | # setup software environment 29 | 30 | def setup(i): 31 | """ 32 | Input: { 33 | cfg - meta of this soft entry 34 | self_cfg - meta of module soft 35 | ck_kernel - import CK kernel module (to reuse functions) 36 | 37 | host_os_uoa - host OS UOA 38 | host_os_uid - host OS UID 39 | host_os_dict - host OS meta 40 | 41 | target_os_uoa - target OS UOA 42 | target_os_uid - target OS UID 43 | target_os_dict - target OS meta 44 | 45 | target_device_id - target device ID (if via ADB) 46 | 47 | tags - list of tags used to search this entry 48 | 49 | env - updated environment vars from meta 50 | customize - updated customize vars from meta 51 | 52 | deps - resolved dependencies for this soft 53 | 54 | interactive - if 'yes', can ask questions, otherwise quiet 55 | } 56 | 57 | Output: { 58 | return - return code = 0, if successful 59 | > 0, if error 60 | (error) - error text if return > 0 61 | 62 | bat - prepared string for bat file 63 | } 64 | 65 | """ 66 | 67 | import os 68 | 69 | # Get variables 70 | ck=i['ck_kernel'] 71 | s='' 72 | 73 | iv=i.get('interactive','') 74 | 75 | cus=i.get('customize',{}) 76 | fp=cus.get('full_path','') 77 | 78 | hosd=i['host_os_dict'] 79 | tosd=i['target_os_dict'] 80 | 81 | sdirs=hosd.get('dir_sep','') 82 | 83 | # Check platform 84 | hplat=hosd.get('ck_name','') 85 | 86 | hproc=hosd.get('processor','') 87 | tproc=tosd.get('processor','') 88 | 89 | remote=tosd.get('remote','') 90 | tbits=tosd.get('bits','') 91 | 92 | env=i['env'] 93 | ep=cus.get('env_prefix','') 94 | 95 | # Example: KaNN_Development_Package_v1.2/python/caffe_to_kann.py 96 | python_dir=os.path.dirname(fp) 97 | sdk_dir=os.path.dirname(python_dir) 98 | runtime_dir=os.path.join(sdk_dir, 'runtime') 99 | runtime_mppa_dir=os.path.join(runtime_dir, 'mppa') 100 | 101 | env[ep]=sdk_dir 102 | env[ep+'_PYTHON_CAFFE_TO_KANN']=fp 103 | env[ep+'_RUNTIME_MPPA']=runtime_mppa_dir 104 | 105 | # Detect version 106 | version=os.path.basename(sdk_dir)[len(ver_prefix):] 107 | env[ep+'_VERSION']=version 108 | 109 | # Dynamic lib. 110 | cus['path_lib']=runtime_mppa_dir 111 | cus['dynamic_lib']=os.path.join(runtime_mppa_dir, 'libruntime_host.so') 112 | env[ep+'_DYNAMIC_NAME']=cus.get('dynamic_lib','') 113 | r=ck.access({'action':'lib_path_export_script', 'module_uoa':'os', 'host_os_dict':hosd, 'lib_path':cus.get('path_lib','')}) 114 | if r['return']>0: return r 115 | s+=r['script'] 116 | 117 | return {'return':0, 'bat':s} 118 | -------------------------------------------------------------------------------- /script/caffe2kann/convert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Generate KaNN model from Caffe model. 5 | # 6 | # See CK LICENSE.txt for licensing details. 7 | # See CK COPYRIGHT.txt for copyright details. 8 | # 9 | # Developer(s): 10 | # - Anton Lokhmotov, anton@dividiti.com, 2017 11 | # 12 | 13 | # 14 | # CK defines the following variables automatically: 15 | # 16 | # ORIGINAL_PACKAGE_DIR - kannmodel package dir (where the kannmodel meta resides) 17 | # PACKAGE_DIR - caffe2kann script dir (where this script resides) 18 | # INSTALL_DIR - installation dir (where the generated model will reside) 19 | # CK_ENV_SDK_KANN_RUNTIME_MPPA - dir with mppa runtime from sdk-kann dependency 20 | # CK_ENV_SDK_KANN_PYTHON_CAFFE_TO_KANN - python script from sdk-kann dependency 21 | # CK_ENV_MODEL_CAFFE - dir containing topology from caffemodel dependency 22 | # CK_ENV_MODEL_CAFFE_WEIGHTS - weights file from caffemodel dependency 23 | # CK_CAFFE_IMAGENET_MEAN_BIN - ImageNet mean binary (for AlexNet and GoogleNet) 24 | # 25 | 26 | export KANNMODEL_MAKEFILE_DIR=${CK_ENV_SDK_KANN_RUNTIME_MPPA} 27 | export KANNMODEL_GENERATOR_TOOL=${CK_ENV_SDK_KANN_PYTHON_CAFFE_TO_KANN} 28 | export KANNMODEL_INPUT_CAFFE_WEIGHTS_FILE=${CK_ENV_MODEL_CAFFE_WEIGHTS} 29 | export KANNMODEL_INPUT_IMAGENET_MEAN_BIN=${CK_CAFFE_IMAGENET_MEAN_BIN} 30 | export KANNMODEL_OUTPUT_DIR=${INSTALL_DIR}/generated/ 31 | 32 | ################################################################################ 33 | echo "Preparing Caffe topology file ..." 34 | echo 35 | 36 | export KANNMODEL_TOPOLOGY_FILE=${ORIGINAL_PACKAGE_DIR}/deploy.prototxt 37 | export CAFFEMODEL_TOPOLOGY_FILE=${CK_ENV_MODEL_CAFFE}/deploy.prototxt 38 | 39 | if [[ -e ${KANNMODEL_TOPOLOGY_FILE} ]] 40 | then 41 | export KANNMODEL_INPUT_CAFFE_TOPOLOGY_FILE=${KANNMODEL_TOPOLOGY_FILE} 42 | # Do nothing else. 43 | else 44 | export KANNMODEL_INPUT_CAFFE_TOPOLOGY_FILE=${INSTALL_DIR}/deploy.prototxt 45 | # Set the batch size to 1 (the only batch size currently supported by KaNN). 46 | cat ${CAFFEMODEL_TOPOLOGY_FILE} | sed 's/$#batch_size#\$/1/' > ${KANNMODEL_INPUT_CAFFE_TOPOLOGY_FILE} 47 | if [ "${?}" != "0" ] ; then 48 | echo "Error: Setting the batch size to 1 failed!" 49 | exit 1 50 | fi 51 | fi 52 | 53 | ################################################################################ 54 | echo "Generating KaNN model from Caffe model ..." 55 | echo "- Generator tool: '${KANNMODEL_GENERATOR_TOOL}'" 56 | echo "- Input Caffe topology: '${KANNMODEL_INPUT_CAFFE_TOPOLOGY_FILE}'" 57 | echo "- Input Caffe weights: '${KANNMODEL_INPUT_CAFFE_WEIGHTS_FILE}'" 58 | echo "- Input ImageNet mean: '${KANNMODEL_INPUT_IMAGENET_MEAN_BIN}'" 59 | echo "- Output dir: '${KANNMODEL_OUTPUT_DIR}'" 60 | echo 61 | 62 | ################################################################################ 63 | echo "Generating KaNN model ..." 64 | echo 65 | 66 | rm -rf ${KANNMODEL_OUTPUT_DIR} 67 | mkdir -p ${KANNMODEL_OUTPUT_DIR} 68 | 69 | # TODO: Add python dependency. 70 | python ${KANNMODEL_GENERATOR_TOOL} ${KANNMODEL_OUTPUT_DIR} ${KANNMODEL_INPUT_CAFFE_TOPOLOGY_FILE} ${KANNMODEL_INPUT_CAFFE_WEIGHTS_FILE} ${KANNMODEL_INPUT_IMAGENET_MEAN_BIN} 71 | 72 | if [ "${?}" != "0" ] 73 | then 74 | echo "Error: Generating KaNN model failed!" 75 | exit 1 76 | fi 77 | 78 | ################################################################################ 79 | echo "Compiling KaNN model ..." 80 | echo 81 | 82 | export KANNMODEL_BIN_DIR=${CK_ENV_SDK_KANN_RUNTIME_MPPA}/output/bin 83 | 84 | rm -rf ${KANNMODEL_BIN_DIR} 85 | 86 | # TODO: Add make dependency. 87 | codegen_path=${KANNMODEL_OUTPUT_DIR} make -j32 -C ${KANNMODEL_MAKEFILE_DIR} 88 | 89 | if [ "${?}" != "0" ] 90 | then 91 | echo "Error: Compiling KaNN model failed!" 92 | exit 1 93 | fi 94 | 95 | ################################################################################ 96 | echo "Installing KaNN model ..." 97 | echo 98 | 99 | cp ${KANNMODEL_BIN_DIR}/host_bin ${KANNMODEL_OUTPUT_DIR} 100 | cp ${KANNMODEL_BIN_DIR}/multibin_bin.mpk ${KANNMODEL_OUTPUT_DIR} 101 | 102 | if [ "${?}" != "0" ] 103 | then 104 | echo "Error: Installing KaNN model failed!" 105 | exit 1 106 | fi 107 | 108 | ################################################################################ 109 | exit 0 110 | -------------------------------------------------------------------------------- /package/kannmodel-bvlc-alexnet/deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "AlexNet" 2 | layer { 3 | name: "data" 4 | type: "Input" 5 | top: "data" 6 | input_param { shape: { dim: 1 dim: 3 dim: 227 dim: 227 } } 7 | } 8 | layer { 9 | name: "conv1" 10 | type: "Convolution" 11 | bottom: "data" 12 | top: "conv1" 13 | param { 14 | lr_mult: 1 15 | decay_mult: 1 16 | } 17 | param { 18 | lr_mult: 2 19 | decay_mult: 0 20 | } 21 | convolution_param { 22 | num_output: 96 23 | kernel_size: 11 24 | stride: 4 25 | } 26 | } 27 | layer { 28 | name: "relu1" 29 | type: "ReLU" 30 | bottom: "conv1" 31 | top: "conv1" 32 | } 33 | layer { 34 | name: "norm1" 35 | type: "LRN" 36 | bottom: "conv1" 37 | top: "norm1" 38 | lrn_param { 39 | local_size: 5 40 | alpha: 0.0001 41 | beta: 0.75 42 | } 43 | } 44 | layer { 45 | name: "pool1" 46 | type: "Pooling" 47 | bottom: "norm1" 48 | top: "pool1" 49 | pooling_param { 50 | pool: MAX 51 | kernel_size: 3 52 | stride: 2 53 | } 54 | } 55 | layer { 56 | name: "conv2" 57 | type: "Convolution" 58 | bottom: "pool1" 59 | top: "conv2" 60 | param { 61 | lr_mult: 1 62 | decay_mult: 1 63 | } 64 | param { 65 | lr_mult: 2 66 | decay_mult: 0 67 | } 68 | convolution_param { 69 | num_output: 256 70 | pad: 2 71 | kernel_size: 5 72 | group: 2 73 | } 74 | } 75 | layer { 76 | name: "relu2" 77 | type: "ReLU" 78 | bottom: "conv2" 79 | top: "conv2" 80 | } 81 | layer { 82 | name: "norm2" 83 | type: "LRN" 84 | bottom: "conv2" 85 | top: "norm2" 86 | lrn_param { 87 | local_size: 5 88 | alpha: 0.0001 89 | beta: 0.75 90 | } 91 | } 92 | layer { 93 | name: "pool2" 94 | type: "Pooling" 95 | bottom: "norm2" 96 | top: "pool2" 97 | pooling_param { 98 | pool: MAX 99 | kernel_size: 3 100 | stride: 2 101 | } 102 | } 103 | layer { 104 | name: "conv3" 105 | type: "Convolution" 106 | bottom: "pool2" 107 | top: "conv3" 108 | param { 109 | lr_mult: 1 110 | decay_mult: 1 111 | } 112 | param { 113 | lr_mult: 2 114 | decay_mult: 0 115 | } 116 | convolution_param { 117 | num_output: 384 118 | pad: 1 119 | kernel_size: 3 120 | } 121 | } 122 | layer { 123 | name: "relu3" 124 | type: "ReLU" 125 | bottom: "conv3" 126 | top: "conv3" 127 | } 128 | layer { 129 | name: "conv4" 130 | type: "Convolution" 131 | bottom: "conv3" 132 | top: "conv4" 133 | param { 134 | lr_mult: 1 135 | decay_mult: 1 136 | } 137 | param { 138 | lr_mult: 2 139 | decay_mult: 0 140 | } 141 | convolution_param { 142 | num_output: 384 143 | pad: 1 144 | kernel_size: 3 145 | group: 2 146 | } 147 | } 148 | layer { 149 | name: "relu4" 150 | type: "ReLU" 151 | bottom: "conv4" 152 | top: "conv4" 153 | } 154 | layer { 155 | name: "conv5" 156 | type: "Convolution" 157 | bottom: "conv4" 158 | top: "conv5" 159 | param { 160 | lr_mult: 1 161 | decay_mult: 1 162 | } 163 | param { 164 | lr_mult: 2 165 | decay_mult: 0 166 | } 167 | convolution_param { 168 | num_output: 256 169 | pad: 1 170 | kernel_size: 3 171 | group: 2 172 | } 173 | } 174 | layer { 175 | name: "relu5" 176 | type: "ReLU" 177 | bottom: "conv5" 178 | top: "conv5" 179 | } 180 | layer { 181 | name: "pool5" 182 | type: "Pooling" 183 | bottom: "conv5" 184 | top: "pool5" 185 | pooling_param { 186 | pool: MAX 187 | kernel_size: 3 188 | stride: 2 189 | } 190 | } 191 | layer { 192 | name: "fc6" 193 | type: "InnerProduct" 194 | bottom: "pool5" 195 | top: "fc6" 196 | param { 197 | lr_mult: 1 198 | decay_mult: 1 199 | } 200 | param { 201 | lr_mult: 2 202 | decay_mult: 0 203 | } 204 | inner_product_param { 205 | num_output: 4096 206 | } 207 | } 208 | layer { 209 | name: "relu6" 210 | type: "ReLU" 211 | bottom: "fc6" 212 | top: "fc6" 213 | } 214 | layer { 215 | name: "drop6" 216 | type: "Dropout" 217 | bottom: "fc6" 218 | top: "fc6" 219 | dropout_param { 220 | dropout_ratio: 0.5 221 | } 222 | } 223 | layer { 224 | name: "fc7" 225 | type: "InnerProduct" 226 | bottom: "fc6" 227 | top: "fc7" 228 | param { 229 | lr_mult: 1 230 | decay_mult: 1 231 | } 232 | param { 233 | lr_mult: 2 234 | decay_mult: 0 235 | } 236 | inner_product_param { 237 | num_output: 4096 238 | } 239 | } 240 | layer { 241 | name: "relu7" 242 | type: "ReLU" 243 | bottom: "fc7" 244 | top: "fc7" 245 | } 246 | layer { 247 | name: "drop7" 248 | type: "Dropout" 249 | bottom: "fc7" 250 | top: "fc7" 251 | dropout_param { 252 | dropout_ratio: 0.5 253 | } 254 | } 255 | layer { 256 | name: "fc8" 257 | type: "InnerProduct" 258 | bottom: "fc7" 259 | top: "fc8" 260 | param { 261 | lr_mult: 1 262 | decay_mult: 1 263 | } 264 | param { 265 | lr_mult: 2 266 | decay_mult: 0 267 | } 268 | inner_product_param { 269 | num_output: 1000 270 | } 271 | } 272 | layer { 273 | name: "prob" 274 | type: "Softmax" 275 | bottom: "fc8" 276 | top: "prob" 277 | } 278 | -------------------------------------------------------------------------------- /script/explore-models/explore-models-benchmarking.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | import ck.kernel as ck 3 | import copy 4 | import re 5 | 6 | 7 | # Framework tag. 8 | framework_tag='kann' 9 | 10 | # Platform tag. 11 | platform_tag='kalray-emb02' 12 | 13 | # Maximum number of images (> 1). 14 | max_num_images=5 15 | 16 | # Number of statistical repetitions. 17 | num_repetitions=3 18 | 19 | 20 | def do(i): 21 | # Detect basic platform info. 22 | ii={'action':'detect', 23 | 'module_uoa':'platform', 24 | 'out':'out'} 25 | r=ck.access(ii) 26 | if r['return']>0: return r 27 | 28 | # Host and target OS params. 29 | hos=r['host_os_uoa'] 30 | hosd=r['host_os_dict'] 31 | 32 | tos=r['os_uoa'] 33 | tosd=r['os_dict'] 34 | tdid=r['device_id'] 35 | 36 | # Program and command. 37 | program='kann' 38 | cmd_key='default' 39 | 40 | # Load KaNN program meta and desc to check deps. 41 | ii={'action':'load', 42 | 'module_uoa':'program', 43 | 'data_uoa':program} 44 | rx=ck.access(ii) 45 | if rx['return']>0: return rx 46 | mm=rx['dict'] 47 | 48 | # Get compile-time and run-time deps. 49 | cdeps=mm.get('compile_deps',{}) 50 | rdeps=mm.get('run_deps',{}) 51 | 52 | # Merge rdeps with cdeps for setting up the pipeline (which uses 53 | # common deps), but tag them as "for_run_time". 54 | for k in rdeps: 55 | cdeps[k]=rdeps[k] 56 | cdeps[k]['for_run_time']='yes' 57 | 58 | # KaNN datasets. 59 | depd=copy.deepcopy(cdeps['kanndataset']) 60 | ii={'action':'resolve', 61 | 'module_uoa':'env', 62 | 'quiet':'yes', # any dataset 63 | 'out':'con', 64 | 'deps':{'kanndataset':copy.deepcopy(depd)} 65 | } 66 | r=ck.access(ii) 67 | if r['return']>0: return r 68 | 69 | udepd=r['deps']['kanndataset'].get('choices',[]) # All UOAs of env for KaNN datasets. 70 | if len(udepd)==0: 71 | return {'return':1, 'error':'no installed KaNN datasets'} 72 | 73 | # KaNN models. 74 | depm=copy.deepcopy(cdeps['kannmodel']) 75 | 76 | ii={'action':'resolve', 77 | 'module_uoa':'env', 78 | 'quiet':'yes', # any model 79 | 'out':'con', 80 | 'deps':{'kannmodel':copy.deepcopy(depm)} 81 | } 82 | r=ck.access(ii) 83 | if r['return']>0: return r 84 | 85 | udepm=r['deps']['kannmodel'].get('choices',[]) # All UOAs of env for KaNN models. 86 | if len(udepm)==0: 87 | return {'return':1, 'error':'no installed KaNN models'} 88 | 89 | # Prepare pipeline. 90 | cdeps['kanndataset']['uoa']=udepd[0] 91 | cdeps['kannmodel']['uoa']=udepm[0] 92 | 93 | ii={'action':'pipeline', 94 | 'prepare':'yes', 95 | 'dependencies':cdeps, 96 | 97 | 'module_uoa':'program', 98 | 'data_uoa':program, 99 | 'cmd_key':cmd_key, 100 | 101 | 'env': { 102 | 'CK_KANN_MAX_NUMBER_IMAGES':max_num_images 103 | }, 104 | 105 | 'no_state_check':'yes', 106 | 'no_compiler_description':'yes', 107 | 'skip_calibration':'yes', 108 | 109 | 'skip_print_timers':'yes', 110 | 'skip_compile':'yes', 111 | 'out':'con' 112 | } 113 | 114 | r=ck.access(ii) 115 | if r['return']>0: return r 116 | 117 | fail=r.get('fail','') 118 | if fail=='yes': 119 | return {'return':10, 'error':'pipeline failed ('+r.get('fail_reason','')+')'} 120 | 121 | ready=r.get('ready','') 122 | if ready!='yes': 123 | return {'return':11, 'error':'pipeline not ready'} 124 | 125 | state=r['state'] 126 | tmp_dir=state['tmp_dir'] 127 | 128 | # Remember resolved deps for this benchmarking session. 129 | xcdeps=r.get('dependencies',{}) 130 | 131 | # Clean pipeline. 132 | if 'ready' in r: del(r['ready']) 133 | if 'fail' in r: del(r['fail']) 134 | if 'return' in r: del(r['return']) 135 | 136 | pipeline=copy.deepcopy(r) 137 | 138 | # For each KaNN dataset.**************************************************** 139 | for uoad in udepd: 140 | # Load KaNN dataset. 141 | ii={'action':'load', 142 | 'module_uoa':'env', 143 | 'data_uoa':uoad} 144 | r=ck.access(ii) 145 | if r['return']>0: return r 146 | # Get version e.g. 'bvlc-alexnet'. 147 | verd=r['dict']['customize']['version'] 148 | # Skip some datasets/models with "in [..]" or "not in [..]". 149 | if verd in []: continue 150 | 151 | # For each KaNN model.************************************************* 152 | for uoam in udepm: 153 | # Load KaNN model. 154 | ii={'action':'load', 155 | 'module_uoa':'env', 156 | 'data_uoa':uoam} 157 | r=ck.access(ii) 158 | if r['return']>0: return r 159 | # Get version e.g. 'bvlc-googlenet'. 160 | verm=r['dict']['customize']['version'] 161 | if verd!=verm: continue 162 | version_tag = verd 163 | 164 | record_repo='local' 165 | record_uoa=version_tag+'-kann' 166 | 167 | # Prepare pipeline. 168 | ck.out('---------------------------------------------------------------------------------------') 169 | ck.out('%s - %s' % ('Model', uoam)) 170 | ck.out('%s - %s' % ('Dataset', uoad)) 171 | ck.out('Experiment - %s:%s' % (record_repo, record_uoa)) 172 | 173 | # Prepare autotuning input. 174 | cpipeline=copy.deepcopy(pipeline) 175 | 176 | # Reset deps and change UOA. 177 | new_deps={'kanndataset':copy.deepcopy(depd), 178 | 'kannmodel':copy.deepcopy(depm)} 179 | 180 | new_deps['kanndataset']['uoa']=uoad 181 | new_deps['kannmodel']['uoa']=uoam 182 | 183 | jj={'action':'resolve', 184 | 'module_uoa':'env', 185 | 'deps':new_deps} 186 | r=ck.access(jj) 187 | if r['return']>0: return r 188 | 189 | cpipeline['dependencies'].update(new_deps) 190 | 191 | ii={'action':'autotune', 192 | 193 | 'module_uoa':'pipeline', 194 | 'data_uoa':'program', 195 | 196 | 'choices_order':[ 197 | [ 198 | '##choices#env#CK_CPU_FREQ' 199 | ], 200 | [ 201 | '##choices#env#CK_DDR_FREQ' 202 | ] 203 | ], 204 | 'choices_selection':[ 205 | {'type':'loop', 'choice':[ 400, 500]}, 206 | {'type':'loop', 'choice':[1066,1333]} 207 | ], 208 | 209 | 'features_keys_to_process':[ 210 | '##choices#env#CK_CPU_FREQ', 211 | '##choices#env#CK_DDR_FREQ' 212 | ], 213 | 214 | 'iterations':-1, 215 | 'repetitions':num_repetitions, 216 | 217 | 'record':'yes', 218 | 'record_failed':'yes', 219 | 'record_params':{ 220 | 'search_point_by_features':'yes' 221 | }, 222 | 'record_repo':record_repo, 223 | 'record_uoa':record_uoa, 224 | 225 | 'tags':[ 'explore-models', framework_tag, platform_tag, version_tag ], 226 | 227 | 'pipeline':cpipeline, 228 | 'out':'con'} 229 | 230 | r=ck.access(ii) 231 | if r['return']>0: return r 232 | 233 | fail=r.get('fail','') 234 | if fail=='yes': 235 | return {'return':10, 'error':'pipeline failed ('+r.get('fail_reason','')+')'} 236 | 237 | return {'return':0} 238 | 239 | 240 | r=do({}) 241 | if r['return']>0: ck.err(r) 242 | -------------------------------------------------------------------------------- /script/explore-models/explore-models-testing-accuracy.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | import ck.kernel as ck 3 | import copy 4 | import re 5 | 6 | 7 | # Framework tag. 8 | framework_tag='kann' 9 | 10 | # Platform tag. 11 | platform_tag='kalray-emb02' 12 | 13 | 14 | def do(i): 15 | # Detect basic platform info. 16 | ii={'action':'detect', 17 | 'module_uoa':'platform', 18 | 'out':'out'} 19 | r=ck.access(ii) 20 | if r['return']>0: return r 21 | 22 | # Host and target OS params. 23 | hos=r['host_os_uoa'] 24 | hosd=r['host_os_dict'] 25 | 26 | tos=r['os_uoa'] 27 | tosd=r['os_dict'] 28 | tdid=r['device_id'] 29 | 30 | # Program and command. 31 | program='kann' 32 | cmd_key='default' 33 | 34 | # Load KaNN program meta and desc to check deps. 35 | ii={'action':'load', 36 | 'module_uoa':'program', 37 | 'data_uoa':program} 38 | rx=ck.access(ii) 39 | if rx['return']>0: return rx 40 | mm=rx['dict'] 41 | 42 | # Get compile-time and run-time deps. 43 | cdeps=mm.get('compile_deps',{}) 44 | rdeps=mm.get('run_deps',{}) 45 | 46 | # Merge rdeps with cdeps for setting up the pipeline (which uses 47 | # common deps), but tag them as "for_run_time". 48 | for k in rdeps: 49 | cdeps[k]=rdeps[k] 50 | cdeps[k]['for_run_time']='yes' 51 | 52 | # KaNN datasets. 53 | depd=copy.deepcopy(cdeps['kanndataset']) 54 | ii={'action':'resolve', 55 | 'module_uoa':'env', 56 | 'quiet':'yes', # any dataset 57 | 'out':'con', 58 | 'deps':{'kanndataset':depd} 59 | } 60 | r=ck.access(ii) 61 | if r['return']>0: return r 62 | 63 | udepd=r['deps']['kanndataset'].get('choices',[]) # All UOAs of env for KaNN datasets. 64 | if len(udepd)==0: 65 | return {'return':1, 'error':'no installed KaNN datasets'} 66 | 67 | max_num_images=r['deps']['kanndataset'].get('dict',{}).get('customize',{}).get('features',{}).get('number_of_original_images',1) 68 | print (r['deps']) 69 | 70 | # KaNN models. 71 | depm=copy.deepcopy(cdeps['kannmodel']) 72 | ii={'action':'resolve', 73 | 'module_uoa':'env', 74 | 'quiet':'yes', # any model 75 | 'out':'con', 76 | 'deps':{'kannmodel':depm} 77 | } 78 | r=ck.access(ii) 79 | if r['return']>0: return r 80 | 81 | udepm=r['deps']['kannmodel'].get('choices',[]) # All UOAs of env for KaNN models. 82 | if len(udepm)==0: 83 | return {'return':1, 'error':'no installed KaNN models'} 84 | 85 | # Prepare pipeline. 86 | cdeps['kanndataset']['uoa']=udepd[0] 87 | cdeps['kannmodel']['uoa']=udepm[0] 88 | 89 | ii={'action':'pipeline', 90 | 'prepare':'yes', 91 | 'dependencies':cdeps, 92 | 93 | 'module_uoa':'program', 94 | 'data_uoa':program, 95 | 'cmd_key':cmd_key, 96 | 97 | 'env': { 98 | 'CK_KANN_MAX_NUMBER_IMAGES':max_num_images 99 | }, 100 | 101 | 'no_state_check':'yes', 102 | 'no_compiler_description':'yes', 103 | 'skip_calibration':'yes', 104 | 105 | 'skip_print_timers':'yes', 106 | 'skip_compile':'yes', 107 | 'out':'con' 108 | } 109 | 110 | r=ck.access(ii) 111 | if r['return']>0: return r 112 | 113 | fail=r.get('fail','') 114 | if fail=='yes': 115 | return {'return':10, 'error':'pipeline failed ('+r.get('fail_reason','')+')'} 116 | 117 | ready=r.get('ready','') 118 | if ready!='yes': 119 | return {'return':11, 'error':'pipeline not ready'} 120 | 121 | state=r['state'] 122 | tmp_dir=state['tmp_dir'] 123 | 124 | # Remember resolved deps for this benchmarking session. 125 | xcdeps=r.get('dependencies',{}) 126 | 127 | # Clean pipeline. 128 | if 'ready' in r: del(r['ready']) 129 | if 'fail' in r: del(r['fail']) 130 | if 'return' in r: del(r['return']) 131 | 132 | pipeline=copy.deepcopy(r) 133 | 134 | # For each KaNN dataset.**************************************************** 135 | for uoad in udepd: 136 | # Load KaNN dataset. 137 | ii={'action':'load', 138 | 'module_uoa':'env', 139 | 'data_uoa':uoad} 140 | r=ck.access(ii) 141 | if r['return']>0: return r 142 | # Get version e.g. 'bvlc-alexnet'. 143 | verd=r['dict']['customize']['version'] 144 | # Skip some datasets/models with "in [..]" or "not in [..]". 145 | if verd in []: continue 146 | 147 | # For each KaNN model.************************************************* 148 | for uoam in udepm: 149 | # Load KaNN model. 150 | ii={'action':'load', 151 | 'module_uoa':'env', 152 | 'data_uoa':uoam} 153 | r=ck.access(ii) 154 | if r['return']>0: return r 155 | # Get version e.g. 'bvlc-googlenet'. 156 | verm=r['dict']['customize']['version'] 157 | if verd!=verm: continue 158 | version_tag = verd 159 | 160 | record_repo='local' 161 | record_uoa=version_tag+'-kann'+'-imagenet-ilsvrc2012-val' 162 | 163 | # Prepare pipeline. 164 | ck.out('---------------------------------------------------------------------------------------') 165 | ck.out('%s - %s' % ('Model', uoam)) 166 | ck.out('%s - %s' % ('Dataset', uoad)) 167 | ck.out('Experiment - %s:%s' % (record_repo, record_uoa)) 168 | 169 | # Prepare autotuning input. 170 | cpipeline=copy.deepcopy(pipeline) 171 | 172 | # Reset deps and change UOA. 173 | new_deps={'kanndataset':copy.deepcopy(depd), 174 | 'kannmodel':copy.deepcopy(depm)} 175 | 176 | new_deps['kanndataset']['uoa']=uoad 177 | new_deps['kannmodel']['uoa']=uoam 178 | 179 | jj={'action':'resolve', 180 | 'module_uoa':'env', 181 | 'deps':new_deps} 182 | r=ck.access(jj) 183 | if r['return']>0: return r 184 | 185 | cpipeline['dependencies'].update(new_deps) 186 | 187 | ii={'action':'autotune', 188 | 189 | 'module_uoa':'pipeline', 190 | 'data_uoa':'program', 191 | 192 | 'choices_order':[ 193 | [ 194 | '##choices#env#CK_CPU_FREQ' 195 | ], 196 | [ 197 | '##choices#env#CK_DDR_FREQ' 198 | ] 199 | ], 200 | 'choices_selection':[ 201 | {'type':'loop', 'choice':[ 500]}, 202 | {'type':'loop', 'choice':[1333]} 203 | ], 204 | 205 | 'features_keys_to_process':[ 206 | '##choices#env#CK_CPU_FREQ', 207 | '##choices#env#CK_DDR_FREQ' 208 | ], 209 | 210 | 'process_multi_keys':['##characteristics#compile#*'], 211 | 212 | 'iterations':-1, 213 | 'repetitions':1, 214 | 215 | 'record':'yes', 216 | 'record_failed':'yes', 217 | 'record_params':{ 218 | 'search_point_by_features':'yes' 219 | }, 220 | 'record_repo':record_repo, 221 | 'record_uoa':record_uoa, 222 | 223 | 'tags':[ 'explore-models-testing-accuracy', 'dataset-imagenet-ilsvrc2012-val', framework_tag, platform_tag, version_tag ], 224 | 225 | 'pipeline':cpipeline, 226 | 'out':'con'} 227 | 228 | r=ck.access(ii) 229 | if r['return']>0: return r 230 | 231 | fail=r.get('fail','') 232 | if fail=='yes': 233 | return {'return':10, 'error':'pipeline failed ('+r.get('fail_reason','')+')'} 234 | 235 | return {'return':0} 236 | 237 | 238 | r=do({}) 239 | if r['return']>0: ck.err(r) 240 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![compatibility](https://github.com/ctuning/ck-guide-images/blob/master/ck-compatible.svg)](https://github.com/ctuning/ck) 2 | [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) 3 | 4 | # [cknowledge.org/ai](http://cknowledge.org/ai): Crowdsourcing benchmarking and optimisation of AI 5 | 6 | A suite of open-source tools for [collecting knowledge on optimising AI](http://bit.ly/hipeac49-ckdl): 7 | * [Android app](http://cKnowledge.org/android-apps.html) 8 | * [Desktop app](https://github.com/dividiti/ck-crowdsource-dnn-optimization) 9 | * [CK-Caffe](https://github.com/dividiti/ck-caffe) 10 | * [CK-Caffe2](https://github.com/ctuning/ck-caffe2) 11 | * [CK-KaNN](https://github.com/ctuning/ck-kann) 12 | * [CK-TensorFlow](https://github.com/ctuning/ck-tensorflow) 13 | * [CK-TensorRT](https://github.com/ctuning/ck-tensorrt) 14 | * [CK-TinyDNN](https://github.com/ctuning/ck-tiny-dnn) 15 | * etc. 16 | 17 | # Collective Knowledge repository for benchmarking and optimising deep learning applications on Kalray platforms 18 | 19 | ## Introduction 20 | 21 | [CK-KaNN](https://github.com/ctuning/ck-kann) is an open-source framework for 22 | benchmarking and optimising deep learning applications on 23 | [Kalray platforms](http://www.kalrayinc.com/kalray/products/). 24 | 25 | It's based on the [Kalray Neural 26 | Network](http://www.electronics-eetimes.com/Learning-center/kalray-deep-learning-high-performance-applications) 27 | framework from [Kalray](http://www.kalrayinc.com) (KaNN) and 28 | the [Collective Knowledge](http://cknowledge.org) framework for customisable 29 | cross-platform builds and experimental workflows with JSON API from the 30 | [cTuning Foundation](http://ctuning.org) and [dividiti](http://dividiti.com). 31 | 32 | ## Authors/contributors 33 | 34 | * Anton Lokhmotov, [dividiti](http://dividiti.com) 35 | * Grigori Fursin, [dividiti](http://dividiti.com) / [cTuning foundation](http://ctuning.org) 36 | 37 | ## Instructions 38 | 39 | The following instructions were tested on an 40 | [EMB02](http://www.kalrayinc.com/kalray/products/#platforms) development 41 | platform from Kalray. 42 | 43 | ### Installing CK 44 | 45 | Install CK via `pip` and check its version: 46 | ``` 47 | $ sudo pip install ck 48 | $ ck version 49 | V1.9.1.1 50 | ``` 51 | 52 | Add the following to `$HOME/.bashrc`: 53 | ``` 54 | export CK_REPOS=$HOME/CK_REPOS 55 | export CK_TOOLS=$HOME/CK_TOOLS 56 | ``` 57 | 58 | ### Installing CK-KaNN 59 | 60 | Install the CK-KaNN repository from GitHub: 61 | ``` 62 | $ ck pull repo:ck-kann 63 | $ ck find repo:ck-kann 64 | /home/accesscore/CK_REPOS/ck-kann 65 | ``` 66 | 67 | Register a KaNN development package ("SDK") with CK: 68 | 69 | ``` 70 | $ ck detect soft:sdk.kann 71 | $ ck show env --tags=kann,sdk 72 | Env UID: Target OS: Bits: Name: Version: Tags: 73 | 74 | b361a26c4b778517 linux-64 64 KaNN Development Package 1.2.1_light 64bits,host-os-linux-64,kalray,kann,sdk,target-os-linux-64,v1,v1.2,v1.2.1,v1.2.1.0 75 | ``` 76 | **NB:** CK will search for a `KaNN_Development_Package_` directory in the `$HOME` directory. 77 | 78 | ### Installing CK-KaNN models and datasets 79 | 80 | Install the four KaNN models and converted datasets as follows: 81 | 82 | ``` 83 | $ ck install package:kanndataset-imagenet-val-deepscale-squeezenet-1.0 84 | $ ck install package:kanndataset-imagenet-val-deepscale-squeezenet-1.1 85 | $ ck install package:kanndataset-imagenet-val-bvlc-alexnet 86 | $ ck install package:kanndataset-imagenet-val-bvlc-googlenet 87 | ``` 88 | 89 | **NB:** For the first KaNN model to be installed on the platform, you will be 90 | prompted to select a package with the ImageNet validation dataset. Please 91 | select `imagenet-2012-val-min` containing 500 images, and then press `Enter` to 92 | confirm the default path. 93 | 94 | **NB:** For the AlexNet and GoogleNet models, you will be prompted to choose 95 | between two options. Please select the ones ending with `-fast-mirror` to 96 | download faster. 97 | 98 | **NB:** Each of the `ck install package:kanndataset*` commands performs the following: 99 | 1. Downloads the corresponding Caffe model. 100 | 1. Generates the KaNN model from the Caffe model. 101 | (The conversion flow is in `$CK_REPOS/ck-kann/script/caffe2kann`.) 102 | 1. Converts the ImageNet validation dataset to the KaNN format. (The conversion 103 | flow is in `$CK_REPOS/ck-kann/script/imagenet2kann`.) 104 | 105 | You can search and view what's been installed by tags e.g. 106 | ``` 107 | $ ck show env --tags=bvlc,googlenet 108 | Env UID: Target OS: Bits: Name: Version: Tags: 109 | 110 | 89cf44da9fb31f1a linux-64 64 KaNN model (net and weights) (bvlc, googlenet) bvlc-googlenet 64bits,bvlc,googlenet,host-os-linux-64,kalray,kann,kannmodel,net,target-os-linux-64,v0,v0.0,weights 111 | bef89fc9a14962b3 linux-64 64 ImageNet dataset (validation, KaNN) bvlc-googlenet 64bits,bvlc,dataset,googlenet,host-os-linux-64,imagenet,kann,target-os-linux-64,v0,v0.0,val,val-kann 112 | f45b591e389c372f linux-64 64 Caffe model (net and weights) (bvlc, googlenet) trunk 64bits,bvlc,caffe,caffemodel,googlenet,host-os-linux-64,mirror,net,target-os-linux-64,v0,weights 113 | ``` 114 | 115 | **NB:** For the other three models, the tags are: `bvlc,alexnet`, 116 | `deepscale,squeezenet,v1.0`, `deepscale,squeezenet,v1.1`. 117 | 118 | ### Evaluating one of the installed KaNN models 119 | 120 | To quickly evaluate one of the installed KaNN models under the current system 121 | conditions (CPU and DDR frequencies), run: 122 | ``` 123 | $ ck run program:kann 124 | ``` 125 | 126 | **NB:** When prompted the first time, select one of the KaNN models e.g. 127 | GoogleNet. When prompted the second time, select the corresponding converted 128 | dataset e.g. again GoogleNet. 129 | 130 | **NB:** If you select a wrong dataset, execution might fail. Using a CK 131 | workflow below eliminates the chance for inconsistency. 132 | 133 | You can specify the maximum number of images to process using the 134 | `CK_KANN_MAX_NUMBER_IMAGES` environment variable. For example, to process 135 | all the 500 images in the `imagenet-2012-val-min` dataset, run: 136 | 137 | ``` 138 | $ ck run program:kann --env.CK_KANN_MAX_NUMBER_IMAGES=500 139 | ``` 140 | 141 | You can specify MPPA and DDR frequencies to use for evaluation. For example, to set the MPPA 142 | frequency to 400 MHz and the DDR frequency to 1066 MHz, run: 143 | ``` 144 | $ ck run program:kann --env.CK_CPU_FREQ=400 --env.CK_DDR_FREQ=1066 145 | ``` 146 | 147 | **NB:** The supported MPPA frequencies are 400 and 500 MHz. The supported DDR 148 | frequencies are 1066 MHz and 1333 MHz. If you specify an unsupported frequency, 149 | the current frequency will be used. 150 | 151 | ### Evaluating all the installed KaNN models 152 | 153 | #### Running a workflow 154 | 155 | You can evaluate all the installed KaNN models by running a special CK workflow: 156 | ``` 157 | $ ck find ck-kann:script:explore-models 158 | /home/accesscore/CK_REPOS/ck-kann/script/explore-models 159 | $ python /home/accesscore/CK_REPOS/ck-kann/script/explore-models/explore-models-benchmarking.py 160 | ``` 161 | 162 | #### Inspecting experimental results 163 | 164 | This workflow processes a small number of images (e.g. 5) via CK-KaNN for each installed model, while varying the MPPA and DDR frequencies at the supported levels. 165 | It produces 4 `experiment` entries, one of each model: 166 | ``` 167 | $ ck list experiment:*-kann 168 | bvlc-googlenet-kann 169 | bvlc-alexnet-kann 170 | deepscale-squeezenet-1.1-kann 171 | deepscale-squeezenet-1.0-kann 172 | ``` 173 | 174 | Each experiment has 4 "points" for the Cartesian product of the supported MPPA and DDR frequencies e.g. 175 | ``` 176 | ck find experiment:bvlc-alexnet-kann 177 | /home/accesscore/CK_REPOS/local/experiment/bvlc-alexnet-kann 178 | [accesscore@emb02 ck-kann]$ ls -la /home/accesscore/CK_REPOS/local/experiment/bvlc-alexnet-kann 179 | total 2692 180 | drwxrwxr-x. 3 accesscore accesscore 4096 Jun 1 01:49 . 181 | drwxrwxr-x. 7 accesscore accesscore 4096 Jun 1 01:49 .. 182 | -rw-rw-r--. 1 accesscore accesscore 66494 Jun 1 01:49 ckp-1a57d14a0224ad29.0001.json 183 | -rw-rw-r--. 1 accesscore accesscore 77 Jun 1 01:49 ckp-1a57d14a0224ad29.features_flat.json 184 | -rw-rw-r--. 1 accesscore accesscore 14114 Jun 1 01:49 ckp-1a57d14a0224ad29.features.json 185 | -rw-rw-r--. 1 accesscore accesscore 586235 Jun 1 01:49 ckp-1a57d14a0224ad29.flat.json 186 | -rw-rw-r--. 1 accesscore accesscore 66498 Jun 1 01:49 ckp-4e0bb2c8bde1d65a.0001.json 187 | -rw-rw-r--. 1 accesscore accesscore 77 Jun 1 01:49 ckp-4e0bb2c8bde1d65a.features_flat.json 188 | -rw-rw-r--. 1 accesscore accesscore 14114 Jun 1 01:49 ckp-4e0bb2c8bde1d65a.features.json 189 | -rw-rw-r--. 1 accesscore accesscore 587324 Jun 1 01:49 ckp-4e0bb2c8bde1d65a.flat.json 190 | -rw-rw-r--. 1 accesscore accesscore 66504 Jun 1 01:48 ckp-6ccb311474b98867.0001.json 191 | -rw-rw-r--. 1 accesscore accesscore 77 Jun 1 01:48 ckp-6ccb311474b98867.features_flat.json 192 | -rw-rw-r--. 1 accesscore accesscore 14114 Jun 1 01:48 ckp-6ccb311474b98867.features.json 193 | -rw-rw-r--. 1 accesscore accesscore 586390 Jun 1 01:48 ckp-6ccb311474b98867.flat.json 194 | -rw-rw-r--. 1 accesscore accesscore 66502 Jun 1 01:48 ckp-f21aa79f2464f9c9.0001.json 195 | -rw-rw-r--. 1 accesscore accesscore 77 Jun 1 01:48 ckp-f21aa79f2464f9c9.features_flat.json 196 | -rw-rw-r--. 1 accesscore accesscore 14114 Jun 1 01:48 ckp-f21aa79f2464f9c9.features.json 197 | -rw-rw-r--. 1 accesscore accesscore 584808 Jun 1 01:48 ckp-f21aa79f2464f9c9.flat.json 198 | drwxrwxr-x. 2 accesscore accesscore 4096 Jun 1 01:49 .cm 199 | -rw-rw-r--. 1 accesscore accesscore 80 Jun 1 01:48 desc.json 200 | -rw-rw-r--. 1 accesscore accesscore 23015 Jun 1 01:48 pipeline.json 201 | ``` 202 | 203 | #### Analysing experimental results 204 | 205 | **TODO.** 206 | 207 | ## Feedback 208 | 209 | Feel free to engage with our community via this mailing list: 210 | * http://groups.google.com/group/collective-knowledge 211 | -------------------------------------------------------------------------------- /program/kann/postprocess.py: -------------------------------------------------------------------------------- 1 | # 2 | # Convert raw output of the KaNN program to the CK format. 3 | # 4 | # Developer(s): 5 | # - Anton Lokhmotov, dividiti, 2017 6 | # 7 | 8 | import json 9 | import os 10 | import re 11 | import struct 12 | 13 | def ck_postprocess(i): 14 | ck=i['ck_kernel'] 15 | rt=i['run_time'] 16 | 17 | deps=i['deps'] 18 | version=deps['kannmodel']['cus']['version'] 19 | 20 | env=i['env'] 21 | max_num_images=int(env.get('CK_KANN_MAX_NUMBER_IMAGES',-1)) 22 | 23 | # Load and concatenate stdout and stderr. 24 | lst=[] 25 | stdout=rt['run_cmd_out1'] 26 | stderr=rt['run_cmd_out2'] 27 | if os.path.isfile(stdout): 28 | r=ck.load_text_file({'text_file':stdout,'split_to_list':'yes'}) 29 | if r['return']>0: return r 30 | lst+=r['lst'] 31 | if os.path.isfile(stderr): 32 | r=ck.load_text_file({'text_file':stderr,'split_to_list':'yes'}) 33 | if r['return']>0: return r 34 | lst+=r['lst'] 35 | 36 | # Match e.g. "[io_0] frame 1: 19.48 ms - 051.34 fps". 37 | frame_regex = \ 38 | '\[(?P[\w_]+)\] frame ' + \ 39 | '(?P\d+): ' + \ 40 | '(?P\d*\.?\d*) ms - ' + \ 41 | '(?P\d*\.?\d*) fps' 42 | # Match e.g. '[host] reading parameters from "/home/accesscore/KaNN_Evaluation_Package_v1.2/GoogLeNet_imagenet/params.bin": 14013664 bytes read'. 43 | params_regex = \ 44 | '\[host\] reading parameters from ' + \ 45 | '\"(?P[\w\./_-]*)\"' + \ 46 | ': (?P\d+) bytes read' 47 | # Match e.g. '[clus_00] Arg 2: io_bin'. 48 | arg_regex = \ 49 | '\[clus_00\] Arg ' + \ 50 | '(?P\d+): ' + \ 51 | '(?P[\w\./_-]*)' 52 | # Match e.g. '21.0ms 03.3ms(15.6%) 00.7ms(03.5%) ...'. 53 | last_frame_regex = \ 54 | '(?P\d*\.?\d*)ms ' + \ 55 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\) ' + \ 56 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\) ' + \ 57 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\) ' + \ 58 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\) ' + \ 59 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\) ' + \ 60 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\) ' + \ 61 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\) ' + \ 62 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\) ' + \ 63 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\) ' + \ 64 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\) ' + \ 65 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\) ' + \ 66 | '(?P\d*\.?\d*)ms\((?P\d*\.?\d*)%\)' 67 | # Match e.g. 'MPPA 400 MHz 5.96 FPS 167.83 ms' (deprecated). 68 | mppa_mhz_fps_ms_regex = \ 69 | 'MPPA ' + \ 70 | '(?P\d*) MHz ' + \ 71 | '(?P\d*\.?\d*) FPS ' + \ 72 | '(?P\d*\.?\d*) ms' 73 | 74 | d={} 75 | d['version'] = version 76 | d['max_num_images'] = max_num_images 77 | d['params'] = {} 78 | d['args'] = {} 79 | d['frame_timings'] = [] 80 | d['last_frame'] = [] 81 | d['mppa_mhz_fps_ms'] = {} 82 | for line in lst: 83 | # Match io or host frame timing. 84 | match = re.search(frame_regex, line) 85 | if match: 86 | frame = {} 87 | frame['unit'] = match.group('unit') 88 | frame['idx'] = int(match.group('idx')) 89 | frame['ms'] = float(match.group('ms')) 90 | frame['fps'] = float(match.group('fps')) 91 | d['frame_timings'].append(frame) 92 | # Match params (net topology and weights). 93 | match = re.search(params_regex, line) 94 | if match: 95 | d['params']['path'] = match.group('path') 96 | d['params']['bytes'] = int(match.group('bytes')) 97 | # Match arguments (paths, number of images). 98 | match = re.search(arg_regex, line) 99 | if match: 100 | d['args'][match.group('idx')] = match.group('val') 101 | # Match timings on clusters for the last frame. 102 | match = re.search(last_frame_regex, line) 103 | if match: 104 | timings = {} 105 | timings['total_ms'] = float(match.group('total_ms')) 106 | timings['total_pc'] = float(100) 107 | timings['wait_clus_ms'] = float(match.group('wait_clus_ms')) 108 | timings['wait_clus_pc'] = float(match.group('wait_clus_pc')) 109 | timings['send_clus_ms'] = float(match.group('send_clus_ms')) 110 | timings['send_clus_pc'] = float(match.group('send_clus_pc')) 111 | timings['wait_io_ms'] = float(match.group('wait_io_ms')) 112 | timings['wait_io_pc'] = float(match.group('wait_io_pc')) 113 | timings['send_io_ms'] = float(match.group('send_io_ms')) 114 | timings['send_io_pc'] = float(match.group('send_io_pc')) 115 | timings['conv_ms'] = float(match.group('conv_ms')) 116 | timings['conv_pc'] = float(match.group('conv_pc')) 117 | timings['relu_ms'] = float(match.group('relu_ms')) 118 | timings['relu_pc'] = float(match.group('relu_pc')) 119 | timings['copy_ms'] = float(match.group('copy_ms')) 120 | timings['copy_pc'] = float(match.group('copy_pc')) 121 | timings['max_pool_ms'] = float(match.group('max_pool_ms')) 122 | timings['max_pool_pc'] = float(match.group('max_pool_pc')) 123 | timings['avg_pool_ms'] = float(match.group('avg_pool_ms')) 124 | timings['avg_pool_pc'] = float(match.group('avg_pool_pc')) 125 | timings['lrn_ms'] = float(match.group('lrn_ms')) 126 | timings['lrn_pc'] = float(match.group('lrn_pc')) 127 | timings['softmax_ms'] = float(match.group('softmax_ms')) 128 | timings['softmax_pc'] = float(match.group('softmax_pc')) 129 | timings['other_ms'] = float(match.group('other_ms')) 130 | timings['other_pc'] = float(match.group('other_pc')) 131 | d['last_frame'].append(timings) 132 | # Match a single line with 3 metrics (inaccurate). 133 | match = re.search(mppa_mhz_fps_ms_regex, line) 134 | if match: 135 | d['mppa_mhz_fps_ms']['mhz'] = int(match.group('mhz')) 136 | d['mppa_mhz_fps_ms']['fps'] = float(match.group('fps')) 137 | d['mppa_mhz_fps_ms']['ms'] = float(match.group('ms')) 138 | d['post_processed'] = 'yes' 139 | 140 | rr={} 141 | rr['return']=0 142 | 143 | # Collect deps of interest. 144 | imagenet_aux=deps.get('imagenet-aux',{}) 145 | imagenet_aux_dict=imagenet_aux.get('dict',{}) 146 | imagenet_aux_dict_env=imagenet_aux_dict.get('env',{}) 147 | d['CK_CAFFE_IMAGENET_VAL_TXT']=imagenet_aux_dict_env.get('CK_CAFFE_IMAGENET_VAL_TXT','') 148 | d['CK_CAFFE_IMAGENET_SYNSET_WORDS_TXT']=imagenet_aux_dict_env.get('CK_CAFFE_IMAGENET_SYNSET_WORDS_TXT','') 149 | # TODO: Handle the case of no imagenet_aux (cf. CK-TensorRT). 150 | with open(d['CK_CAFFE_IMAGENET_VAL_TXT']) as imagenet_val_txt: 151 | image_to_synset_map = {} 152 | for image_synset in imagenet_val_txt: 153 | (image, synset) = image_synset.split() 154 | image_to_synset_map[image] = int(synset) 155 | with open(d['CK_CAFFE_IMAGENET_SYNSET_WORDS_TXT']) as imagenet_synset_words_txt: 156 | synset_list = [] 157 | for n00000000_synset in imagenet_synset_words_txt: 158 | synset = n00000000_synset[10:-1] 159 | synset_list.append(synset) 160 | top_n_list = [1,5] 161 | for n in top_n_list: 162 | top_n_accuracy = 'accuracy_top'+str(n) 163 | d[top_n_accuracy] = 0 164 | 165 | d['frame_predictions'] = [] 166 | imagenet_num_classes = 1000 167 | kann_output_file = 'tmp-kann-output.tmp' 168 | kann_paths_file = 'tmp-kann-paths.tmp' 169 | with open(kann_output_file, 'rb') as kann_output_f, open(kann_paths_file, 'r') as kann_paths_f: 170 | num_elems = imagenet_num_classes*max_num_images 171 | sizeof_fp32 = 4 172 | num_bytes = num_elems*sizeof_fp32 173 | kann_output_as_binary = kann_output_f.read(num_bytes) 174 | kann_output_as_floats = struct.unpack('f'*num_elems, kann_output_as_binary) 175 | kann_paths = kann_paths_f.readlines() 176 | # For each input image / vector of probabilities. 177 | for image_idx in range(max_num_images): 178 | image_start = image_idx * imagenet_num_classes 179 | image_end = image_start + imagenet_num_classes 180 | image_probs = kann_output_as_floats[image_start:image_end] 181 | image_path = kann_paths[image_idx].rstrip('\n').replace('kann_input', 'JPEG') 182 | frame_predictions = {} 183 | frame_predictions['file_name'] = image_path 184 | # Associate obtained probabilities with class indices. 185 | all_predictions = [] 186 | for class_idx in range(imagenet_num_classes): 187 | prediction = {} 188 | prediction['class'] = class_idx 189 | prediction['probability'] = image_probs[class_idx] 190 | all_predictions.append(prediction) 191 | all_predictions = sorted(all_predictions, key=lambda k: k['probability'], reverse=True) 192 | frame_predictions['class_topmost'] = all_predictions[0]['class'] 193 | frame_predictions['class_correct'] = image_to_synset_map.get(image_path, -1) 194 | # Calculate top_n accuracies. 195 | for n in top_n_list: 196 | top_n_accuracy = 'accuracy_top'+str(n) 197 | top_n_predictions = all_predictions[0:n] 198 | frame_predictions[top_n_accuracy] = 'no' 199 | for prediction in top_n_predictions: 200 | if prediction['class'] == frame_predictions['class_correct']: 201 | frame_predictions[top_n_accuracy] = 'yes' 202 | d[top_n_accuracy] += 1 203 | break 204 | d['frame_predictions'].append(frame_predictions) 205 | # TODO: Merge d['frame_predictions'] and d['frame_timings'] 206 | # into d['per_image_info'] (cf. CK-TensorRT). 207 | 208 | if d.get('post_processed','')=='yes': 209 | # Calculate the overall accuracy. 210 | num_images = len(d['frame_predictions']) 211 | scaling = 1.0 / num_images 212 | for n in top_n_list: 213 | top_n_accuracy = 'accuracy_top'+str(n) 214 | d[top_n_accuracy] *= scaling 215 | # Save to fine-grain-timer file. 216 | r=ck.save_json_to_file({'json_file':'tmp-ck-timer.json', 'dict':d}) 217 | if r['return']>0: return r 218 | else: 219 | rr['return']=1 220 | rr['error']='failed to match required info in KaNN output!' 221 | 222 | return rr 223 | 224 | # Do not add anything here! 225 | -------------------------------------------------------------------------------- /package/kannmodel-deepscale-squeezenet-1.0/deploy.prototxt: -------------------------------------------------------------------------------- 1 | # please cite: 2 | # @article{SqueezeNet, 3 | # Author = {Forrest N. Iandola and Matthew W. Moskewicz and Khalid Ashraf and Song Han and William J. Dally and Kurt Keutzer}, 4 | # Title = {SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and $<$1MB model size}, 5 | # Journal = {arXiv:1602.07360}, 6 | # Year = {2016} 7 | #} 8 | layer { 9 | name: "data" 10 | type: "Input" 11 | top: "data" 12 | transform_param { 13 | crop_size: 227 14 | mean_value: 104 15 | mean_value: 117 16 | mean_value: 123 17 | } 18 | input_param { 19 | shape { 20 | dim: 1 21 | dim: 3 22 | dim: 227 23 | dim: 227 24 | } 25 | } 26 | } 27 | layer { 28 | name: "conv1" 29 | type: "Convolution" 30 | bottom: "data" 31 | top: "conv1" 32 | convolution_param { 33 | num_output: 96 34 | kernel_size: 7 35 | stride: 2 36 | } 37 | } 38 | layer { 39 | name: "relu_conv1" 40 | type: "ReLU" 41 | bottom: "conv1" 42 | top: "conv1" 43 | } 44 | layer { 45 | name: "pool1" 46 | type: "Pooling" 47 | bottom: "conv1" 48 | top: "pool1" 49 | pooling_param { 50 | pool: MAX 51 | kernel_size: 3 52 | stride: 2 53 | } 54 | } 55 | layer { 56 | name: "fire2/squeeze1x1" 57 | type: "Convolution" 58 | bottom: "pool1" 59 | top: "fire2/squeeze1x1" 60 | convolution_param { 61 | num_output: 16 62 | kernel_size: 1 63 | } 64 | } 65 | layer { 66 | name: "fire2/relu_squeeze1x1" 67 | type: "ReLU" 68 | bottom: "fire2/squeeze1x1" 69 | top: "fire2/squeeze1x1" 70 | } 71 | layer { 72 | name: "fire2/expand1x1" 73 | type: "Convolution" 74 | bottom: "fire2/squeeze1x1" 75 | top: "fire2/expand1x1" 76 | convolution_param { 77 | num_output: 64 78 | kernel_size: 1 79 | } 80 | } 81 | layer { 82 | name: "fire2/relu_expand1x1" 83 | type: "ReLU" 84 | bottom: "fire2/expand1x1" 85 | top: "fire2/expand1x1" 86 | } 87 | layer { 88 | name: "fire2/expand3x3" 89 | type: "Convolution" 90 | bottom: "fire2/squeeze1x1" 91 | top: "fire2/expand3x3" 92 | convolution_param { 93 | num_output: 64 94 | pad: 1 95 | kernel_size: 3 96 | } 97 | } 98 | layer { 99 | name: "fire2/relu_expand3x3" 100 | type: "ReLU" 101 | bottom: "fire2/expand3x3" 102 | top: "fire2/expand3x3" 103 | } 104 | layer { 105 | name: "fire2/concat" 106 | type: "Concat" 107 | bottom: "fire2/expand1x1" 108 | bottom: "fire2/expand3x3" 109 | top: "fire2/concat" 110 | } 111 | layer { 112 | name: "fire3/squeeze1x1" 113 | type: "Convolution" 114 | bottom: "fire2/concat" 115 | top: "fire3/squeeze1x1" 116 | convolution_param { 117 | num_output: 16 118 | kernel_size: 1 119 | } 120 | } 121 | layer { 122 | name: "fire3/relu_squeeze1x1" 123 | type: "ReLU" 124 | bottom: "fire3/squeeze1x1" 125 | top: "fire3/squeeze1x1" 126 | } 127 | layer { 128 | name: "fire3/expand1x1" 129 | type: "Convolution" 130 | bottom: "fire3/squeeze1x1" 131 | top: "fire3/expand1x1" 132 | convolution_param { 133 | num_output: 64 134 | kernel_size: 1 135 | } 136 | } 137 | layer { 138 | name: "fire3/relu_expand1x1" 139 | type: "ReLU" 140 | bottom: "fire3/expand1x1" 141 | top: "fire3/expand1x1" 142 | } 143 | layer { 144 | name: "fire3/expand3x3" 145 | type: "Convolution" 146 | bottom: "fire3/squeeze1x1" 147 | top: "fire3/expand3x3" 148 | convolution_param { 149 | num_output: 64 150 | pad: 1 151 | kernel_size: 3 152 | } 153 | } 154 | layer { 155 | name: "fire3/relu_expand3x3" 156 | type: "ReLU" 157 | bottom: "fire3/expand3x3" 158 | top: "fire3/expand3x3" 159 | } 160 | layer { 161 | name: "fire3/concat" 162 | type: "Concat" 163 | bottom: "fire3/expand1x1" 164 | bottom: "fire3/expand3x3" 165 | top: "fire3/concat" 166 | } 167 | layer { 168 | name: "fire4/squeeze1x1" 169 | type: "Convolution" 170 | bottom: "fire3/concat" 171 | top: "fire4/squeeze1x1" 172 | convolution_param { 173 | num_output: 32 174 | kernel_size: 1 175 | } 176 | } 177 | layer { 178 | name: "fire4/relu_squeeze1x1" 179 | type: "ReLU" 180 | bottom: "fire4/squeeze1x1" 181 | top: "fire4/squeeze1x1" 182 | } 183 | layer { 184 | name: "fire4/expand1x1" 185 | type: "Convolution" 186 | bottom: "fire4/squeeze1x1" 187 | top: "fire4/expand1x1" 188 | convolution_param { 189 | num_output: 128 190 | kernel_size: 1 191 | } 192 | } 193 | layer { 194 | name: "fire4/relu_expand1x1" 195 | type: "ReLU" 196 | bottom: "fire4/expand1x1" 197 | top: "fire4/expand1x1" 198 | } 199 | layer { 200 | name: "fire4/expand3x3" 201 | type: "Convolution" 202 | bottom: "fire4/squeeze1x1" 203 | top: "fire4/expand3x3" 204 | convolution_param { 205 | num_output: 128 206 | pad: 1 207 | kernel_size: 3 208 | } 209 | } 210 | layer { 211 | name: "fire4/relu_expand3x3" 212 | type: "ReLU" 213 | bottom: "fire4/expand3x3" 214 | top: "fire4/expand3x3" 215 | } 216 | layer { 217 | name: "fire4/concat" 218 | type: "Concat" 219 | bottom: "fire4/expand1x1" 220 | bottom: "fire4/expand3x3" 221 | top: "fire4/concat" 222 | } 223 | layer { 224 | name: "pool4" 225 | type: "Pooling" 226 | bottom: "fire4/concat" 227 | top: "pool4" 228 | pooling_param { 229 | pool: MAX 230 | kernel_size: 3 231 | stride: 2 232 | } 233 | } 234 | layer { 235 | name: "fire5/squeeze1x1" 236 | type: "Convolution" 237 | bottom: "pool4" 238 | top: "fire5/squeeze1x1" 239 | convolution_param { 240 | num_output: 32 241 | kernel_size: 1 242 | } 243 | } 244 | layer { 245 | name: "fire5/relu_squeeze1x1" 246 | type: "ReLU" 247 | bottom: "fire5/squeeze1x1" 248 | top: "fire5/squeeze1x1" 249 | } 250 | layer { 251 | name: "fire5/expand1x1" 252 | type: "Convolution" 253 | bottom: "fire5/squeeze1x1" 254 | top: "fire5/expand1x1" 255 | convolution_param { 256 | num_output: 128 257 | kernel_size: 1 258 | } 259 | } 260 | layer { 261 | name: "fire5/relu_expand1x1" 262 | type: "ReLU" 263 | bottom: "fire5/expand1x1" 264 | top: "fire5/expand1x1" 265 | } 266 | layer { 267 | name: "fire5/expand3x3" 268 | type: "Convolution" 269 | bottom: "fire5/squeeze1x1" 270 | top: "fire5/expand3x3" 271 | convolution_param { 272 | num_output: 128 273 | pad: 1 274 | kernel_size: 3 275 | } 276 | } 277 | layer { 278 | name: "fire5/relu_expand3x3" 279 | type: "ReLU" 280 | bottom: "fire5/expand3x3" 281 | top: "fire5/expand3x3" 282 | } 283 | layer { 284 | name: "fire5/concat" 285 | type: "Concat" 286 | bottom: "fire5/expand1x1" 287 | bottom: "fire5/expand3x3" 288 | top: "fire5/concat" 289 | } 290 | layer { 291 | name: "fire6/squeeze1x1" 292 | type: "Convolution" 293 | bottom: "fire5/concat" 294 | top: "fire6/squeeze1x1" 295 | convolution_param { 296 | num_output: 48 297 | kernel_size: 1 298 | } 299 | } 300 | layer { 301 | name: "fire6/relu_squeeze1x1" 302 | type: "ReLU" 303 | bottom: "fire6/squeeze1x1" 304 | top: "fire6/squeeze1x1" 305 | } 306 | layer { 307 | name: "fire6/expand1x1" 308 | type: "Convolution" 309 | bottom: "fire6/squeeze1x1" 310 | top: "fire6/expand1x1" 311 | convolution_param { 312 | num_output: 192 313 | kernel_size: 1 314 | } 315 | } 316 | layer { 317 | name: "fire6/relu_expand1x1" 318 | type: "ReLU" 319 | bottom: "fire6/expand1x1" 320 | top: "fire6/expand1x1" 321 | } 322 | layer { 323 | name: "fire6/expand3x3" 324 | type: "Convolution" 325 | bottom: "fire6/squeeze1x1" 326 | top: "fire6/expand3x3" 327 | convolution_param { 328 | num_output: 192 329 | pad: 1 330 | kernel_size: 3 331 | } 332 | } 333 | layer { 334 | name: "fire6/relu_expand3x3" 335 | type: "ReLU" 336 | bottom: "fire6/expand3x3" 337 | top: "fire6/expand3x3" 338 | } 339 | layer { 340 | name: "fire6/concat" 341 | type: "Concat" 342 | bottom: "fire6/expand1x1" 343 | bottom: "fire6/expand3x3" 344 | top: "fire6/concat" 345 | } 346 | layer { 347 | name: "fire7/squeeze1x1" 348 | type: "Convolution" 349 | bottom: "fire6/concat" 350 | top: "fire7/squeeze1x1" 351 | convolution_param { 352 | num_output: 48 353 | kernel_size: 1 354 | } 355 | } 356 | layer { 357 | name: "fire7/relu_squeeze1x1" 358 | type: "ReLU" 359 | bottom: "fire7/squeeze1x1" 360 | top: "fire7/squeeze1x1" 361 | } 362 | layer { 363 | name: "fire7/expand1x1" 364 | type: "Convolution" 365 | bottom: "fire7/squeeze1x1" 366 | top: "fire7/expand1x1" 367 | convolution_param { 368 | num_output: 192 369 | kernel_size: 1 370 | } 371 | } 372 | layer { 373 | name: "fire7/relu_expand1x1" 374 | type: "ReLU" 375 | bottom: "fire7/expand1x1" 376 | top: "fire7/expand1x1" 377 | } 378 | layer { 379 | name: "fire7/expand3x3" 380 | type: "Convolution" 381 | bottom: "fire7/squeeze1x1" 382 | top: "fire7/expand3x3" 383 | convolution_param { 384 | num_output: 192 385 | pad: 1 386 | kernel_size: 3 387 | } 388 | } 389 | layer { 390 | name: "fire7/relu_expand3x3" 391 | type: "ReLU" 392 | bottom: "fire7/expand3x3" 393 | top: "fire7/expand3x3" 394 | } 395 | layer { 396 | name: "fire7/concat" 397 | type: "Concat" 398 | bottom: "fire7/expand1x1" 399 | bottom: "fire7/expand3x3" 400 | top: "fire7/concat" 401 | } 402 | layer { 403 | name: "fire8/squeeze1x1" 404 | type: "Convolution" 405 | bottom: "fire7/concat" 406 | top: "fire8/squeeze1x1" 407 | convolution_param { 408 | num_output: 64 409 | kernel_size: 1 410 | } 411 | } 412 | layer { 413 | name: "fire8/relu_squeeze1x1" 414 | type: "ReLU" 415 | bottom: "fire8/squeeze1x1" 416 | top: "fire8/squeeze1x1" 417 | } 418 | layer { 419 | name: "fire8/expand1x1" 420 | type: "Convolution" 421 | bottom: "fire8/squeeze1x1" 422 | top: "fire8/expand1x1" 423 | convolution_param { 424 | num_output: 256 425 | kernel_size: 1 426 | } 427 | } 428 | layer { 429 | name: "fire8/relu_expand1x1" 430 | type: "ReLU" 431 | bottom: "fire8/expand1x1" 432 | top: "fire8/expand1x1" 433 | } 434 | layer { 435 | name: "fire8/expand3x3" 436 | type: "Convolution" 437 | bottom: "fire8/squeeze1x1" 438 | top: "fire8/expand3x3" 439 | convolution_param { 440 | num_output: 256 441 | pad: 1 442 | kernel_size: 3 443 | } 444 | } 445 | layer { 446 | name: "fire8/relu_expand3x3" 447 | type: "ReLU" 448 | bottom: "fire8/expand3x3" 449 | top: "fire8/expand3x3" 450 | } 451 | layer { 452 | name: "fire8/concat" 453 | type: "Concat" 454 | bottom: "fire8/expand1x1" 455 | bottom: "fire8/expand3x3" 456 | top: "fire8/concat" 457 | } 458 | layer { 459 | name: "pool8" 460 | type: "Pooling" 461 | bottom: "fire8/concat" 462 | top: "pool8" 463 | pooling_param { 464 | pool: MAX 465 | kernel_size: 3 466 | stride: 2 467 | } 468 | } 469 | layer { 470 | name: "fire9/squeeze1x1" 471 | type: "Convolution" 472 | bottom: "pool8" 473 | top: "fire9/squeeze1x1" 474 | convolution_param { 475 | num_output: 64 476 | kernel_size: 1 477 | } 478 | } 479 | layer { 480 | name: "fire9/relu_squeeze1x1" 481 | type: "ReLU" 482 | bottom: "fire9/squeeze1x1" 483 | top: "fire9/squeeze1x1" 484 | } 485 | layer { 486 | name: "fire9/expand1x1" 487 | type: "Convolution" 488 | bottom: "fire9/squeeze1x1" 489 | top: "fire9/expand1x1" 490 | convolution_param { 491 | num_output: 256 492 | kernel_size: 1 493 | } 494 | } 495 | layer { 496 | name: "fire9/relu_expand1x1" 497 | type: "ReLU" 498 | bottom: "fire9/expand1x1" 499 | top: "fire9/expand1x1" 500 | } 501 | layer { 502 | name: "fire9/expand3x3" 503 | type: "Convolution" 504 | bottom: "fire9/squeeze1x1" 505 | top: "fire9/expand3x3" 506 | convolution_param { 507 | num_output: 256 508 | pad: 1 509 | kernel_size: 3 510 | } 511 | } 512 | layer { 513 | name: "fire9/relu_expand3x3" 514 | type: "ReLU" 515 | bottom: "fire9/expand3x3" 516 | top: "fire9/expand3x3" 517 | } 518 | layer { 519 | name: "fire9/concat" 520 | type: "Concat" 521 | bottom: "fire9/expand1x1" 522 | bottom: "fire9/expand3x3" 523 | top: "fire9/concat" 524 | } 525 | layer { 526 | name: "drop9" 527 | type: "Dropout" 528 | bottom: "fire9/concat" 529 | top: "fire9/concat" 530 | dropout_param { 531 | dropout_ratio: 0.5 532 | } 533 | } 534 | layer { 535 | name: "conv10" 536 | type: "Convolution" 537 | bottom: "fire9/concat" 538 | top: "conv10" 539 | convolution_param { 540 | num_output: 1000 541 | pad: 1 542 | kernel_size: 1 543 | } 544 | } 545 | layer { 546 | name: "relu_conv10" 547 | type: "ReLU" 548 | bottom: "conv10" 549 | top: "conv10" 550 | } 551 | layer { 552 | name: "pool10" 553 | type: "Pooling" 554 | bottom: "conv10" 555 | top: "pool10" 556 | pooling_param { 557 | pool: AVE 558 | global_pooling: true 559 | } 560 | } 561 | layer { 562 | name: "prob" 563 | type: "Softmax" 564 | bottom: "pool10" 565 | top: "prob" 566 | } 567 | -------------------------------------------------------------------------------- /package/kannmodel-deepscale-squeezenet-1.1/deploy.prototxt: -------------------------------------------------------------------------------- 1 | # please cite: 2 | # @article{SqueezeNet, 3 | # Author = {Forrest N. Iandola and Matthew W. Moskewicz and Khalid Ashraf and Song Han and William J. Dally and Kurt Keutzer}, 4 | # Title = {SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and $<$1MB model size}, 5 | # Journal = {arXiv:1602.07360}, 6 | # Year = {2016} 7 | # } 8 | layer { 9 | name: "data" 10 | type: "Input" 11 | top: "data" 12 | transform_param { 13 | crop_size: 227 14 | mean_value: 104 15 | mean_value: 117 16 | mean_value: 123 17 | } 18 | input_param { 19 | shape { 20 | dim: 1 21 | dim: 3 22 | dim: 227 23 | dim: 227 24 | } 25 | } 26 | } 27 | layer { 28 | name: "conv1" 29 | type: "Convolution" 30 | bottom: "data" 31 | top: "conv1" 32 | convolution_param { 33 | num_output: 64 34 | kernel_size: 3 35 | stride: 2 36 | weight_filler { 37 | type: "xavier" 38 | } 39 | } 40 | } 41 | layer { 42 | name: "relu_conv1" 43 | type: "ReLU" 44 | bottom: "conv1" 45 | top: "conv1" 46 | } 47 | layer { 48 | name: "pool1" 49 | type: "Pooling" 50 | bottom: "conv1" 51 | top: "pool1" 52 | pooling_param { 53 | pool: MAX 54 | kernel_size: 3 55 | stride: 2 56 | } 57 | } 58 | layer { 59 | name: "fire2/squeeze1x1" 60 | type: "Convolution" 61 | bottom: "pool1" 62 | top: "fire2/squeeze1x1" 63 | convolution_param { 64 | num_output: 16 65 | kernel_size: 1 66 | weight_filler { 67 | type: "xavier" 68 | } 69 | } 70 | } 71 | layer { 72 | name: "fire2/relu_squeeze1x1" 73 | type: "ReLU" 74 | bottom: "fire2/squeeze1x1" 75 | top: "fire2/squeeze1x1" 76 | } 77 | layer { 78 | name: "fire2/expand1x1" 79 | type: "Convolution" 80 | bottom: "fire2/squeeze1x1" 81 | top: "fire2/expand1x1" 82 | convolution_param { 83 | num_output: 64 84 | kernel_size: 1 85 | weight_filler { 86 | type: "xavier" 87 | } 88 | } 89 | } 90 | layer { 91 | name: "fire2/relu_expand1x1" 92 | type: "ReLU" 93 | bottom: "fire2/expand1x1" 94 | top: "fire2/expand1x1" 95 | } 96 | layer { 97 | name: "fire2/expand3x3" 98 | type: "Convolution" 99 | bottom: "fire2/squeeze1x1" 100 | top: "fire2/expand3x3" 101 | convolution_param { 102 | num_output: 64 103 | pad: 1 104 | kernel_size: 3 105 | weight_filler { 106 | type: "xavier" 107 | } 108 | } 109 | } 110 | layer { 111 | name: "fire2/relu_expand3x3" 112 | type: "ReLU" 113 | bottom: "fire2/expand3x3" 114 | top: "fire2/expand3x3" 115 | } 116 | layer { 117 | name: "fire2/concat" 118 | type: "Concat" 119 | bottom: "fire2/expand1x1" 120 | bottom: "fire2/expand3x3" 121 | top: "fire2/concat" 122 | } 123 | layer { 124 | name: "fire3/squeeze1x1" 125 | type: "Convolution" 126 | bottom: "fire2/concat" 127 | top: "fire3/squeeze1x1" 128 | convolution_param { 129 | num_output: 16 130 | kernel_size: 1 131 | weight_filler { 132 | type: "xavier" 133 | } 134 | } 135 | } 136 | layer { 137 | name: "fire3/relu_squeeze1x1" 138 | type: "ReLU" 139 | bottom: "fire3/squeeze1x1" 140 | top: "fire3/squeeze1x1" 141 | } 142 | layer { 143 | name: "fire3/expand1x1" 144 | type: "Convolution" 145 | bottom: "fire3/squeeze1x1" 146 | top: "fire3/expand1x1" 147 | convolution_param { 148 | num_output: 64 149 | kernel_size: 1 150 | weight_filler { 151 | type: "xavier" 152 | } 153 | } 154 | } 155 | layer { 156 | name: "fire3/relu_expand1x1" 157 | type: "ReLU" 158 | bottom: "fire3/expand1x1" 159 | top: "fire3/expand1x1" 160 | } 161 | layer { 162 | name: "fire3/expand3x3" 163 | type: "Convolution" 164 | bottom: "fire3/squeeze1x1" 165 | top: "fire3/expand3x3" 166 | convolution_param { 167 | num_output: 64 168 | pad: 1 169 | kernel_size: 3 170 | weight_filler { 171 | type: "xavier" 172 | } 173 | } 174 | } 175 | layer { 176 | name: "fire3/relu_expand3x3" 177 | type: "ReLU" 178 | bottom: "fire3/expand3x3" 179 | top: "fire3/expand3x3" 180 | } 181 | layer { 182 | name: "fire3/concat" 183 | type: "Concat" 184 | bottom: "fire3/expand1x1" 185 | bottom: "fire3/expand3x3" 186 | top: "fire3/concat" 187 | } 188 | layer { 189 | name: "pool3" 190 | type: "Pooling" 191 | bottom: "fire3/concat" 192 | top: "pool3" 193 | pooling_param { 194 | pool: MAX 195 | kernel_size: 3 196 | stride: 2 197 | } 198 | } 199 | layer { 200 | name: "fire4/squeeze1x1" 201 | type: "Convolution" 202 | bottom: "pool3" 203 | top: "fire4/squeeze1x1" 204 | convolution_param { 205 | num_output: 32 206 | kernel_size: 1 207 | weight_filler { 208 | type: "xavier" 209 | } 210 | } 211 | } 212 | layer { 213 | name: "fire4/relu_squeeze1x1" 214 | type: "ReLU" 215 | bottom: "fire4/squeeze1x1" 216 | top: "fire4/squeeze1x1" 217 | } 218 | layer { 219 | name: "fire4/expand1x1" 220 | type: "Convolution" 221 | bottom: "fire4/squeeze1x1" 222 | top: "fire4/expand1x1" 223 | convolution_param { 224 | num_output: 128 225 | kernel_size: 1 226 | weight_filler { 227 | type: "xavier" 228 | } 229 | } 230 | } 231 | layer { 232 | name: "fire4/relu_expand1x1" 233 | type: "ReLU" 234 | bottom: "fire4/expand1x1" 235 | top: "fire4/expand1x1" 236 | } 237 | layer { 238 | name: "fire4/expand3x3" 239 | type: "Convolution" 240 | bottom: "fire4/squeeze1x1" 241 | top: "fire4/expand3x3" 242 | convolution_param { 243 | num_output: 128 244 | pad: 1 245 | kernel_size: 3 246 | weight_filler { 247 | type: "xavier" 248 | } 249 | } 250 | } 251 | layer { 252 | name: "fire4/relu_expand3x3" 253 | type: "ReLU" 254 | bottom: "fire4/expand3x3" 255 | top: "fire4/expand3x3" 256 | } 257 | layer { 258 | name: "fire4/concat" 259 | type: "Concat" 260 | bottom: "fire4/expand1x1" 261 | bottom: "fire4/expand3x3" 262 | top: "fire4/concat" 263 | } 264 | layer { 265 | name: "fire5/squeeze1x1" 266 | type: "Convolution" 267 | bottom: "fire4/concat" 268 | top: "fire5/squeeze1x1" 269 | convolution_param { 270 | num_output: 32 271 | kernel_size: 1 272 | weight_filler { 273 | type: "xavier" 274 | } 275 | } 276 | } 277 | layer { 278 | name: "fire5/relu_squeeze1x1" 279 | type: "ReLU" 280 | bottom: "fire5/squeeze1x1" 281 | top: "fire5/squeeze1x1" 282 | } 283 | layer { 284 | name: "fire5/expand1x1" 285 | type: "Convolution" 286 | bottom: "fire5/squeeze1x1" 287 | top: "fire5/expand1x1" 288 | convolution_param { 289 | num_output: 128 290 | kernel_size: 1 291 | weight_filler { 292 | type: "xavier" 293 | } 294 | } 295 | } 296 | layer { 297 | name: "fire5/relu_expand1x1" 298 | type: "ReLU" 299 | bottom: "fire5/expand1x1" 300 | top: "fire5/expand1x1" 301 | } 302 | layer { 303 | name: "fire5/expand3x3" 304 | type: "Convolution" 305 | bottom: "fire5/squeeze1x1" 306 | top: "fire5/expand3x3" 307 | convolution_param { 308 | num_output: 128 309 | pad: 1 310 | kernel_size: 3 311 | weight_filler { 312 | type: "xavier" 313 | } 314 | } 315 | } 316 | layer { 317 | name: "fire5/relu_expand3x3" 318 | type: "ReLU" 319 | bottom: "fire5/expand3x3" 320 | top: "fire5/expand3x3" 321 | } 322 | layer { 323 | name: "fire5/concat" 324 | type: "Concat" 325 | bottom: "fire5/expand1x1" 326 | bottom: "fire5/expand3x3" 327 | top: "fire5/concat" 328 | } 329 | layer { 330 | name: "pool5" 331 | type: "Pooling" 332 | bottom: "fire5/concat" 333 | top: "pool5" 334 | pooling_param { 335 | pool: MAX 336 | kernel_size: 3 337 | stride: 2 338 | } 339 | } 340 | layer { 341 | name: "fire6/squeeze1x1" 342 | type: "Convolution" 343 | bottom: "pool5" 344 | top: "fire6/squeeze1x1" 345 | convolution_param { 346 | num_output: 48 347 | kernel_size: 1 348 | weight_filler { 349 | type: "xavier" 350 | } 351 | } 352 | } 353 | layer { 354 | name: "fire6/relu_squeeze1x1" 355 | type: "ReLU" 356 | bottom: "fire6/squeeze1x1" 357 | top: "fire6/squeeze1x1" 358 | } 359 | layer { 360 | name: "fire6/expand1x1" 361 | type: "Convolution" 362 | bottom: "fire6/squeeze1x1" 363 | top: "fire6/expand1x1" 364 | convolution_param { 365 | num_output: 192 366 | kernel_size: 1 367 | weight_filler { 368 | type: "xavier" 369 | } 370 | } 371 | } 372 | layer { 373 | name: "fire6/relu_expand1x1" 374 | type: "ReLU" 375 | bottom: "fire6/expand1x1" 376 | top: "fire6/expand1x1" 377 | } 378 | layer { 379 | name: "fire6/expand3x3" 380 | type: "Convolution" 381 | bottom: "fire6/squeeze1x1" 382 | top: "fire6/expand3x3" 383 | convolution_param { 384 | num_output: 192 385 | pad: 1 386 | kernel_size: 3 387 | weight_filler { 388 | type: "xavier" 389 | } 390 | } 391 | } 392 | layer { 393 | name: "fire6/relu_expand3x3" 394 | type: "ReLU" 395 | bottom: "fire6/expand3x3" 396 | top: "fire6/expand3x3" 397 | } 398 | layer { 399 | name: "fire6/concat" 400 | type: "Concat" 401 | bottom: "fire6/expand1x1" 402 | bottom: "fire6/expand3x3" 403 | top: "fire6/concat" 404 | } 405 | layer { 406 | name: "fire7/squeeze1x1" 407 | type: "Convolution" 408 | bottom: "fire6/concat" 409 | top: "fire7/squeeze1x1" 410 | convolution_param { 411 | num_output: 48 412 | kernel_size: 1 413 | weight_filler { 414 | type: "xavier" 415 | } 416 | } 417 | } 418 | layer { 419 | name: "fire7/relu_squeeze1x1" 420 | type: "ReLU" 421 | bottom: "fire7/squeeze1x1" 422 | top: "fire7/squeeze1x1" 423 | } 424 | layer { 425 | name: "fire7/expand1x1" 426 | type: "Convolution" 427 | bottom: "fire7/squeeze1x1" 428 | top: "fire7/expand1x1" 429 | convolution_param { 430 | num_output: 192 431 | kernel_size: 1 432 | weight_filler { 433 | type: "xavier" 434 | } 435 | } 436 | } 437 | layer { 438 | name: "fire7/relu_expand1x1" 439 | type: "ReLU" 440 | bottom: "fire7/expand1x1" 441 | top: "fire7/expand1x1" 442 | } 443 | layer { 444 | name: "fire7/expand3x3" 445 | type: "Convolution" 446 | bottom: "fire7/squeeze1x1" 447 | top: "fire7/expand3x3" 448 | convolution_param { 449 | num_output: 192 450 | pad: 1 451 | kernel_size: 3 452 | weight_filler { 453 | type: "xavier" 454 | } 455 | } 456 | } 457 | layer { 458 | name: "fire7/relu_expand3x3" 459 | type: "ReLU" 460 | bottom: "fire7/expand3x3" 461 | top: "fire7/expand3x3" 462 | } 463 | layer { 464 | name: "fire7/concat" 465 | type: "Concat" 466 | bottom: "fire7/expand1x1" 467 | bottom: "fire7/expand3x3" 468 | top: "fire7/concat" 469 | } 470 | layer { 471 | name: "fire8/squeeze1x1" 472 | type: "Convolution" 473 | bottom: "fire7/concat" 474 | top: "fire8/squeeze1x1" 475 | convolution_param { 476 | num_output: 64 477 | kernel_size: 1 478 | weight_filler { 479 | type: "xavier" 480 | } 481 | } 482 | } 483 | layer { 484 | name: "fire8/relu_squeeze1x1" 485 | type: "ReLU" 486 | bottom: "fire8/squeeze1x1" 487 | top: "fire8/squeeze1x1" 488 | } 489 | layer { 490 | name: "fire8/expand1x1" 491 | type: "Convolution" 492 | bottom: "fire8/squeeze1x1" 493 | top: "fire8/expand1x1" 494 | convolution_param { 495 | num_output: 256 496 | kernel_size: 1 497 | weight_filler { 498 | type: "xavier" 499 | } 500 | } 501 | } 502 | layer { 503 | name: "fire8/relu_expand1x1" 504 | type: "ReLU" 505 | bottom: "fire8/expand1x1" 506 | top: "fire8/expand1x1" 507 | } 508 | layer { 509 | name: "fire8/expand3x3" 510 | type: "Convolution" 511 | bottom: "fire8/squeeze1x1" 512 | top: "fire8/expand3x3" 513 | convolution_param { 514 | num_output: 256 515 | pad: 1 516 | kernel_size: 3 517 | weight_filler { 518 | type: "xavier" 519 | } 520 | } 521 | } 522 | layer { 523 | name: "fire8/relu_expand3x3" 524 | type: "ReLU" 525 | bottom: "fire8/expand3x3" 526 | top: "fire8/expand3x3" 527 | } 528 | layer { 529 | name: "fire8/concat" 530 | type: "Concat" 531 | bottom: "fire8/expand1x1" 532 | bottom: "fire8/expand3x3" 533 | top: "fire8/concat" 534 | } 535 | layer { 536 | name: "fire9/squeeze1x1" 537 | type: "Convolution" 538 | bottom: "fire8/concat" 539 | top: "fire9/squeeze1x1" 540 | convolution_param { 541 | num_output: 64 542 | kernel_size: 1 543 | weight_filler { 544 | type: "xavier" 545 | } 546 | } 547 | } 548 | layer { 549 | name: "fire9/relu_squeeze1x1" 550 | type: "ReLU" 551 | bottom: "fire9/squeeze1x1" 552 | top: "fire9/squeeze1x1" 553 | } 554 | layer { 555 | name: "fire9/expand1x1" 556 | type: "Convolution" 557 | bottom: "fire9/squeeze1x1" 558 | top: "fire9/expand1x1" 559 | convolution_param { 560 | num_output: 256 561 | kernel_size: 1 562 | weight_filler { 563 | type: "xavier" 564 | } 565 | } 566 | } 567 | layer { 568 | name: "fire9/relu_expand1x1" 569 | type: "ReLU" 570 | bottom: "fire9/expand1x1" 571 | top: "fire9/expand1x1" 572 | } 573 | layer { 574 | name: "fire9/expand3x3" 575 | type: "Convolution" 576 | bottom: "fire9/squeeze1x1" 577 | top: "fire9/expand3x3" 578 | convolution_param { 579 | num_output: 256 580 | pad: 1 581 | kernel_size: 3 582 | weight_filler { 583 | type: "xavier" 584 | } 585 | } 586 | } 587 | layer { 588 | name: "fire9/relu_expand3x3" 589 | type: "ReLU" 590 | bottom: "fire9/expand3x3" 591 | top: "fire9/expand3x3" 592 | } 593 | layer { 594 | name: "fire9/concat" 595 | type: "Concat" 596 | bottom: "fire9/expand1x1" 597 | bottom: "fire9/expand3x3" 598 | top: "fire9/concat" 599 | } 600 | layer { 601 | name: "drop9" 602 | type: "Dropout" 603 | bottom: "fire9/concat" 604 | top: "fire9/concat" 605 | dropout_param { 606 | dropout_ratio: 0.5 607 | } 608 | } 609 | layer { 610 | name: "conv10" 611 | type: "Convolution" 612 | bottom: "fire9/concat" 613 | top: "conv10" 614 | convolution_param { 615 | num_output: 1000 616 | kernel_size: 1 617 | weight_filler { 618 | type: "gaussian" 619 | mean: 0.0 620 | std: 0.01 621 | } 622 | } 623 | } 624 | layer { 625 | name: "relu_conv10" 626 | type: "ReLU" 627 | bottom: "conv10" 628 | top: "conv10" 629 | } 630 | layer { 631 | name: "pool10" 632 | type: "Pooling" 633 | bottom: "conv10" 634 | top: "pool10" 635 | pooling_param { 636 | pool: AVE 637 | global_pooling: true 638 | } 639 | } 640 | layer { 641 | name: "loss" 642 | type: "Softmax" 643 | bottom: "pool10" 644 | top: "loss" 645 | #include { 646 | # phase: TRAIN 647 | #} 648 | } 649 | -------------------------------------------------------------------------------- /package/kannmodel-bvlc-googlenet/deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "GoogleNet" 2 | layer { 3 | name: "data" 4 | type: "Input" 5 | top: "data" 6 | input_param { 7 | shape: { 8 | dim: 1 9 | dim: 3 10 | dim: 224 11 | dim: 224 12 | } 13 | } 14 | } 15 | layer { 16 | name: "conv1/7x7_s2" 17 | type: "Convolution" 18 | bottom: "data" 19 | top: "conv1/7x7_s2" 20 | param { 21 | lr_mult: 1 22 | decay_mult: 1 23 | } 24 | param { 25 | lr_mult: 2 26 | decay_mult: 0 27 | } 28 | convolution_param { 29 | num_output: 64 30 | pad: 3 31 | kernel_size: 7 32 | stride: 2 33 | weight_filler { 34 | type: "xavier" 35 | std: 0.1 36 | } 37 | bias_filler { 38 | type: "constant" 39 | value: 100.9 40 | } 41 | } 42 | } 43 | layer { 44 | name: "conv1/relu_7x7" 45 | type: "ReLU" 46 | bottom: "conv1/7x7_s2" 47 | top: "conv1/7x7_s2" 48 | } 49 | layer { 50 | name: "pool1/3x3_s2" 51 | type: "Pooling" 52 | bottom: "conv1/7x7_s2" 53 | top: "pool1/3x3_s2" 54 | pooling_param { 55 | pool: MAX 56 | kernel_size: 3 57 | stride: 2 58 | } 59 | } 60 | layer { 61 | name: "pool1/norm1" 62 | type: "LRN" 63 | bottom: "pool1/3x3_s2" 64 | top: "pool1/norm1" 65 | lrn_param { 66 | local_size: 5 67 | alpha: 0.0001 68 | beta: 0.75 69 | } 70 | } 71 | layer { 72 | name: "conv2/3x3_reduce" 73 | type: "Convolution" 74 | bottom: "pool1/norm1" 75 | top: "conv2/3x3_reduce" 76 | param { 77 | lr_mult: 1 78 | decay_mult: 1 79 | } 80 | param { 81 | lr_mult: 2 82 | decay_mult: 0 83 | } 84 | convolution_param { 85 | num_output: 64 86 | kernel_size: 1 87 | weight_filler { 88 | type: "xavier" 89 | std: 0.1 90 | } 91 | bias_filler { 92 | type: "constant" 93 | value: 0.2 94 | } 95 | } 96 | } 97 | layer { 98 | name: "conv2/relu_3x3_reduce" 99 | type: "ReLU" 100 | bottom: "conv2/3x3_reduce" 101 | top: "conv2/3x3_reduce" 102 | } 103 | layer { 104 | name: "conv2/3x3" 105 | type: "Convolution" 106 | bottom: "conv2/3x3_reduce" 107 | top: "conv2/3x3" 108 | param { 109 | lr_mult: 1 110 | decay_mult: 1 111 | } 112 | param { 113 | lr_mult: 2 114 | decay_mult: 0 115 | } 116 | convolution_param { 117 | num_output: 192 118 | pad: 1 119 | kernel_size: 3 120 | weight_filler { 121 | type: "xavier" 122 | std: 0.03 123 | } 124 | bias_filler { 125 | type: "constant" 126 | value: 0.2 127 | } 128 | } 129 | } 130 | layer { 131 | name: "conv2/relu_3x3" 132 | type: "ReLU" 133 | bottom: "conv2/3x3" 134 | top: "conv2/3x3" 135 | } 136 | layer { 137 | name: "conv2/norm2" 138 | type: "LRN" 139 | bottom: "conv2/3x3" 140 | top: "conv2/norm2" 141 | lrn_param { 142 | local_size: 5 143 | alpha: 0.0001 144 | beta: 0.75 145 | } 146 | } 147 | layer { 148 | name: "pool2/3x3_s2" 149 | type: "Pooling" 150 | bottom: "conv2/norm2" 151 | top: "pool2/3x3_s2" 152 | pooling_param { 153 | pool: MAX 154 | kernel_size: 3 155 | stride: 2 156 | } 157 | } 158 | layer { 159 | name: "inception_3a/1x1" 160 | type: "Convolution" 161 | bottom: "pool2/3x3_s2" 162 | top: "inception_3a/1x1" 163 | param { 164 | lr_mult: 1 165 | decay_mult: 1 166 | } 167 | param { 168 | lr_mult: 2 169 | decay_mult: 0 170 | } 171 | convolution_param { 172 | num_output: 64 173 | kernel_size: 1 174 | weight_filler { 175 | type: "xavier" 176 | std: 0.03 177 | } 178 | bias_filler { 179 | type: "constant" 180 | value: 0.2 181 | } 182 | } 183 | } 184 | layer { 185 | name: "inception_3a/relu_1x1" 186 | type: "ReLU" 187 | bottom: "inception_3a/1x1" 188 | top: "inception_3a/1x1" 189 | } 190 | layer { 191 | name: "inception_3a/3x3_reduce" 192 | type: "Convolution" 193 | bottom: "pool2/3x3_s2" 194 | top: "inception_3a/3x3_reduce" 195 | param { 196 | lr_mult: 1 197 | decay_mult: 1 198 | } 199 | param { 200 | lr_mult: 2 201 | decay_mult: 0 202 | } 203 | convolution_param { 204 | num_output: 96 205 | kernel_size: 1 206 | weight_filler { 207 | type: "xavier" 208 | std: 0.09 209 | } 210 | bias_filler { 211 | type: "constant" 212 | value: 0.2 213 | } 214 | } 215 | } 216 | layer { 217 | name: "inception_3a/relu_3x3_reduce" 218 | type: "ReLU" 219 | bottom: "inception_3a/3x3_reduce" 220 | top: "inception_3a/3x3_reduce" 221 | } 222 | layer { 223 | name: "inception_3a/3x3" 224 | type: "Convolution" 225 | bottom: "inception_3a/3x3_reduce" 226 | top: "inception_3a/3x3" 227 | param { 228 | lr_mult: 1 229 | decay_mult: 1 230 | } 231 | param { 232 | lr_mult: 2 233 | decay_mult: 0 234 | } 235 | convolution_param { 236 | num_output: 128 237 | pad: 1 238 | kernel_size: 3 239 | weight_filler { 240 | type: "xavier" 241 | std: 0.03 242 | } 243 | bias_filler { 244 | type: "constant" 245 | value: 0.2 246 | } 247 | } 248 | } 249 | layer { 250 | name: "inception_3a/relu_3x3" 251 | type: "ReLU" 252 | bottom: "inception_3a/3x3" 253 | top: "inception_3a/3x3" 254 | } 255 | layer { 256 | name: "inception_3a/5x5_reduce" 257 | type: "Convolution" 258 | bottom: "pool2/3x3_s2" 259 | top: "inception_3a/5x5_reduce" 260 | param { 261 | lr_mult: 1 262 | decay_mult: 1 263 | } 264 | param { 265 | lr_mult: 2 266 | decay_mult: 0 267 | } 268 | convolution_param { 269 | num_output: 16 270 | kernel_size: 1 271 | weight_filler { 272 | type: "xavier" 273 | std: 0.2 274 | } 275 | bias_filler { 276 | type: "constant" 277 | value: 0.2 278 | } 279 | } 280 | } 281 | layer { 282 | name: "inception_3a/relu_5x5_reduce" 283 | type: "ReLU" 284 | bottom: "inception_3a/5x5_reduce" 285 | top: "inception_3a/5x5_reduce" 286 | } 287 | layer { 288 | name: "inception_3a/5x5" 289 | type: "Convolution" 290 | bottom: "inception_3a/5x5_reduce" 291 | top: "inception_3a/5x5" 292 | param { 293 | lr_mult: 1 294 | decay_mult: 1 295 | } 296 | param { 297 | lr_mult: 2 298 | decay_mult: 0 299 | } 300 | convolution_param { 301 | num_output: 32 302 | pad: 2 303 | kernel_size: 5 304 | weight_filler { 305 | type: "xavier" 306 | std: 0.03 307 | } 308 | bias_filler { 309 | type: "constant" 310 | value: 0.2 311 | } 312 | } 313 | } 314 | layer { 315 | name: "inception_3a/relu_5x5" 316 | type: "ReLU" 317 | bottom: "inception_3a/5x5" 318 | top: "inception_3a/5x5" 319 | } 320 | layer { 321 | name: "inception_3a/pool" 322 | type: "Pooling" 323 | bottom: "pool2/3x3_s2" 324 | top: "inception_3a/pool" 325 | pooling_param { 326 | pool: MAX 327 | kernel_size: 3 328 | stride: 1 329 | pad: 1 330 | } 331 | } 332 | layer { 333 | name: "inception_3a/pool_proj" 334 | type: "Convolution" 335 | bottom: "inception_3a/pool" 336 | top: "inception_3a/pool_proj" 337 | param { 338 | lr_mult: 1 339 | decay_mult: 1 340 | } 341 | param { 342 | lr_mult: 2 343 | decay_mult: 0 344 | } 345 | convolution_param { 346 | num_output: 32 347 | kernel_size: 1 348 | weight_filler { 349 | type: "xavier" 350 | std: 0.1 351 | } 352 | bias_filler { 353 | type: "constant" 354 | value: 0.2 355 | } 356 | } 357 | } 358 | layer { 359 | name: "inception_3a/relu_pool_proj" 360 | type: "ReLU" 361 | bottom: "inception_3a/pool_proj" 362 | top: "inception_3a/pool_proj" 363 | } 364 | layer { 365 | name: "inception_3a/output" 366 | type: "Concat" 367 | bottom: "inception_3a/1x1" 368 | bottom: "inception_3a/3x3" 369 | bottom: "inception_3a/5x5" 370 | bottom: "inception_3a/pool_proj" 371 | top: "inception_3a/output" 372 | } 373 | layer { 374 | name: "inception_3b/1x1" 375 | type: "Convolution" 376 | bottom: "inception_3a/output" 377 | top: "inception_3b/1x1" 378 | param { 379 | lr_mult: 1 380 | decay_mult: 1 381 | } 382 | param { 383 | lr_mult: 2 384 | decay_mult: 0 385 | } 386 | convolution_param { 387 | num_output: 128 388 | kernel_size: 1 389 | weight_filler { 390 | type: "xavier" 391 | std: 0.03 392 | } 393 | bias_filler { 394 | type: "constant" 395 | value: 0.2 396 | } 397 | } 398 | } 399 | layer { 400 | name: "inception_3b/relu_1x1" 401 | type: "ReLU" 402 | bottom: "inception_3b/1x1" 403 | top: "inception_3b/1x1" 404 | } 405 | layer { 406 | name: "inception_3b/3x3_reduce" 407 | type: "Convolution" 408 | bottom: "inception_3a/output" 409 | top: "inception_3b/3x3_reduce" 410 | param { 411 | lr_mult: 1 412 | decay_mult: 1 413 | } 414 | param { 415 | lr_mult: 2 416 | decay_mult: 0 417 | } 418 | convolution_param { 419 | num_output: 128 420 | kernel_size: 1 421 | weight_filler { 422 | type: "xavier" 423 | std: 0.09 424 | } 425 | bias_filler { 426 | type: "constant" 427 | value: 0.2 428 | } 429 | } 430 | } 431 | layer { 432 | name: "inception_3b/relu_3x3_reduce" 433 | type: "ReLU" 434 | bottom: "inception_3b/3x3_reduce" 435 | top: "inception_3b/3x3_reduce" 436 | } 437 | layer { 438 | name: "inception_3b/3x3" 439 | type: "Convolution" 440 | bottom: "inception_3b/3x3_reduce" 441 | top: "inception_3b/3x3" 442 | param { 443 | lr_mult: 1 444 | decay_mult: 1 445 | } 446 | param { 447 | lr_mult: 2 448 | decay_mult: 0 449 | } 450 | convolution_param { 451 | num_output: 192 452 | pad: 1 453 | kernel_size: 3 454 | weight_filler { 455 | type: "xavier" 456 | std: 0.03 457 | } 458 | bias_filler { 459 | type: "constant" 460 | value: 0.2 461 | } 462 | } 463 | } 464 | layer { 465 | name: "inception_3b/relu_3x3" 466 | type: "ReLU" 467 | bottom: "inception_3b/3x3" 468 | top: "inception_3b/3x3" 469 | } 470 | layer { 471 | name: "inception_3b/5x5_reduce" 472 | type: "Convolution" 473 | bottom: "inception_3a/output" 474 | top: "inception_3b/5x5_reduce" 475 | param { 476 | lr_mult: 1 477 | decay_mult: 1 478 | } 479 | param { 480 | lr_mult: 2 481 | decay_mult: 0 482 | } 483 | convolution_param { 484 | num_output: 32 485 | kernel_size: 1 486 | weight_filler { 487 | type: "xavier" 488 | std: 0.2 489 | } 490 | bias_filler { 491 | type: "constant" 492 | value: 0.2 493 | } 494 | } 495 | } 496 | layer { 497 | name: "inception_3b/relu_5x5_reduce" 498 | type: "ReLU" 499 | bottom: "inception_3b/5x5_reduce" 500 | top: "inception_3b/5x5_reduce" 501 | } 502 | layer { 503 | name: "inception_3b/5x5" 504 | type: "Convolution" 505 | bottom: "inception_3b/5x5_reduce" 506 | top: "inception_3b/5x5" 507 | param { 508 | lr_mult: 1 509 | decay_mult: 1 510 | } 511 | param { 512 | lr_mult: 2 513 | decay_mult: 0 514 | } 515 | convolution_param { 516 | num_output: 96 517 | pad: 2 518 | kernel_size: 5 519 | weight_filler { 520 | type: "xavier" 521 | std: 0.03 522 | } 523 | bias_filler { 524 | type: "constant" 525 | value: 0.2 526 | } 527 | } 528 | } 529 | layer { 530 | name: "inception_3b/relu_5x5" 531 | type: "ReLU" 532 | bottom: "inception_3b/5x5" 533 | top: "inception_3b/5x5" 534 | } 535 | layer { 536 | name: "inception_3b/pool" 537 | type: "Pooling" 538 | bottom: "inception_3a/output" 539 | top: "inception_3b/pool" 540 | pooling_param { 541 | pool: MAX 542 | kernel_size: 3 543 | stride: 1 544 | pad: 1 545 | } 546 | } 547 | layer { 548 | name: "inception_3b/pool_proj" 549 | type: "Convolution" 550 | bottom: "inception_3b/pool" 551 | top: "inception_3b/pool_proj" 552 | param { 553 | lr_mult: 1 554 | decay_mult: 1 555 | } 556 | param { 557 | lr_mult: 2 558 | decay_mult: 0 559 | } 560 | convolution_param { 561 | num_output: 64 562 | kernel_size: 1 563 | weight_filler { 564 | type: "xavier" 565 | std: 0.1 566 | } 567 | bias_filler { 568 | type: "constant" 569 | value: 0.2 570 | } 571 | } 572 | } 573 | layer { 574 | name: "inception_3b/relu_pool_proj" 575 | type: "ReLU" 576 | bottom: "inception_3b/pool_proj" 577 | top: "inception_3b/pool_proj" 578 | } 579 | layer { 580 | name: "inception_3b/output" 581 | type: "Concat" 582 | bottom: "inception_3b/1x1" 583 | bottom: "inception_3b/3x3" 584 | bottom: "inception_3b/5x5" 585 | bottom: "inception_3b/pool_proj" 586 | top: "inception_3b/output" 587 | } 588 | 589 | 590 | layer { 591 | name: "pool3/3x3_s2" 592 | type: "Pooling" 593 | bottom: "inception_3b/output" 594 | top: "pool3/3x3_s2" 595 | pooling_param { 596 | pool: MAX 597 | kernel_size: 3 598 | stride: 2 599 | } 600 | } 601 | 602 | 603 | ##### Inception 4-a ##### 604 | layer { 605 | name: "inception_4a/1x1" 606 | type: "Convolution" 607 | bottom: "pool3/3x3_s2" 608 | top: "inception_4a/1x1" 609 | param { 610 | lr_mult: 1 611 | decay_mult: 1 612 | } 613 | param { 614 | lr_mult: 2 615 | decay_mult: 0 616 | } 617 | convolution_param { 618 | num_output: 192 619 | kernel_size: 1 620 | weight_filler { 621 | type: "xavier" 622 | std: 0.03 623 | } 624 | bias_filler { 625 | type: "constant" 626 | value: 0.2 627 | } 628 | } 629 | } 630 | layer { 631 | name: "inception_4a/relu_1x1" 632 | type: "ReLU" 633 | bottom: "inception_4a/1x1" 634 | top: "inception_4a/1x1" 635 | } 636 | layer { 637 | name: "inception_4a/3x3_reduce" 638 | type: "Convolution" 639 | bottom: "pool3/3x3_s2" 640 | top: "inception_4a/3x3_reduce" 641 | param { 642 | lr_mult: 1 643 | decay_mult: 1 644 | } 645 | param { 646 | lr_mult: 2 647 | decay_mult: 0 648 | } 649 | convolution_param { 650 | num_output: 96 651 | kernel_size: 1 652 | weight_filler { 653 | type: "xavier" 654 | std: 0.09 655 | } 656 | bias_filler { 657 | type: "constant" 658 | value: 0.2 659 | } 660 | } 661 | } 662 | layer { 663 | name: "inception_4a/relu_3x3_reduce" 664 | type: "ReLU" 665 | bottom: "inception_4a/3x3_reduce" 666 | top: "inception_4a/3x3_reduce" 667 | } 668 | layer { 669 | name: "inception_4a/3x3" 670 | type: "Convolution" 671 | bottom: "inception_4a/3x3_reduce" 672 | top: "inception_4a/3x3" 673 | param { 674 | lr_mult: 1 675 | decay_mult: 1 676 | } 677 | param { 678 | lr_mult: 2 679 | decay_mult: 0 680 | } 681 | convolution_param { 682 | num_output: 208 683 | pad: 1 684 | kernel_size: 3 685 | weight_filler { 686 | type: "xavier" 687 | std: 0.03 688 | } 689 | bias_filler { 690 | type: "constant" 691 | value: 0.2 692 | } 693 | } 694 | } 695 | layer { 696 | name: "inception_4a/relu_3x3" 697 | type: "ReLU" 698 | bottom: "inception_4a/3x3" 699 | top: "inception_4a/3x3" 700 | } 701 | layer { 702 | name: "inception_4a/5x5_reduce" 703 | type: "Convolution" 704 | bottom: "pool3/3x3_s2" 705 | top: "inception_4a/5x5_reduce" 706 | param { 707 | lr_mult: 1 708 | decay_mult: 1 709 | } 710 | param { 711 | lr_mult: 2 712 | decay_mult: 0 713 | } 714 | convolution_param { 715 | num_output: 16 716 | kernel_size: 1 717 | weight_filler { 718 | type: "xavier" 719 | std: 0.2 720 | } 721 | bias_filler { 722 | type: "constant" 723 | value: 0.2 724 | } 725 | } 726 | } 727 | layer { 728 | name: "inception_4a/relu_5x5_reduce" 729 | type: "ReLU" 730 | bottom: "inception_4a/5x5_reduce" 731 | top: "inception_4a/5x5_reduce" 732 | } 733 | layer { 734 | name: "inception_4a/5x5" 735 | type: "Convolution" 736 | bottom: "inception_4a/5x5_reduce" 737 | top: "inception_4a/5x5" 738 | param { 739 | lr_mult: 1 740 | decay_mult: 1 741 | } 742 | param { 743 | lr_mult: 2 744 | decay_mult: 0 745 | } 746 | convolution_param { 747 | num_output: 48 748 | pad: 2 749 | kernel_size: 5 750 | weight_filler { 751 | type: "xavier" 752 | std: 0.03 753 | } 754 | bias_filler { 755 | type: "constant" 756 | value: 0.2 757 | } 758 | } 759 | } 760 | layer { 761 | name: "inception_4a/relu_5x5" 762 | type: "ReLU" 763 | bottom: "inception_4a/5x5" 764 | top: "inception_4a/5x5" 765 | } 766 | layer { 767 | name: "inception_4a/pool" 768 | type: "Pooling" 769 | bottom: "pool3/3x3_s2" 770 | top: "inception_4a/pool" 771 | pooling_param { 772 | pool: MAX 773 | kernel_size: 3 774 | stride: 1 775 | pad: 1 776 | } 777 | } 778 | layer { 779 | name: "inception_4a/pool_proj" 780 | type: "Convolution" 781 | bottom: "inception_4a/pool" 782 | top: "inception_4a/pool_proj" 783 | param { 784 | lr_mult: 1 785 | decay_mult: 1 786 | } 787 | param { 788 | lr_mult: 2 789 | decay_mult: 0 790 | } 791 | convolution_param { 792 | num_output: 64 793 | kernel_size: 1 794 | weight_filler { 795 | type: "xavier" 796 | std: 0.1 797 | } 798 | bias_filler { 799 | type: "constant" 800 | value: 0.2 801 | } 802 | } 803 | } 804 | layer { 805 | name: "inception_4a/relu_pool_proj" 806 | type: "ReLU" 807 | bottom: "inception_4a/pool_proj" 808 | top: "inception_4a/pool_proj" 809 | } 810 | layer { 811 | name: "inception_4a/output" 812 | type: "Concat" 813 | bottom: "inception_4a/1x1" 814 | bottom: "inception_4a/3x3" 815 | bottom: "inception_4a/5x5" 816 | bottom: "inception_4a/pool_proj" 817 | top: "inception_4a/output" 818 | } 819 | 820 | 821 | 822 | ##### INCEPTION 4-B ##### 823 | layer { 824 | name: "inception_4b/1x1" 825 | type: "Convolution" 826 | bottom: "inception_4a/output" 827 | top: "inception_4b/1x1" 828 | param { 829 | lr_mult: 1 830 | decay_mult: 1 831 | } 832 | param { 833 | lr_mult: 2 834 | decay_mult: 0 835 | } 836 | convolution_param { 837 | num_output: 160 838 | kernel_size: 1 839 | weight_filler { 840 | type: "xavier" 841 | std: 0.03 842 | } 843 | bias_filler { 844 | type: "constant" 845 | value: 0.2 846 | } 847 | } 848 | } 849 | layer { 850 | name: "inception_4b/relu_1x1" 851 | type: "ReLU" 852 | bottom: "inception_4b/1x1" 853 | top: "inception_4b/1x1" 854 | } 855 | layer { 856 | name: "inception_4b/3x3_reduce" 857 | type: "Convolution" 858 | bottom: "inception_4a/output" 859 | top: "inception_4b/3x3_reduce" 860 | param { 861 | lr_mult: 1 862 | decay_mult: 1 863 | } 864 | param { 865 | lr_mult: 2 866 | decay_mult: 0 867 | } 868 | convolution_param { 869 | num_output: 112 870 | kernel_size: 1 871 | weight_filler { 872 | type: "xavier" 873 | std: 0.09 874 | } 875 | bias_filler { 876 | type: "constant" 877 | value: 0.2 878 | } 879 | } 880 | } 881 | layer { 882 | name: "inception_4b/relu_3x3_reduce" 883 | type: "ReLU" 884 | bottom: "inception_4b/3x3_reduce" 885 | top: "inception_4b/3x3_reduce" 886 | } 887 | layer { 888 | name: "inception_4b/3x3" 889 | type: "Convolution" 890 | bottom: "inception_4b/3x3_reduce" 891 | top: "inception_4b/3x3" 892 | param { 893 | lr_mult: 1 894 | decay_mult: 1 895 | } 896 | param { 897 | lr_mult: 2 898 | decay_mult: 0 899 | } 900 | convolution_param { 901 | num_output: 224 902 | pad: 1 903 | kernel_size: 3 904 | weight_filler { 905 | type: "xavier" 906 | std: 0.03 907 | } 908 | bias_filler { 909 | type: "constant" 910 | value: 0.2 911 | } 912 | } 913 | } 914 | layer { 915 | name: "inception_4b/relu_3x3" 916 | type: "ReLU" 917 | bottom: "inception_4b/3x3" 918 | top: "inception_4b/3x3" 919 | } 920 | layer { 921 | name: "inception_4b/5x5_reduce" 922 | type: "Convolution" 923 | bottom: "inception_4a/output" 924 | top: "inception_4b/5x5_reduce" 925 | param { 926 | lr_mult: 1 927 | decay_mult: 1 928 | } 929 | param { 930 | lr_mult: 2 931 | decay_mult: 0 932 | } 933 | convolution_param { 934 | num_output: 24 935 | kernel_size: 1 936 | weight_filler { 937 | type: "xavier" 938 | std: 0.2 939 | } 940 | bias_filler { 941 | type: "constant" 942 | value: 0.2 943 | } 944 | } 945 | } 946 | layer { 947 | name: "inception_4b/relu_5x5_reduce" 948 | type: "ReLU" 949 | bottom: "inception_4b/5x5_reduce" 950 | top: "inception_4b/5x5_reduce" 951 | } 952 | layer { 953 | name: "inception_4b/5x5" 954 | type: "Convolution" 955 | bottom: "inception_4b/5x5_reduce" 956 | top: "inception_4b/5x5" 957 | param { 958 | lr_mult: 1 959 | decay_mult: 1 960 | } 961 | param { 962 | lr_mult: 2 963 | decay_mult: 0 964 | } 965 | convolution_param { 966 | num_output: 64 967 | pad: 2 968 | kernel_size: 5 969 | weight_filler { 970 | type: "xavier" 971 | std: 0.03 972 | } 973 | bias_filler { 974 | type: "constant" 975 | value: 0.2 976 | } 977 | } 978 | } 979 | layer { 980 | name: "inception_4b/relu_5x5" 981 | type: "ReLU" 982 | bottom: "inception_4b/5x5" 983 | top: "inception_4b/5x5" 984 | } 985 | layer { 986 | name: "inception_4b/pool" 987 | type: "Pooling" 988 | bottom: "inception_4a/output" 989 | top: "inception_4b/pool" 990 | pooling_param { 991 | pool: MAX 992 | kernel_size: 3 993 | stride: 1 994 | pad: 1 995 | } 996 | } 997 | layer { 998 | name: "inception_4b/pool_proj" 999 | type: "Convolution" 1000 | bottom: "inception_4b/pool" 1001 | top: "inception_4b/pool_proj" 1002 | param { 1003 | lr_mult: 1 1004 | decay_mult: 1 1005 | } 1006 | param { 1007 | lr_mult: 2 1008 | decay_mult: 0 1009 | } 1010 | convolution_param { 1011 | num_output: 64 1012 | kernel_size: 1 1013 | weight_filler { 1014 | type: "xavier" 1015 | std: 0.1 1016 | } 1017 | bias_filler { 1018 | type: "constant" 1019 | value: 0.2 1020 | } 1021 | } 1022 | } 1023 | layer { 1024 | name: "inception_4b/relu_pool_proj" 1025 | type: "ReLU" 1026 | bottom: "inception_4b/pool_proj" 1027 | top: "inception_4b/pool_proj" 1028 | } 1029 | layer { 1030 | name: "inception_4b/output" 1031 | type: "Concat" 1032 | bottom: "inception_4b/1x1" 1033 | bottom: "inception_4b/3x3" 1034 | bottom: "inception_4b/5x5" 1035 | bottom: "inception_4b/pool_proj" 1036 | top: "inception_4b/output" 1037 | } 1038 | 1039 | 1040 | ##### INCEPTION 4-C ##### 1041 | layer { 1042 | name: "inception_4c/1x1" 1043 | type: "Convolution" 1044 | bottom: "inception_4b/output" 1045 | top: "inception_4c/1x1" 1046 | param { 1047 | lr_mult: 1 1048 | decay_mult: 1 1049 | } 1050 | param { 1051 | lr_mult: 2 1052 | decay_mult: 0 1053 | } 1054 | convolution_param { 1055 | num_output: 128 1056 | kernel_size: 1 1057 | weight_filler { 1058 | type: "xavier" 1059 | std: 0.03 1060 | } 1061 | bias_filler { 1062 | type: "constant" 1063 | value: 0.2 1064 | } 1065 | } 1066 | } 1067 | layer { 1068 | name: "inception_4c/relu_1x1" 1069 | type: "ReLU" 1070 | bottom: "inception_4c/1x1" 1071 | top: "inception_4c/1x1" 1072 | } 1073 | layer { 1074 | name: "inception_4c/3x3_reduce" 1075 | type: "Convolution" 1076 | bottom: "inception_4b/output" 1077 | top: "inception_4c/3x3_reduce" 1078 | param { 1079 | lr_mult: 1 1080 | decay_mult: 1 1081 | } 1082 | param { 1083 | lr_mult: 2 1084 | decay_mult: 0 1085 | } 1086 | convolution_param { 1087 | num_output: 128 1088 | kernel_size: 1 1089 | weight_filler { 1090 | type: "xavier" 1091 | std: 0.09 1092 | } 1093 | bias_filler { 1094 | type: "constant" 1095 | value: 0.2 1096 | } 1097 | } 1098 | } 1099 | layer { 1100 | name: "inception_4c/relu_3x3_reduce" 1101 | type: "ReLU" 1102 | bottom: "inception_4c/3x3_reduce" 1103 | top: "inception_4c/3x3_reduce" 1104 | } 1105 | layer { 1106 | name: "inception_4c/3x3" 1107 | type: "Convolution" 1108 | bottom: "inception_4c/3x3_reduce" 1109 | top: "inception_4c/3x3" 1110 | param { 1111 | lr_mult: 1 1112 | decay_mult: 1 1113 | } 1114 | param { 1115 | lr_mult: 2 1116 | decay_mult: 0 1117 | } 1118 | convolution_param { 1119 | num_output: 256 1120 | pad: 1 1121 | kernel_size: 3 1122 | weight_filler { 1123 | type: "xavier" 1124 | std: 0.03 1125 | } 1126 | bias_filler { 1127 | type: "constant" 1128 | value: 0.2 1129 | } 1130 | } 1131 | } 1132 | layer { 1133 | name: "inception_4c/relu_3x3" 1134 | type: "ReLU" 1135 | bottom: "inception_4c/3x3" 1136 | top: "inception_4c/3x3" 1137 | } 1138 | layer { 1139 | name: "inception_4c/5x5_reduce" 1140 | type: "Convolution" 1141 | bottom: "inception_4b/output" 1142 | top: "inception_4c/5x5_reduce" 1143 | param { 1144 | lr_mult: 1 1145 | decay_mult: 1 1146 | } 1147 | param { 1148 | lr_mult: 2 1149 | decay_mult: 0 1150 | } 1151 | convolution_param { 1152 | num_output: 24 1153 | kernel_size: 1 1154 | weight_filler { 1155 | type: "xavier" 1156 | std: 0.2 1157 | } 1158 | bias_filler { 1159 | type: "constant" 1160 | value: 0.2 1161 | } 1162 | } 1163 | } 1164 | layer { 1165 | name: "inception_4c/relu_5x5_reduce" 1166 | type: "ReLU" 1167 | bottom: "inception_4c/5x5_reduce" 1168 | top: "inception_4c/5x5_reduce" 1169 | } 1170 | layer { 1171 | name: "inception_4c/5x5" 1172 | type: "Convolution" 1173 | bottom: "inception_4c/5x5_reduce" 1174 | top: "inception_4c/5x5" 1175 | param { 1176 | lr_mult: 1 1177 | decay_mult: 1 1178 | } 1179 | param { 1180 | lr_mult: 2 1181 | decay_mult: 0 1182 | } 1183 | convolution_param { 1184 | num_output: 64 1185 | pad: 2 1186 | kernel_size: 5 1187 | weight_filler { 1188 | type: "xavier" 1189 | std: 0.03 1190 | } 1191 | bias_filler { 1192 | type: "constant" 1193 | value: 0.2 1194 | } 1195 | } 1196 | } 1197 | layer { 1198 | name: "inception_4c/relu_5x5" 1199 | type: "ReLU" 1200 | bottom: "inception_4c/5x5" 1201 | top: "inception_4c/5x5" 1202 | } 1203 | layer { 1204 | name: "inception_4c/pool" 1205 | type: "Pooling" 1206 | bottom: "inception_4b/output" 1207 | top: "inception_4c/pool" 1208 | pooling_param { 1209 | pool: MAX 1210 | kernel_size: 3 1211 | stride: 1 1212 | pad: 1 1213 | } 1214 | } 1215 | layer { 1216 | name: "inception_4c/pool_proj" 1217 | type: "Convolution" 1218 | bottom: "inception_4c/pool" 1219 | top: "inception_4c/pool_proj" 1220 | param { 1221 | lr_mult: 1 1222 | decay_mult: 1 1223 | } 1224 | param { 1225 | lr_mult: 2 1226 | decay_mult: 0 1227 | } 1228 | convolution_param { 1229 | num_output: 64 1230 | kernel_size: 1 1231 | weight_filler { 1232 | type: "xavier" 1233 | std: 0.1 1234 | } 1235 | bias_filler { 1236 | type: "constant" 1237 | value: 0.2 1238 | } 1239 | } 1240 | } 1241 | layer { 1242 | name: "inception_4c/relu_pool_proj" 1243 | type: "ReLU" 1244 | bottom: "inception_4c/pool_proj" 1245 | top: "inception_4c/pool_proj" 1246 | } 1247 | layer { 1248 | name: "inception_4c/output" 1249 | type: "Concat" 1250 | bottom: "inception_4c/1x1" 1251 | bottom: "inception_4c/3x3" 1252 | bottom: "inception_4c/5x5" 1253 | bottom: "inception_4c/pool_proj" 1254 | top: "inception_4c/output" 1255 | } 1256 | 1257 | 1258 | 1259 | ##### Inception 4-D ##### 1260 | layer { 1261 | name: "inception_4d/1x1" 1262 | type: "Convolution" 1263 | bottom: "inception_4c/output" 1264 | top: "inception_4d/1x1" 1265 | param { 1266 | lr_mult: 1 1267 | decay_mult: 1 1268 | } 1269 | param { 1270 | lr_mult: 2 1271 | decay_mult: 0 1272 | } 1273 | convolution_param { 1274 | num_output: 112 1275 | kernel_size: 1 1276 | weight_filler { 1277 | type: "xavier" 1278 | std: 0.03 1279 | } 1280 | bias_filler { 1281 | type: "constant" 1282 | value: 0.2 1283 | } 1284 | } 1285 | } 1286 | layer { 1287 | name: "inception_4d/relu_1x1" 1288 | type: "ReLU" 1289 | bottom: "inception_4d/1x1" 1290 | top: "inception_4d/1x1" 1291 | } 1292 | layer { 1293 | name: "inception_4d/3x3_reduce" 1294 | type: "Convolution" 1295 | bottom: "inception_4c/output" 1296 | top: "inception_4d/3x3_reduce" 1297 | param { 1298 | lr_mult: 1 1299 | decay_mult: 1 1300 | } 1301 | param { 1302 | lr_mult: 2 1303 | decay_mult: 0 1304 | } 1305 | convolution_param { 1306 | num_output: 144 1307 | kernel_size: 1 1308 | weight_filler { 1309 | type: "xavier" 1310 | std: 0.09 1311 | } 1312 | bias_filler { 1313 | type: "constant" 1314 | value: 0.2 1315 | } 1316 | } 1317 | } 1318 | layer { 1319 | name: "inception_4d/relu_3x3_reduce" 1320 | type: "ReLU" 1321 | bottom: "inception_4d/3x3_reduce" 1322 | top: "inception_4d/3x3_reduce" 1323 | } 1324 | layer { 1325 | name: "inception_4d/3x3" 1326 | type: "Convolution" 1327 | bottom: "inception_4d/3x3_reduce" 1328 | top: "inception_4d/3x3" 1329 | param { 1330 | lr_mult: 1 1331 | decay_mult: 1 1332 | } 1333 | param { 1334 | lr_mult: 2 1335 | decay_mult: 0 1336 | } 1337 | convolution_param { 1338 | num_output: 288 1339 | pad: 1 1340 | kernel_size: 3 1341 | weight_filler { 1342 | type: "xavier" 1343 | std: 0.03 1344 | } 1345 | bias_filler { 1346 | type: "constant" 1347 | value: 0.2 1348 | } 1349 | } 1350 | } 1351 | layer { 1352 | name: "inception_4d/relu_3x3" 1353 | type: "ReLU" 1354 | bottom: "inception_4d/3x3" 1355 | top: "inception_4d/3x3" 1356 | } 1357 | layer { 1358 | name: "inception_4d/5x5_reduce" 1359 | type: "Convolution" 1360 | bottom: "inception_4c/output" 1361 | top: "inception_4d/5x5_reduce" 1362 | param { 1363 | lr_mult: 1 1364 | decay_mult: 1 1365 | } 1366 | param { 1367 | lr_mult: 2 1368 | decay_mult: 0 1369 | } 1370 | convolution_param { 1371 | num_output: 32 1372 | kernel_size: 1 1373 | weight_filler { 1374 | type: "xavier" 1375 | std: 0.2 1376 | } 1377 | bias_filler { 1378 | type: "constant" 1379 | value: 0.2 1380 | } 1381 | } 1382 | } 1383 | layer { 1384 | name: "inception_4d/relu_5x5_reduce" 1385 | type: "ReLU" 1386 | bottom: "inception_4d/5x5_reduce" 1387 | top: "inception_4d/5x5_reduce" 1388 | } 1389 | layer { 1390 | name: "inception_4d/5x5" 1391 | type: "Convolution" 1392 | bottom: "inception_4d/5x5_reduce" 1393 | top: "inception_4d/5x5" 1394 | param { 1395 | lr_mult: 1 1396 | decay_mult: 1 1397 | } 1398 | param { 1399 | lr_mult: 2 1400 | decay_mult: 0 1401 | } 1402 | convolution_param { 1403 | num_output: 64 1404 | pad: 2 1405 | kernel_size: 5 1406 | weight_filler { 1407 | type: "xavier" 1408 | std: 0.03 1409 | } 1410 | bias_filler { 1411 | type: "constant" 1412 | value: 0.2 1413 | } 1414 | } 1415 | } 1416 | layer { 1417 | name: "inception_4d/relu_5x5" 1418 | type: "ReLU" 1419 | bottom: "inception_4d/5x5" 1420 | top: "inception_4d/5x5" 1421 | } 1422 | layer { 1423 | name: "inception_4d/pool" 1424 | type: "Pooling" 1425 | bottom: "inception_4c/output" 1426 | top: "inception_4d/pool" 1427 | pooling_param { 1428 | pool: MAX 1429 | kernel_size: 3 1430 | stride: 1 1431 | pad: 1 1432 | } 1433 | } 1434 | layer { 1435 | name: "inception_4d/pool_proj" 1436 | type: "Convolution" 1437 | bottom: "inception_4d/pool" 1438 | top: "inception_4d/pool_proj" 1439 | param { 1440 | lr_mult: 1 1441 | decay_mult: 1 1442 | } 1443 | param { 1444 | lr_mult: 2 1445 | decay_mult: 0 1446 | } 1447 | convolution_param { 1448 | num_output: 64 1449 | kernel_size: 1 1450 | weight_filler { 1451 | type: "xavier" 1452 | std: 0.1 1453 | } 1454 | bias_filler { 1455 | type: "constant" 1456 | value: 0.2 1457 | } 1458 | } 1459 | } 1460 | layer { 1461 | name: "inception_4d/relu_pool_proj" 1462 | type: "ReLU" 1463 | bottom: "inception_4d/pool_proj" 1464 | top: "inception_4d/pool_proj" 1465 | } 1466 | layer { 1467 | name: "inception_4d/output" 1468 | type: "Concat" 1469 | bottom: "inception_4d/1x1" 1470 | bottom: "inception_4d/3x3" 1471 | bottom: "inception_4d/5x5" 1472 | bottom: "inception_4d/pool_proj" 1473 | top: "inception_4d/output" 1474 | } 1475 | 1476 | 1477 | 1478 | ##### Inception 4-E ##### 1479 | layer { 1480 | name: "inception_4e/1x1" 1481 | type: "Convolution" 1482 | bottom: "inception_4d/output" 1483 | top: "inception_4e/1x1" 1484 | param { 1485 | lr_mult: 1 1486 | decay_mult: 1 1487 | } 1488 | param { 1489 | lr_mult: 2 1490 | decay_mult: 0 1491 | } 1492 | convolution_param { 1493 | num_output: 256 1494 | kernel_size: 1 1495 | weight_filler { 1496 | type: "xavier" 1497 | std: 0.03 1498 | } 1499 | bias_filler { 1500 | type: "constant" 1501 | value: 0.2 1502 | } 1503 | } 1504 | } 1505 | layer { 1506 | name: "inception_4e/relu_1x1" 1507 | type: "ReLU" 1508 | bottom: "inception_4e/1x1" 1509 | top: "inception_4e/1x1" 1510 | } 1511 | layer { 1512 | name: "inception_4e/3x3_reduce" 1513 | type: "Convolution" 1514 | bottom: "inception_4d/output" 1515 | top: "inception_4e/3x3_reduce" 1516 | param { 1517 | lr_mult: 1 1518 | decay_mult: 1 1519 | } 1520 | param { 1521 | lr_mult: 2 1522 | decay_mult: 0 1523 | } 1524 | convolution_param { 1525 | num_output: 160 1526 | kernel_size: 1 1527 | weight_filler { 1528 | type: "xavier" 1529 | std: 0.09 1530 | } 1531 | bias_filler { 1532 | type: "constant" 1533 | value: 0.2 1534 | } 1535 | } 1536 | } 1537 | layer { 1538 | name: "inception_4e/relu_3x3_reduce" 1539 | type: "ReLU" 1540 | bottom: "inception_4e/3x3_reduce" 1541 | top: "inception_4e/3x3_reduce" 1542 | } 1543 | layer { 1544 | name: "inception_4e/3x3" 1545 | type: "Convolution" 1546 | bottom: "inception_4e/3x3_reduce" 1547 | top: "inception_4e/3x3" 1548 | param { 1549 | lr_mult: 1 1550 | decay_mult: 1 1551 | } 1552 | param { 1553 | lr_mult: 2 1554 | decay_mult: 0 1555 | } 1556 | convolution_param { 1557 | num_output: 320 1558 | pad: 1 1559 | kernel_size: 3 1560 | weight_filler { 1561 | type: "xavier" 1562 | std: 0.03 1563 | } 1564 | bias_filler { 1565 | type: "constant" 1566 | value: 0.2 1567 | } 1568 | } 1569 | } 1570 | layer { 1571 | name: "inception_4e/relu_3x3" 1572 | type: "ReLU" 1573 | bottom: "inception_4e/3x3" 1574 | top: "inception_4e/3x3" 1575 | } 1576 | layer { 1577 | name: "inception_4e/5x5_reduce" 1578 | type: "Convolution" 1579 | bottom: "inception_4d/output" 1580 | top: "inception_4e/5x5_reduce" 1581 | param { 1582 | lr_mult: 1 1583 | decay_mult: 1 1584 | } 1585 | param { 1586 | lr_mult: 2 1587 | decay_mult: 0 1588 | } 1589 | convolution_param { 1590 | num_output: 32 1591 | kernel_size: 1 1592 | weight_filler { 1593 | type: "xavier" 1594 | std: 0.2 1595 | } 1596 | bias_filler { 1597 | type: "constant" 1598 | value: 0.2 1599 | } 1600 | } 1601 | } 1602 | layer { 1603 | name: "inception_4e/relu_5x5_reduce" 1604 | type: "ReLU" 1605 | bottom: "inception_4e/5x5_reduce" 1606 | top: "inception_4e/5x5_reduce" 1607 | } 1608 | layer { 1609 | name: "inception_4e/5x5" 1610 | type: "Convolution" 1611 | bottom: "inception_4e/5x5_reduce" 1612 | top: "inception_4e/5x5" 1613 | param { 1614 | lr_mult: 1 1615 | decay_mult: 1 1616 | } 1617 | param { 1618 | lr_mult: 2 1619 | decay_mult: 0 1620 | } 1621 | convolution_param { 1622 | num_output: 128 1623 | pad: 2 1624 | kernel_size: 5 1625 | weight_filler { 1626 | type: "xavier" 1627 | std: 0.03 1628 | } 1629 | bias_filler { 1630 | type: "constant" 1631 | value: 0.2 1632 | } 1633 | } 1634 | } 1635 | layer { 1636 | name: "inception_4e/relu_5x5" 1637 | type: "ReLU" 1638 | bottom: "inception_4e/5x5" 1639 | top: "inception_4e/5x5" 1640 | } 1641 | layer { 1642 | name: "inception_4e/pool" 1643 | type: "Pooling" 1644 | bottom: "inception_4d/output" 1645 | top: "inception_4e/pool" 1646 | pooling_param { 1647 | pool: MAX 1648 | kernel_size: 3 1649 | stride: 1 1650 | pad: 1 1651 | } 1652 | } 1653 | layer { 1654 | name: "inception_4e/pool_proj" 1655 | type: "Convolution" 1656 | bottom: "inception_4e/pool" 1657 | top: "inception_4e/pool_proj" 1658 | param { 1659 | lr_mult: 1 1660 | decay_mult: 1 1661 | } 1662 | param { 1663 | lr_mult: 2 1664 | decay_mult: 0 1665 | } 1666 | convolution_param { 1667 | num_output: 128 1668 | kernel_size: 1 1669 | weight_filler { 1670 | type: "xavier" 1671 | std: 0.1 1672 | } 1673 | bias_filler { 1674 | type: "constant" 1675 | value: 0.2 1676 | } 1677 | } 1678 | } 1679 | layer { 1680 | name: "inception_4e/relu_pool_proj" 1681 | type: "ReLU" 1682 | bottom: "inception_4e/pool_proj" 1683 | top: "inception_4e/pool_proj" 1684 | } 1685 | layer { 1686 | name: "inception_4e/output" 1687 | type: "Concat" 1688 | bottom: "inception_4e/1x1" 1689 | bottom: "inception_4e/3x3" 1690 | bottom: "inception_4e/5x5" 1691 | bottom: "inception_4e/pool_proj" 1692 | top: "inception_4e/output" 1693 | } 1694 | 1695 | 1696 | 1697 | layer { 1698 | name: "pool4/3x3_s2" 1699 | type: "Pooling" 1700 | bottom: "inception_4e/output" 1701 | top: "pool4/3x3_s2" 1702 | pooling_param { 1703 | pool: MAX 1704 | kernel_size: 3 1705 | stride: 2 1706 | } 1707 | } 1708 | 1709 | 1710 | 1711 | ##### Inception 5-A ##### 1712 | layer { 1713 | name: "inception_5a/1x1" 1714 | type: "Convolution" 1715 | bottom: "pool4/3x3_s2" 1716 | top: "inception_5a/1x1" 1717 | param { 1718 | lr_mult: 1 1719 | decay_mult: 1 1720 | } 1721 | param { 1722 | lr_mult: 2 1723 | decay_mult: 0 1724 | } 1725 | convolution_param { 1726 | num_output: 256 1727 | kernel_size: 1 1728 | weight_filler { 1729 | type: "xavier" 1730 | std: 0.03 1731 | } 1732 | bias_filler { 1733 | type: "constant" 1734 | value: 0.2 1735 | } 1736 | } 1737 | } 1738 | layer { 1739 | name: "inception_5a/relu_1x1" 1740 | type: "ReLU" 1741 | bottom: "inception_5a/1x1" 1742 | top: "inception_5a/1x1" 1743 | } 1744 | layer { 1745 | name: "inception_5a/3x3_reduce" 1746 | type: "Convolution" 1747 | bottom: "pool4/3x3_s2" 1748 | top: "inception_5a/3x3_reduce" 1749 | param { 1750 | lr_mult: 1 1751 | decay_mult: 1 1752 | } 1753 | param { 1754 | lr_mult: 2 1755 | decay_mult: 0 1756 | } 1757 | convolution_param { 1758 | num_output: 160 1759 | kernel_size: 1 1760 | weight_filler { 1761 | type: "xavier" 1762 | std: 0.09 1763 | } 1764 | bias_filler { 1765 | type: "constant" 1766 | value: 0.2 1767 | } 1768 | } 1769 | } 1770 | layer { 1771 | name: "inception_5a/relu_3x3_reduce" 1772 | type: "ReLU" 1773 | bottom: "inception_5a/3x3_reduce" 1774 | top: "inception_5a/3x3_reduce" 1775 | } 1776 | layer { 1777 | name: "inception_5a/3x3" 1778 | type: "Convolution" 1779 | bottom: "inception_5a/3x3_reduce" 1780 | top: "inception_5a/3x3" 1781 | param { 1782 | lr_mult: 1 1783 | decay_mult: 1 1784 | } 1785 | param { 1786 | lr_mult: 2 1787 | decay_mult: 0 1788 | } 1789 | convolution_param { 1790 | num_output: 320 1791 | pad: 1 1792 | kernel_size: 3 1793 | weight_filler { 1794 | type: "xavier" 1795 | std: 0.03 1796 | } 1797 | bias_filler { 1798 | type: "constant" 1799 | value: 0.2 1800 | } 1801 | } 1802 | } 1803 | layer { 1804 | name: "inception_5a/relu_3x3" 1805 | type: "ReLU" 1806 | bottom: "inception_5a/3x3" 1807 | top: "inception_5a/3x3" 1808 | } 1809 | layer { 1810 | name: "inception_5a/5x5_reduce" 1811 | type: "Convolution" 1812 | bottom: "pool4/3x3_s2" 1813 | top: "inception_5a/5x5_reduce" 1814 | param { 1815 | lr_mult: 1 1816 | decay_mult: 1 1817 | } 1818 | param { 1819 | lr_mult: 2 1820 | decay_mult: 0 1821 | } 1822 | convolution_param { 1823 | num_output: 32 1824 | kernel_size: 1 1825 | weight_filler { 1826 | type: "xavier" 1827 | std: 0.2 1828 | } 1829 | bias_filler { 1830 | type: "constant" 1831 | value: 0.2 1832 | } 1833 | } 1834 | } 1835 | layer { 1836 | name: "inception_5a/relu_5x5_reduce" 1837 | type: "ReLU" 1838 | bottom: "inception_5a/5x5_reduce" 1839 | top: "inception_5a/5x5_reduce" 1840 | } 1841 | layer { 1842 | name: "inception_5a/5x5" 1843 | type: "Convolution" 1844 | bottom: "inception_5a/5x5_reduce" 1845 | top: "inception_5a/5x5" 1846 | param { 1847 | lr_mult: 1 1848 | decay_mult: 1 1849 | } 1850 | param { 1851 | lr_mult: 2 1852 | decay_mult: 0 1853 | } 1854 | convolution_param { 1855 | num_output: 128 1856 | pad: 2 1857 | kernel_size: 5 1858 | weight_filler { 1859 | type: "xavier" 1860 | std: 0.03 1861 | } 1862 | bias_filler { 1863 | type: "constant" 1864 | value: 0.2 1865 | } 1866 | } 1867 | } 1868 | layer { 1869 | name: "inception_5a/relu_5x5" 1870 | type: "ReLU" 1871 | bottom: "inception_5a/5x5" 1872 | top: "inception_5a/5x5" 1873 | } 1874 | layer { 1875 | name: "inception_5a/pool" 1876 | type: "Pooling" 1877 | bottom: "pool4/3x3_s2" 1878 | top: "inception_5a/pool" 1879 | pooling_param { 1880 | pool: MAX 1881 | kernel_size: 3 1882 | stride: 1 1883 | pad: 1 1884 | } 1885 | } 1886 | layer { 1887 | name: "inception_5a/pool_proj" 1888 | type: "Convolution" 1889 | bottom: "inception_5a/pool" 1890 | top: "inception_5a/pool_proj" 1891 | param { 1892 | lr_mult: 1 1893 | decay_mult: 1 1894 | } 1895 | param { 1896 | lr_mult: 2 1897 | decay_mult: 0 1898 | } 1899 | convolution_param { 1900 | num_output: 128 1901 | kernel_size: 1 1902 | weight_filler { 1903 | type: "xavier" 1904 | std: 0.1 1905 | } 1906 | bias_filler { 1907 | type: "constant" 1908 | value: 0.2 1909 | } 1910 | } 1911 | } 1912 | layer { 1913 | name: "inception_5a/relu_pool_proj" 1914 | type: "ReLU" 1915 | bottom: "inception_5a/pool_proj" 1916 | top: "inception_5a/pool_proj" 1917 | } 1918 | layer { 1919 | name: "inception_5a/output" 1920 | type: "Concat" 1921 | bottom: "inception_5a/1x1" 1922 | bottom: "inception_5a/3x3" 1923 | bottom: "inception_5a/5x5" 1924 | bottom: "inception_5a/pool_proj" 1925 | top: "inception_5a/output" 1926 | } 1927 | 1928 | 1929 | 1930 | ##### Inception 5-B ##### 1931 | layer { 1932 | name: "inception_5b/1x1" 1933 | type: "Convolution" 1934 | bottom: "inception_5a/output" 1935 | top: "inception_5b/1x1" 1936 | param { 1937 | lr_mult: 1 1938 | decay_mult: 1 1939 | } 1940 | param { 1941 | lr_mult: 2 1942 | decay_mult: 0 1943 | } 1944 | convolution_param { 1945 | num_output: 384 1946 | kernel_size: 1 1947 | weight_filler { 1948 | type: "xavier" 1949 | std: 0.03 1950 | } 1951 | bias_filler { 1952 | type: "constant" 1953 | value: 0.2 1954 | } 1955 | } 1956 | } 1957 | layer { 1958 | name: "inception_5b/relu_1x1" 1959 | type: "ReLU" 1960 | bottom: "inception_5b/1x1" 1961 | top: "inception_5b/1x1" 1962 | } 1963 | layer { 1964 | name: "inception_5b/3x3_reduce" 1965 | type: "Convolution" 1966 | bottom: "inception_5a/output" 1967 | top: "inception_5b/3x3_reduce" 1968 | param { 1969 | lr_mult: 1 1970 | decay_mult: 1 1971 | } 1972 | param { 1973 | lr_mult: 2 1974 | decay_mult: 0 1975 | } 1976 | convolution_param { 1977 | num_output: 192 1978 | kernel_size: 1 1979 | weight_filler { 1980 | type: "xavier" 1981 | std: 0.09 1982 | } 1983 | bias_filler { 1984 | type: "constant" 1985 | value: 0.2 1986 | } 1987 | } 1988 | } 1989 | layer { 1990 | name: "inception_5b/relu_3x3_reduce" 1991 | type: "ReLU" 1992 | bottom: "inception_5b/3x3_reduce" 1993 | top: "inception_5b/3x3_reduce" 1994 | } 1995 | layer { 1996 | name: "inception_5b/3x3" 1997 | type: "Convolution" 1998 | bottom: "inception_5b/3x3_reduce" 1999 | top: "inception_5b/3x3" 2000 | param { 2001 | lr_mult: 1 2002 | decay_mult: 1 2003 | } 2004 | param { 2005 | lr_mult: 2 2006 | decay_mult: 0 2007 | } 2008 | convolution_param { 2009 | num_output: 384 2010 | pad: 1 2011 | kernel_size: 3 2012 | weight_filler { 2013 | type: "xavier" 2014 | std: 0.03 2015 | } 2016 | bias_filler { 2017 | type: "constant" 2018 | value: 0.2 2019 | } 2020 | } 2021 | } 2022 | layer { 2023 | name: "inception_5b/relu_3x3" 2024 | type: "ReLU" 2025 | bottom: "inception_5b/3x3" 2026 | top: "inception_5b/3x3" 2027 | } 2028 | layer { 2029 | name: "inception_5b/5x5_reduce" 2030 | type: "Convolution" 2031 | bottom: "inception_5a/output" 2032 | top: "inception_5b/5x5_reduce" 2033 | param { 2034 | lr_mult: 1 2035 | decay_mult: 1 2036 | } 2037 | param { 2038 | lr_mult: 2 2039 | decay_mult: 0 2040 | } 2041 | convolution_param { 2042 | num_output: 48 2043 | kernel_size: 1 2044 | weight_filler { 2045 | type: "xavier" 2046 | std: 0.2 2047 | } 2048 | bias_filler { 2049 | type: "constant" 2050 | value: 0.2 2051 | } 2052 | } 2053 | } 2054 | layer { 2055 | name: "inception_5b/relu_5x5_reduce" 2056 | type: "ReLU" 2057 | bottom: "inception_5b/5x5_reduce" 2058 | top: "inception_5b/5x5_reduce" 2059 | } 2060 | layer { 2061 | name: "inception_5b/5x5" 2062 | type: "Convolution" 2063 | bottom: "inception_5b/5x5_reduce" 2064 | top: "inception_5b/5x5" 2065 | param { 2066 | lr_mult: 1 2067 | decay_mult: 1 2068 | } 2069 | param { 2070 | lr_mult: 2 2071 | decay_mult: 0 2072 | } 2073 | convolution_param { 2074 | num_output: 128 2075 | pad: 2 2076 | kernel_size: 5 2077 | weight_filler { 2078 | type: "xavier" 2079 | std: 0.03 2080 | } 2081 | bias_filler { 2082 | type: "constant" 2083 | value: 0.2 2084 | } 2085 | } 2086 | } 2087 | layer { 2088 | name: "inception_5b/relu_5x5" 2089 | type: "ReLU" 2090 | bottom: "inception_5b/5x5" 2091 | top: "inception_5b/5x5" 2092 | } 2093 | layer { 2094 | name: "inception_5b/pool" 2095 | type: "Pooling" 2096 | bottom: "inception_5a/output" 2097 | top: "inception_5b/pool" 2098 | pooling_param { 2099 | pool: MAX 2100 | kernel_size: 3 2101 | stride: 1 2102 | pad: 1 2103 | } 2104 | } 2105 | layer { 2106 | name: "inception_5b/pool_proj" 2107 | type: "Convolution" 2108 | bottom: "inception_5b/pool" 2109 | top: "inception_5b/pool_proj" 2110 | param { 2111 | lr_mult: 1 2112 | decay_mult: 1 2113 | } 2114 | param { 2115 | lr_mult: 2 2116 | decay_mult: 0 2117 | } 2118 | convolution_param { 2119 | num_output: 128 2120 | kernel_size: 1 2121 | weight_filler { 2122 | type: "xavier" 2123 | std: 0.1 2124 | } 2125 | bias_filler { 2126 | type: "constant" 2127 | value: 0.2 2128 | } 2129 | } 2130 | } 2131 | layer { 2132 | name: "inception_5b/relu_pool_proj" 2133 | type: "ReLU" 2134 | bottom: "inception_5b/pool_proj" 2135 | top: "inception_5b/pool_proj" 2136 | } 2137 | layer { 2138 | name: "inception_5b/output" 2139 | type: "Concat" 2140 | bottom: "inception_5b/1x1" 2141 | bottom: "inception_5b/3x3" 2142 | bottom: "inception_5b/5x5" 2143 | bottom: "inception_5b/pool_proj" 2144 | top: "inception_5b/output" 2145 | } 2146 | 2147 | 2148 | 2149 | layer { 2150 | name: "pool5/7x7_s1" 2151 | type: "Pooling" 2152 | bottom: "inception_5b/output" 2153 | top: "pool5/7x7_s1" 2154 | pooling_param { 2155 | pool: AVE 2156 | kernel_size: 7 2157 | stride: 1 2158 | } 2159 | } 2160 | layer { 2161 | name: "pool5/drop_7x7_s1" 2162 | type: "Dropout" 2163 | bottom: "pool5/7x7_s1" 2164 | top: "pool5/7x7_s1" 2165 | dropout_param { 2166 | dropout_ratio: 0.4 2167 | } 2168 | } 2169 | layer { 2170 | name: "loss3/classifier" 2171 | type: "InnerProduct" 2172 | bottom: "pool5/7x7_s1" 2173 | top: "loss3/classifier" 2174 | param { 2175 | lr_mult: 1 2176 | decay_mult: 1 2177 | } 2178 | param { 2179 | lr_mult: 2 2180 | decay_mult: 0 2181 | } 2182 | inner_product_param { 2183 | num_output: 1000 2184 | weight_filler { 2185 | type: "xavier" 2186 | } 2187 | bias_filler { 2188 | type: "constant" 2189 | value: 0 2190 | } 2191 | } 2192 | } 2193 | 2194 | layer { 2195 | name: "prob" 2196 | type: "Softmax" 2197 | bottom: "loss3/classifier" 2198 | top: "prob" 2199 | } 2200 | 2201 | --------------------------------------------------------------------------------