Skip to content

Instantly share code, notes, and snippets.

@astojilj
Last active November 30, 2018 07:57
Show Gist options
  • Select an option

  • Save astojilj/02c3bd114a35cb88e29501f894cfbaab to your computer and use it in GitHub Desktop.

Select an option

Save astojilj/02c3bd114a35cb88e29501f894cfbaab to your computer and use it in GitHub Desktop.
diff --git a/integration_tests/benchmarks/benchmark.html b/integration_tests/benchmarks/benchmark.html
index 31ecd4e..4a1e977 100644
--- a/integration_tests/benchmarks/benchmark.html
+++ b/integration_tests/benchmarks/benchmark.html
@@ -112,32 +112,42 @@
<tbody></tbody>
</table>
</div>
+ <script src="../../../tfjs-core/dist/tf-core.js"> </script>
+ <script src="../../../tfjs-converter/dist/tf-converter.js"> </script>
+ <script src="../../../tfjs-layers/dist/tf-layers.js"> </script>
+<!--
<script src="https://unpkg.com/@tensorflow/tfjs-core/dist/tf-core.js"></script>
<script src="https://unpkg.com/@tensorflow/tfjs-layers/dist/tf-layers.js"></script>
<script src="https://unpkg.com/@tensorflow/tfjs-converter/dist/tf-converter.js"></script>
+-->
<script>
'use strict';
+ // tf.ENV.set('WEBGL_PACK_BATCHNORMALIZATION', true);
+ tf.ENV.set('WEBGL_LAZILY_UNPACK', true);
+
async function load() {
//////////////////////////////////
// Place model loading code here.
//////////////////////////////////
- return await tf.loadFrozenModel(
- 'https://storage.googleapis.com/tfjs-models/savedmodel/mobilenet_v2_1.0_224/tensorflowjs_model.pb',
- 'https://storage.googleapis.com/tfjs-models/savedmodel/mobilenet_v2_1.0_224/weights_manifest.json');
+ const MODEL_URL = '../../../segmentation/deeplabv3_mnv2_pascal_train_aug_web_model/argmax/tensorflowjs_model.pb';
+ const WEIGHTS_URL = '../../../segmentation/deeplabv3_mnv2_pascal_train_aug_web_model/argmax/weights_manifest.json';
+ // Model's input and output have width and height of 513.
+ return await tf.loadFrozenModel(MODEL_URL, WEIGHTS_URL);
}
- const zeros = tf.zeros([1, 224, 224, 3]);
+ const zeros = tf.zeros([1, 513, 513, 3]);
function predict(model) {
//////////////////////////////////
// Place model prediction code here.
//////////////////////////////////
- return model.predict(zeros);
+ // return model.predict(zeros);
+ return model.execute({'ImageTensor': zeros});
}
</script>
<script>
'use strict';
const state = {
- numRuns: 20,
+ numRuns: 100,
};
const modalDiv = document.getElementById('modal-msg');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment