diff --git a/models/dmonitoring_model.onnx b/models/dmonitoring_model.onnx new file mode 100644 index 00000000000000..34bdfafd812704 --- /dev/null +++ b/models/dmonitoring_model.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23112c8936b08f8215c844b37e2bb3f0eb00180c566cb4f4886a33afa15a13be +size 716609 diff --git a/models/trt/.gitattributes b/models/trt/.gitattributes deleted file mode 100644 index e6b1b01bd7edbe..00000000000000 --- a/models/trt/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -*.trt filter=lfs diff=lfs merge=lfs -text -supercombo.uff filter=lfs diff=lfs merge=lfs -text diff --git a/models/trt/dmonitoring.metadata b/models/trt/dmonitoring.metadata deleted file mode 100644 index 1f688bd3eb935e..00000000000000 --- a/models/trt/dmonitoring.metadata +++ /dev/null @@ -1 +0,0 @@ -{"input_names": ["input_img"], "output_names": ["face_descs/BiasAdd", "face_prob/Sigmoid", "left_blink_prob/Sigmoid", "left_eye_descs/BiasAdd", "left_eye_prob/Sigmoid", "right_blink_prob/Sigmoid", "right_eye_descs/BiasAdd", "right_eye_prob/Sigmoid"]} \ No newline at end of file diff --git a/models/trt/dmonitoring.trt b/models/trt/dmonitoring.trt deleted file mode 100644 index 6ce8f20b021e16..00000000000000 --- a/models/trt/dmonitoring.trt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:268008cbf8b13dc8fcb4bb4fdbd388ded5419b5a8c0f721aeb558a10896f2be1 -size 716746 diff --git a/models/trt/supercombo.metadata b/models/trt/supercombo.metadata deleted file mode 100644 index d1422edeeef20f..00000000000000 --- a/models/trt/supercombo.metadata +++ /dev/null @@ -1 +0,0 @@ -{"input_names": ["input_1_1"], "output_names": ["concatenate/concat"]} \ No newline at end of file diff --git a/models/trt/supercombo.trt b/models/trt/supercombo.trt deleted file mode 100644 index 7e10ce90cde326..00000000000000 --- a/models/trt/supercombo.trt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2c3b67d5628dbe78d08809e20766c5f7502edf1c36527e3153bfc94ed9accdb8 -size 78663389 diff --git a/models/trt/supercombo.uff b/models/trt/supercombo.uff deleted file mode 100644 index 34f37a89127ff5..00000000000000 --- a/models/trt/supercombo.uff +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:470a506205cb4772db46117d7a994a281d7a00cfd183024086ee7589283c337f -size 78700850 diff --git a/tools/keras/keras2onnx.sh b/tools/keras/keras2onnx.sh deleted file mode 100755 index 3dc79ac02c95e8..00000000000000 --- a/tools/keras/keras2onnx.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -echo "***********************************" -echo "* Keras2ONXX *" -echo "***********************************" -WORKING_DIR=/data/intermediate -echo " " -echo " " -echo " Converting $1 to $2" -echo " " -echo " Cleaning intermediate data..." -echo " " -if [ -d "$WORKING_DIR" ]; then rm -Rf $WORKING_DIR; fi -echo " " -echo " Converting OP Keras to Saved_Model... " -echo " " -/data/openpilot/tools/keras/save_interm.py $1 $WORKING_DIR -echo " " -echo " Converting Saved_Model to ONXX" -echo " " -python -m tf2onnx.convert --saved-model $WORKING_DIR --output $2 -echo " " -echo " Cleaning up..." -echo " " -if [ -d "$WORKING_DIR" ]; then rm -Rf $WORKING_DIR; fi -echo " " -echo " Conversion completed! " -echo " " - diff --git a/tools/keras/keras2onnx.py b/tools/keras/keras_onnx.py old mode 100644 new mode 100755 similarity index 100% rename from tools/keras/keras2onnx.py rename to tools/keras/keras_onnx.py diff --git a/tools/keras/save_interm.py b/tools/keras/save_interm.py deleted file mode 100755 index a800489d798d0d..00000000000000 --- a/tools/keras/save_interm.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 - -import os - -import json -from pathlib import Path -import tensorflow as tf -import tensorflow.keras as keras -import numpy as np -from tensorflow.keras.models import Model -from tensorflow.keras.models import model_from_json, load_model -import sys -import numpy as np -in_model = os.path.expanduser(sys.argv[1]) -output = os.path.expanduser(sys.argv[2]) -input_path = Path(in_model) -output_p = '%s/%s' % (output, input_path.stem) -output_path = Path(output_p) -output_meta = Path('%s/%s.metadata' % (output_path.parent.as_posix(), output_path.stem)) - - -# Reset session -tf.keras.backend.clear_session() -tf.keras.backend.set_learning_phase(0) - -model = tf.keras.models.load_model(in_model, compile=False) -session = tf.keras.backend.get_session() - -bs = [int(np.product(ii.shape[1:])) for ii in model.inputs] -ri = keras.layers.Input((sum(bs),)) -tii = [] -acc = 0 -for i, ii in enumerate(model.inputs): - ti = keras.layers.Lambda(lambda x: x[:,acc:acc+bs[i]], output_shape=(1, bs[i]))(ri) - acc += bs[i] - tr = keras.layers.Reshape(ii.shape[1:])(ti) - tii.append(tr) -no = keras.layers.Concatenate()(model(tii)) -model = Model(inputs=ri, outputs=[no]) - -input_names = sorted([layer.op.name for layer in model.inputs]) -output_names = sorted([layer.op.name for layer in model.outputs]) - -# Store additional information in metadata, useful when creating a TensorRT network -meta = {'input_names': input_names, 'output_names': output_names} - -model.summary() -tf.saved_model.save(model,output_p) -