Browse Source

Icon converter script

Lutz Roeder 7 years ago
parent
commit
7c4932220a

BIN
setup/icon.icns


BIN
setup/icon.ico


+ 80 - 38
setup/icon.svg

@@ -1,71 +1,113 @@
 <svg xmlns='http://www.w3.org/2000/svg' width='1024' height='1024' viewBox='0 0 1024 1024'>
 
-  <filter id='blur'>
-    <feGaussianBlur in='SourceGraphic' stdDeviation='10' />
-  </filter>
+    <filter id='dropshadow'>
+        <feGaussianBlur in='SourceAlpha' stdDeviation='20' />
+    </filter>
 
-    <linearGradient id='border' gradientUnits='userSpaceOnUse' x1='0' y1='0' x2='0' y2='1024'>
+    <filter id='shadow'>
+        <feGaussianBlur in='SourceGraphic' stdDeviation='5' />
+    </filter>
+
+    <linearGradient id='border' gradientUnits='userSpaceOnUse' x1='0' y1='62' x2='0' y2='962'>
         <stop offset='0' stop-color='#fefefe'/>
         <stop offset='1' stop-color='#cacaca'/>
     </linearGradient>
 
-    <linearGradient id='background' gradientUnits='userSpaceOnUse' x1='0' y1='0' x2='0' y2='1024'>
-        <stop offset='0' stop-color='#B5EAF7'/>
-        <stop offset='1' stop-color='#A2D2DE'/>
+    <radialGradient id="node" cx="0.5" cy="0.5">
+      <stop offset="0%" stop-color="#578691"/>
+      <stop offset="90%" stop-color="#55838D"/>
+      <stop offset="100%" stop-color="#44777a"/>
+    </radialGradient>
+
+    <linearGradient id='background' gradientUnits='userSpaceOnUse' x1='0' y1='100' x2='0' y2='814'>
+        <stop offset='0' stop-color='#A2D2DE'/>
+        <stop offset='1' stop-color='#b4e4f2'/>
     </linearGradient>
 
-    <circle cx='512' cy='512' r='450' fill='#aaaaaa' style='filter: url(#blur);' /> 
-    <circle cx='512' cy='512' r='450' stroke='#b1b1b1' style='filter: url(#dropshadow);' /> 
-    <circle cx='512' cy='512' r='450' fill='url(#border)'/> 
-    <circle cx='512' cy='512' r='412' fill='url(#background)'/> 
+    <circle cx='512' cy='522' r='438' style='filter: url(#dropshadow);' /> 
+    <circle cx='512' cy='512' r='456' fill='url(#border)'/> 
+    <circle cx='512' cy='512' r='417' fill='url(#background)'/> 
+
+    <line x1='296' y1='392' x2='540' y2='280' stroke-width='12' stroke='#000000' opacity='0.3' />
+    <line x1='296' y1='632' x2='540' y2='280' stroke-width='12' stroke='#000000' opacity='0.3' />
+
+    <line x1='296' y1='392' x2='540' y2='435' stroke-width='12' stroke='#000000' opacity='0.3' />
+    <line x1='296' y1='632' x2='540' y2='435' stroke-width='12' stroke='#000000' opacity='0.3' />
+
+    <line x1='296' y1='392' x2='540' y2='590' stroke-width='12' stroke='#000000' opacity='0.3' />
+    <line x1='296' y1='632' x2='540' y2='590' stroke-width='12' stroke='#000000' opacity='0.3' />
+
+    <line x1='296' y1='392' x2='540' y2='744' stroke-width='12' stroke='#000000' opacity='0.3' />
+    <line x1='296' y1='632' x2='540' y2='744' stroke-width='12' stroke='#000000' opacity='0.3' />
+
+    <line x1='540' y1='280' x2='785' y2='512' stroke-width='12' stroke='#000000' opacity='0.3' />
+    <line x1='540' y1='435' x2='785' y2='512' stroke-width='12' stroke='#000000' opacity='0.3' />
+    <line x1='540' y1='590' x2='785' y2='512' stroke-width='12' stroke='#000000' opacity='0.3' />
+    <line x1='540' y1='744' x2='785' y2='512' stroke-width='12' stroke='#000000' opacity='0.3' />
 
-    <line x1='296' y1='392' x2='540' y2='280' stroke-width='12' stroke='#55838D' />
-    <line x1='296' y1='632' x2='540' y2='280' stroke-width='12' stroke='#55838D' />
+    <line x1='296' y1='392' x2='540' y2='280' stroke-width='10' stroke='#55838D' opacity='1' />
+    <line x1='296' y1='632' x2='540' y2='280' stroke-width='10' stroke='#55838D' opacity='1' />
 
-    <line x1='296' y1='392' x2='540' y2='435' stroke-width='12' stroke='#55838D' />
-    <line x1='296' y1='632' x2='540' y2='435' stroke-width='12' stroke='#55838D' />
+    <line x1='296' y1='392' x2='540' y2='435' stroke-width='10' stroke='#55838D' opacity='1' />
+    <line x1='296' y1='632' x2='540' y2='435' stroke-width='10' stroke='#55838D' opacity='1' />
 
-    <line x1='296' y1='392' x2='540' y2='590' stroke-width='12' stroke='#55838D' />
-    <line x1='296' y1='632' x2='540' y2='590' stroke-width='12' stroke='#55838D' />
+    <line x1='296' y1='392' x2='540' y2='590' stroke-width='10' stroke='#55838D' opacity='1' />
+    <line x1='296' y1='632' x2='540' y2='590' stroke-width='10' stroke='#55838D' opacity='1' />
 
-    <line x1='296' y1='392' x2='540' y2='744' stroke-width='12' stroke='#55838D' />
-    <line x1='296' y1='632' x2='540' y2='744' stroke-width='12' stroke='#55838D' />
+    <line x1='296' y1='392' x2='540' y2='744' stroke-width='10' stroke='#55838D' opacity='1' />
+    <line x1='296' y1='632' x2='540' y2='744' stroke-width='10' stroke='#55838D' opacity='1' />
 
-    <line x1='540' y1='280' x2='785' y2='512' stroke-width='12' stroke='#55838D' />
-    <line x1='540' y1='435' x2='785' y2='512' stroke-width='12' stroke='#55838D' />
-    <line x1='540' y1='590' x2='785' y2='512' stroke-width='12' stroke='#55838D' />
-    <line x1='540' y1='744' x2='785' y2='512' stroke-width='12' stroke='#55838D' />
+    <line x1='540' y1='280' x2='785' y2='512' stroke-width='10' stroke='#55838D' opacity='1' />
+    <line x1='540' y1='435' x2='785' y2='512' stroke-width='10' stroke='#55838D' opacity='1' />
+    <line x1='540' y1='590' x2='785' y2='512' stroke-width='10' stroke='#55838D' opacity='1' />
+    <line x1='540' y1='744' x2='785' y2='512' stroke-width='10' stroke='#55838D' opacity='1' />
+
+    <line x1='296' y1='392' x2='540' y2='280' stroke-width='8' stroke='#55838D' opacity='1' />
+    <line x1='296' y1='632' x2='540' y2='280' stroke-width='8' stroke='#55838D' opacity='1' />
+
+    <line x1='296' y1='392' x2='540' y2='435' stroke-width='8' stroke='#55838D' opacity='1' />
+    <line x1='296' y1='632' x2='540' y2='435' stroke-width='8' stroke='#55838D' opacity='1' />
+
+    <line x1='296' y1='392' x2='540' y2='590' stroke-width='8' stroke='#55838D' opacity='1' />
+    <line x1='296' y1='632' x2='540' y2='590' stroke-width='8' stroke='#55838D' opacity='1' />
+
+    <line x1='296' y1='392' x2='540' y2='744' stroke-width='8' stroke='#55838D' opacity='1' />
+    <line x1='296' y1='632' x2='540' y2='744' stroke-width='8' stroke='#55838D' opacity='1' />
+
+    <line x1='540' y1='280' x2='785' y2='512' stroke-width='8' stroke='#55838D' opacity='1' />
+    <line x1='540' y1='435' x2='785' y2='512' stroke-width='8' stroke='#55838D' opacity='1' />
+    <line x1='540' y1='590' x2='785' y2='512' stroke-width='8' stroke='#55838D' opacity='1' />
+    <line x1='540' y1='744' x2='785' y2='512' stroke-width='8' stroke='#55838D' opacity='1' />
 
     <g transform='translate(296, 392)'>
-        <!-- <circle cx='-2' cy='-8' r='51' fill='#CAEEF7' /> -->
-        <circle cx='0' cy='0' r='51' fill='#55838D' />
+        <circle cx='0' cy='0' r='62' fill='#A2D2DE' opacity='0.8' />
+        <circle cx='0' cy='0' r='50' fill='url(#node)' opacity='1' />
     </g>
     <g transform='translate(296, 632)'>
-        <!-- <circle cx='-2' cy='-8' r='51' fill='#CAEEF7' /> -->
-        <circle cx='0' cy='0' r='51' fill='#55838D' />
+        <circle cx='0' cy='0' r='62' fill='#A2D2DE' opacity='0.8' />
+        <circle cx='0' cy='0' r='50' fill='url(#node)' opacity='1' />
     </g>
 
     <g transform='translate(540, 280)'>
-        <!-- <circle cx='-2' cy='-8' r='51' fill='#CAEEF7' /> -->
-        <circle cx='0' cy='0' r='51' fill='#55838D' />
+        <circle cx='0' cy='0' r='62' fill='#A2D2DE' opacity='0.8' />
+        <circle cx='0' cy='0' r='50' fill='url(#node)' opacity='1' />
     </g>
     <g transform='translate(540, 435)'>
-        <!-- <circle cx='-2' cy='-8' r='51' fill='#CAEEF7' /> -->
-        <circle cx='0' cy='0' r='51' fill='#55838D' />
+        <circle cx='0' cy='0' r='62' fill='#A2D2DE' opacity='0.8' />
+        <circle cx='0' cy='0' r='50' fill='url(#node)' opacity='1' />
     </g>
     <g transform='translate(540, 590)'>
-        <!-- <circle cx='-2' cy='-8' r='51' fill='#CAEEF7' /> -->
-        <circle cx='0' cy='0' r='51' fill='#55838D' />
+        <circle cx='0' cy='0' r='62' fill='#A2D2DE' opacity='0.8' />
+        <circle cx='0' cy='0' r='50' fill='url(#node)' opacity='1' />
     </g>
     <g transform='translate(540, 744)'>
-        <!-- <circle cx='-2' cy='-8' r='51' fill='#CAEEF7' /> -->
-        <circle cx='0' cy='0' r='51' fill='#55838D' />
+        <circle cx='0' cy='0' r='62' fill='#A2D2DE' opacity='0.8' />
+        <circle cx='0' cy='0' r='50' fill='url(#node)' opacity='1' />
     </g>
 
     <g transform='translate(785, 512)'>
-        <!-- <circle cx='-2' cy='-8' r='51' fill='#CAEEF7' /> -->
-        <circle cx='0' cy='0' r='51' fill='#55838D' />
+        <circle cx='0' cy='0' r='62' fill='#A2D2DE' opacity='0.8' />
+        <circle cx='0' cy='0' r='50' fill='url(#node)' opacity='1' />
     </g>
 
-
 </svg>

BIN
src/icon.png


+ 10 - 7
tools/coreml-converter → tools/converter/coreml-converter

@@ -2,7 +2,7 @@
 
 set -e
 
-root=$(cd $(dirname ${0})/..; pwd)
+root=$(cd $(dirname ${0})/../..; pwd)
 build=${root}/build
 tools=${root}/tools
 third_party=${root}/third_party
@@ -23,11 +23,14 @@ else
     git -C "${third_party}" clone --recursive ${repository}
 fi
 
-export PYTHONUSERBASE=${build}/third_party/pypi/${identifier}
-export PATH=$PATH:${PYTHONUSERBASE}/bin
-rm -rf ${PYTHONUSERBASE}
-${pip} install --quiet --user onnx
-${pip} install --quiet --user sklearn
-${pip} install --quiet --user ${third_party}/${identifier}
+virtualenv=${build}/virtualenv/${identifier}
+virtualenv -p ${python} ${virtualenv}
+source ${virtualenv}/bin/activate
+
+${pip} install --quiet onnx
+${pip} install --quiet sklearn
+${pip} install --quiet ${third_party}/${identifier}
 
 ${python} ${tools}/coreml-converter.py $@
+
+deactivate

+ 0 - 0
tools/coreml-converter.py → tools/converter/coreml-converter.py


+ 11 - 8
tools/onnx-converter → tools/converter/onnx-converter

@@ -2,7 +2,7 @@
 
 set -e
 
-root=$(cd $(dirname ${0})/..; pwd)
+root=$(cd $(dirname ${0})/../..; pwd)
 build=${root}/build
 tools=${root}/tools
 third_party=${root}/third_party
@@ -20,12 +20,15 @@ else
     git -C "${third_party}" clone --recursive ${repository}
 fi
 
-export PYTHONUSERBASE=${build}/third_party/pypi/${identifier}
-export PATH=$PATH:${PYTHONUSERBASE}/bin
-rm -rf ${PYTHONUSERBASE}
-pip install --quiet --user coremltools
-pip install --quiet --user tensorflow
-pip install --quiet --user keras
-pip install --quiet --user ${third_party}/${identifier}
+virtualenv=${build}/virtualenv/${identifier}
+virtualenv -p ${python} ${virtualenv}
+source ${virtualenv}/bin/activate
+
+pip install --quiet coremltools
+pip install --quiet tensorflow
+pip install --quiet keras
+pip install --quiet ${third_party}/${identifier}
 
 python ${tools}/onnx-converter.py $@
+
+deactivate

+ 0 - 0
tools/onnx-converter.py → tools/converter/onnx-converter.py


+ 19 - 0
tools/icon/index.html

@@ -0,0 +1,19 @@
+<html>
+
+<body>
+
+<div style='margin: 20px; background: #f6f6f6; border-radius: 8px; width: 340px; height: 340px; float: left; '> 
+<img src='../../setup/icon.svg' width='300' style='position: relative; top: 20px; left: 20px;'>
+</div>
+
+<div style='margin: 20px; background: #d8d8d8; border-radius: 8px; width: 340px; height: 340px; float: left; '> 
+<img src='../../setup/icon.svg' width='300' style='position: relative; top: 20px; left: 20px;'>
+</div>
+
+<div style='margin: 20px; background: #aaaaaa; border-radius: 8px; width: 340px; height: 340px; float: left; '> 
+<img src='../../setup/icon.svg' width='300' style='position: relative; top: 20px; left: 20px;'>
+</div>
+
+</body>
+
+</html>

+ 20 - 0
tools/icon/update

@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -e
+
+root=$(cd $(dirname ${0})/../..; pwd)
+build=${root}/build
+setup=${root}/setup
+src=${root}/src
+tools=${root}/tools
+
+icon=${build}/icon-update
+
+mkdir -p ${icon}
+pushd ${icon} > /dev/null
+npm install --silent --no-save icon-convert
+npx icon-convert --types ico,icns,png512 --out ${setup} ${setup}/icon.svg
+mv ${setup}/icon_512x512.png ${src}/icon.png
+popd > /dev/null
+
+rm -rf ${icon}

+ 3 - 3
tools/caffe-update → tools/metadata/caffe-update

@@ -2,7 +2,7 @@
 
 set -e
 
-root=$(cd $(dirname ${0})/..; pwd)
+root=$(cd $(dirname ${0})/../..; pwd)
 node_modules=${root}/node_modules
 src=${root}/src
 tools=${root}/tools
@@ -21,6 +21,6 @@ else
     git -C "${third_party}" clone --recursive ${repository}
 fi
 
-echo "Generate '../src/caffe.js'"
+echo "Generate 'caffe.js'"
 ${node_modules}/protobufjs/bin/pbjs -t static-module -w closure -r caffe -o ${src}/caffe.js ${third_party}/${identifier}/src/caffe/proto/caffe.proto
-node ${tools}/update_pbjs.js array ${src}/caffe.js data float 1
+node ${tools}/metadata/update_pbjs.js array ${src}/caffe.js data float 1

+ 1 - 1
tools/caffe2-metadata.py → tools/metadata/caffe2-metadata.py

@@ -11,7 +11,7 @@ import re
 import sys
 import caffe2.python.core
 
-json_file = '../src/caffe2-metadata.json'
+json_file = '../../src/caffe2-metadata.json'
 json_data = open(json_file).read()
 json_root = json.loads(json_data)
 

+ 3 - 3
tools/coreml-update → tools/metadata/coreml-update

@@ -2,7 +2,7 @@
 
 set -e
 
-root=$(cd $(dirname ${0})/..; pwd)
+root=$(cd $(dirname ${0})/../..; pwd)
 node_modules=${root}/node_modules
 src=${root}/src
 tools=${root}/tools
@@ -21,6 +21,6 @@ else
     git -C "${third_party}" clone --recursive ${repository}
 fi
 
-echo "Generate '../src/coreml.js'"
+echo "Generate 'coreml.js'"
 ${node_modules}/protobufjs/bin/pbjs -t static-module -w closure -r coreml -o ${src}/coreml.js ${third_party}/${identifier}/mlmodel/format/Model.proto
-node ${tools}/update_pbjs.js array ${src}/coreml.js floatValue float 2
+node ${tools}/metadata/update_pbjs.js array ${src}/coreml.js floatValue float 2

+ 1 - 1
tools/keras-metadata.py → tools/metadata/keras-metadata.py

@@ -210,7 +210,7 @@ def update_output(schema, description):
     if entry:
         entry['description'] = description
 
-json_file = '../src/keras-metadata.json'
+json_file = '../../src/keras-metadata.json'
 json_data = open(json_file).read()
 json_root = json.loads(json_data)
 

+ 4 - 4
tools/keras-update → tools/metadata/keras-update

@@ -2,7 +2,7 @@
 
 set -e
 
-root=$(cd $(dirname ${0})/..; pwd)
+root=$(cd $(dirname ${0})/../..; pwd)
 build=${root}/build
 tools=${root}/tools
 third_party=${root}/third_party
@@ -27,11 +27,11 @@ echo "Install Keras"
 virtualenv=${build}/virtualenv/${identifier}
 virtualenv -p ${python} ${virtualenv}
 source ${virtualenv}/bin/activate
-${pip} install tensorflow
+${pip} install --quiet tensorflow
 ${pip} install ${third_party}/${identifier}
 
-echo "Update '../src/keras-metadata.json'"
-pushd ${tools} > /dev/null
+echo "Update 'keras-metadata.json'"
+pushd ${tools}/metadata > /dev/null
 ${python} keras-metadata.py
 popd > /dev/null
 

+ 1 - 1
tools/mxnet-metadata.py → tools/metadata/mxnet-metadata.py

@@ -9,7 +9,7 @@ import pydoc
 import re
 import sys
 
-json_file = '../src/mxnet-metadata.json'
+json_file = '../../src/mxnet-metadata.json'
 json_data = open(json_file).read()
 json_root = json.loads(json_data)
 

+ 2 - 2
tools/mxnet-update → tools/metadata/mxnet-update

@@ -2,7 +2,7 @@
 
 set -e
 
-root=$(cd $(dirname ${0})/..; pwd)
+root=$(cd $(dirname ${0})/../..; pwd)
 src=${root}/src
 tools=${root}/tools
 third_party=${root}/third_party
@@ -23,5 +23,5 @@ else
     git -C "${third_party}" clone --recursive ${repository} ${identifier}
 fi
 
-# echo "Update '../src/mxnet-metadata.json'"
+# echo "Update 'mxnet-metadata.json'"
 # ${python} mxnet-metadata.py

+ 1 - 1
tools/onnx-metadata.py → tools/metadata/onnx-metadata.py

@@ -194,4 +194,4 @@ def generate_json(schemas, json_file):
 if __name__ == '__main__':
     schemas = defs.get_all_schemas_with_history()
     schemas = sorted(schemas, key=lambda schema: schema.name)
-    generate_json(schemas, '../src/onnx-metadata.json')
+    generate_json(schemas, '../../src/onnx-metadata.json')

+ 6 - 6
tools/onnx-update → tools/metadata/onnx-update

@@ -2,7 +2,7 @@
 
 set -e
 
-root=$(cd $(dirname ${0})/..; pwd)
+root=$(cd $(dirname ${0})/../..; pwd)
 build=${root}/build
 node_modules=${root}/node_modules
 src=${root}/src
@@ -34,14 +34,14 @@ export ONNX_ML=1
 export ONNX_NAMESPACE=onnx
 ${pip} install ${third_party}/${identifier}
 
-echo "Generate '../src/onnx-metadata.json'"
-pushd ${tools} > /dev/null
+echo "Generate 'onnx-metadata.json'"
+pushd ${tools}/metadata > /dev/null
 ${python} onnx-metadata.py
 popd > /dev/null
 
 deactivate
 
-echo "Generate '../src/onnx.js'"
+echo "Generate 'onnx.js'"
 ${node_modules}/protobufjs/bin/pbjs -t static-module -w closure -r onnx -o ${src}/onnx.js ${third_party}/${identifier}/onnx/onnx-ml.proto ${third_party}/${identifier}/onnx/onnx-operators-ml.proto
-node ${tools}/update_pbjs.js array ${src}/onnx.js floatData float 1
-node ${tools}/update_pbjs.js array ${src}/onnx.js doubleData double 1
+node ${tools}/metadata/update_pbjs.js array ${src}/onnx.js floatData float 1
+node ${tools}/metadata/update_pbjs.js array ${src}/onnx.js doubleData double 1

+ 1 - 1
tools/pytorch-metadata.py → tools/metadata/pytorch-metadata.py

@@ -10,7 +10,7 @@ import os
 import re
 import sys
 
-json_file = '../src/pytorch-metadata.json'
+json_file = '../../src/pytorch-metadata.json'
 json_data = open(json_file).read()
 json_root = json.loads(json_data)
 

+ 6 - 6
tools/pytorch-update → tools/metadata/pytorch-update

@@ -2,7 +2,7 @@
 
 set -e
 
-root=$(cd $(dirname ${0})/..; pwd)
+root=$(cd $(dirname ${0})/../..; pwd)
 build=${root}/build
 node_modules=${root}/node_modules
 src=${root}/src
@@ -39,19 +39,19 @@ fi
 virtualenv=${build}/virtualenv/${identifier}
 virtualenv -p ${python} ${virtualenv}
 source ${virtualenv}/bin/activate
-${pip} install future leveldb numpy protobuf pydot python-gflags pyyaml scikit-image setuptools six hypothesis typing
+${pip} install --quiet future leveldb numpy protobuf pydot python-gflags pyyaml scikit-image setuptools six hypothesis typing
 pushd "${third_party}/pytorch" > /dev/null
 FULL_CAFFE2=1 ${python} setup.py install
 MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ ${python} setup.py install
 popd > /dev/null
 
-echo "Generate '../src/caffe2-metadata.json'"
-pushd ${tools} > /dev/null
+echo "Generate 'caffe2-metadata.json'"
+pushd ${tools}/metadata > /dev/null
 ${python} caffe2-metadata.py
 popd > /dev/null
 
 deactivate
 
-echo "Generate '../src/caffe2.js'"
+echo "Generate 'caffe2.js'"
 ${node_modules}/protobufjs/bin/pbjs -t static-module -w closure -r caffe2 -o ${src}/caffe2.js ${third_party}/pytorch/caffe2/proto/caffe2.proto
-node ${tools}/update_pbjs.js enumeration ${src}/caffe2.js floats float 1
+node ${tools}/metadata/update_pbjs.js enumeration ${src}/caffe2.js floats float 1

+ 3 - 3
tools/tf-metadata.py → tools/metadata/tf-metadata.py

@@ -172,9 +172,9 @@ def convert_attr_value(attr_value):
         return convert_shape(attr_value.shape)
     raise Exception()
 
-api_def_map = read_api_def_map('../third_party/tensorflow/tensorflow/core/api_def/base_api')
+api_def_map = read_api_def_map('../../third_party/tensorflow/tensorflow/core/api_def/base_api')
 
-input_file = '../third_party/tensorflow/tensorflow/core/ops/ops.pbtxt';
+input_file = '../../third_party/tensorflow/tensorflow/core/ops/ops.pbtxt';
 
 ops_list = op_def_pb2.OpList()
 with open(input_file) as input_handle:
@@ -268,7 +268,7 @@ for op in ops_list.op:
         'schema': json_schema 
     })
 
-json_file = '../src/tf-metadata.json'
+json_file = '../../src/tf-metadata.json'
 with io.open(json_file, 'w', newline='') as fout:
     json_data = json.dumps(json_root, sort_keys=True, indent=2)
     for line in json_data.splitlines():

+ 16 - 16
tools/tf-update → tools/metadata/tf-update

@@ -2,7 +2,7 @@
 
 set -e
 
-root=$(cd $(dirname ${0})/..; pwd)
+root=$(cd $(dirname ${0})/../..; pwd)
 build=${root}/build
 node_modules=${root}/node_modules
 src=${root}/src
@@ -25,7 +25,7 @@ else
     git -C "${third_party}" clone --recursive ${repository}
 fi
 
-echo "Generate '../src/tf.js'"
+echo "Generate 'tf.js'"
 ${node_modules}/protobufjs/bin/pbjs -t static-module -w closure -r tf -o ${src}/tf.js \
     ${third_party}/${identifier}/tensorflow/core/protobuf/saved_model.proto \
     ${third_party}/${identifier}/tensorflow/core/protobuf/meta_graph.proto \
@@ -45,22 +45,22 @@ echo "Install protobuf"
 virtualenv=${build}/virtualenv/${identifier}
 virtualenv -p ${python} ${virtualenv}
 source ${virtualenv}/bin/activate
-${pip} install protobuf
+${pip} install --quiet protobuf
 
-echo "Generate '../src/tf-metadata.json'"
-protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/attr_value.proto --python_out=${tools}
-protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/tensor.proto --python_out=${tools}
-protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/types.proto --python_out=${tools}
-protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/tensor_shape.proto --python_out=${tools}
-protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/resource_handle.proto --python_out=${tools}
-protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/api_def.proto --python_out=${tools}
-protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/op_def.proto --python_out=${tools}
-touch ${tools}/tensorflow/__init__.py
-touch ${tools}/tensorflow/core/__init__.py
-touch ${tools}/tensorflow/core/framework/__init__.py
-pushd ${tools} > /dev/null
+echo "Generate 'tf-metadata.json'"
+protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/attr_value.proto --python_out=${tools}/metadata
+protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/tensor.proto --python_out=${tools}/metadata
+protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/types.proto --python_out=${tools}/metadata
+protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/tensor_shape.proto --python_out=${tools}/metadata
+protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/resource_handle.proto --python_out=${tools}/metadata
+protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/api_def.proto --python_out=${tools}/metadata
+protoc --proto_path ${third_party}/${identifier} tensorflow/core/framework/op_def.proto --python_out=${tools}/metadata
+touch ${tools}/metadata/tensorflow/__init__.py
+touch ${tools}/metadata/tensorflow/core/__init__.py
+touch ${tools}/metadata/tensorflow/core/framework/__init__.py
+pushd ${tools}/metadata > /dev/null
 ${python} tf-metadata.py
 popd > /dev/null
-rm -rf ${tools}/tensorflow
+rm -rf ${tools}/metadata/tensorflow
 
 deactivate

+ 1 - 1
tools/tflite-update → tools/metadata/tflite-update

@@ -2,7 +2,7 @@
 
 set -e
 
-root=$(cd $(dirname ${0})/..; pwd)
+root=$(cd $(dirname ${0})/../..; pwd)
 src=${root}/src
 tools=${root}/tools
 third_party=${root}/third_party

+ 35 - 0
tools/metadata/update

@@ -0,0 +1,35 @@
+#!/bin/bash
+
+set -e
+
+if [ $(which python3) ] && [ $(which pip3) ]; then
+    export python=python3
+    export pip=pip3
+fi
+
+root=$(cd $(dirname ${0})/../..; pwd)
+tools=${root}/tools
+
+echo "Update TensorFlow"
+${tools}/metadata/tf-update
+
+echo "Update Keras"
+${tools}/metadata/keras-update
+
+echo "Update CoreML"
+${tools}/metadata/coreml-update
+
+echo "Update Caffe"
+${tools}/metadata/caffe-update
+
+echo "Update MXNet"
+${tools}/metadata/mxnet-update
+
+echo "Update ONNX"
+${tools}/metadata/onnx-update
+
+echo "Update TensorFlow Lite"
+${tools}/metadata/tflite-update
+
+echo "Update PyTorch"
+${tools}/metadata/pytorch-update

+ 0 - 0
tools/update_pbjs.js → tools/metadata/update_pbjs.js


+ 0 - 20
tools/update

@@ -1,20 +0,0 @@
-#!/bin/bash
-
-set -e
-
-if [ $(which python3) ] && [ $(which pip3) ]; then
-    export python=python3
-    export pip=pip3
-fi
-
-root=$(cd $(dirname ${0})/..; pwd)
-tools=${root}/tools
-
-${tools}/tf-update
-${tools}/keras-update
-${tools}/coreml-update
-${tools}/caffe-update
-${tools}/mxnet-update
-${tools}/onnx-update
-${tools}/tflite-update
-${tools}/pytorch-update