diff --git a/hpvm/projects/onnx/README.md b/hpvm/projects/onnx/README.md
index d9214dbdb0bf7f4d8b20551abdeadd4d76409f0b..9cbaeb59ce8e4d184ad8dec80d2f1b0df4cd7fc2 100644
--- a/hpvm/projects/onnx/README.md
+++ b/hpvm/projects/onnx/README.md
@@ -1,7 +1,11 @@
 
 ## Importing Conda Environment:
 
-conda env create -f keras_environment.yml
+conda env create -f onnx\_environment.yml
+
+## Activate/deactivate Conda Environment
+
+conda activate onnx\_env
 
 ## Building and Installing Frontend:
 
diff --git a/hpvm/projects/onnx/onnx2hpvm/__init__.py b/hpvm/projects/onnx/frontend/__init__.py
similarity index 100%
rename from hpvm/projects/onnx/onnx2hpvm/__init__.py
rename to hpvm/projects/onnx/frontend/__init__.py
diff --git a/hpvm/projects/onnx/frontend/common.py b/hpvm/projects/onnx/frontend/common.py
new file mode 100644
index 0000000000000000000000000000000000000000..fb4f90465da4c5ce2a60044e8e33388e6f673f51
--- /dev/null
+++ b/hpvm/projects/onnx/frontend/common.py
@@ -0,0 +1,4 @@
+import sys
+import os
+
+
diff --git a/hpvm/projects/onnx/frontend/keras_frontend/__init__.py b/hpvm/projects/onnx/frontend/keras_frontend/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/hpvm/projects/onnx/keras_ref/keras_frontend/approxhpvm_translator.py b/hpvm/projects/onnx/frontend/keras_frontend/approxhpvm_translator.py
similarity index 98%
rename from hpvm/projects/onnx/keras_ref/keras_frontend/approxhpvm_translator.py
rename to hpvm/projects/onnx/frontend/keras_frontend/approxhpvm_translator.py
index f5026d8405f3d182dcc902a401822498818ea506..309feb4ee05d74ffd87d04a510eb1a44430e249c 100644
--- a/hpvm/projects/onnx/keras_ref/keras_frontend/approxhpvm_translator.py
+++ b/hpvm/projects/onnx/frontend/keras_frontend/approxhpvm_translator.py
@@ -1,10 +1,10 @@
 
 import sys
 import numpy as np
-from frontend.promise_translator import PromiseRtTranslator
-from frontend.hpvm_dfg_translator import HPVMTranslator
-from frontend.weight_utils import dumpLabels, dumpData, dumpConvWeights, dumpFcWeights, dumpFcBias
-from frontend.utils import *
+from .promise_translator import PromiseRtTranslator
+from .hpvm_dfg_translator import HPVMTranslator
+from .weight_utils import dumpLabels, dumpData, dumpConvWeights, dumpFcWeights, dumpFcBias
+from .utils import *
 import keras
 import os
 
@@ -926,6 +926,9 @@ def getUniquePath(weights_dir):
   
     
 #***** Top level External Function ******* 
+'''
+This code is refactored into keras_frontend.py
+Use of func "translate_to_approxhpvm" from this .py file is deprecated
 def translate_to_approxhpvm(model, weights_dir, test_data=None, test_labels=None,
                             num_classes=10, reload_dir=None):
 
@@ -964,5 +967,5 @@ def translate_to_approxhpvm(model, weights_dir, test_data=None, test_labels=None
   filter_names = tensorRtTranslator.getFilterNames()
   hpvmTranslator = HPVMTranslator(dfg, weight_str, input_str, filter_names)    
   hpvmTranslator.translate(model, weights_dir, test_data)
-  
+'''
   
diff --git a/hpvm/projects/onnx/keras_ref/keras_frontend/hpvm_dfg_translator.py b/hpvm/projects/onnx/frontend/keras_frontend/hpvm_dfg_translator.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/keras_frontend/hpvm_dfg_translator.py
rename to hpvm/projects/onnx/frontend/keras_frontend/hpvm_dfg_translator.py
diff --git a/hpvm/projects/onnx/keras_ref/keras_frontend/promise_translator.py b/hpvm/projects/onnx/frontend/keras_frontend/promise_translator.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/keras_frontend/promise_translator.py
rename to hpvm/projects/onnx/frontend/keras_frontend/promise_translator.py
diff --git a/hpvm/projects/onnx/keras_ref/keras_frontend/quantize_utils.py b/hpvm/projects/onnx/frontend/keras_frontend/quantize_utils.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/keras_frontend/quantize_utils.py
rename to hpvm/projects/onnx/frontend/keras_frontend/quantize_utils.py
diff --git a/hpvm/projects/onnx/frontend/keras_frontend/util.py b/hpvm/projects/onnx/frontend/keras_frontend/util.py
new file mode 100644
index 0000000000000000000000000000000000000000..ca8e0d1ded964fc3b4a372dd66a82571435dc828
--- /dev/null
+++ b/hpvm/projects/onnx/frontend/keras_frontend/util.py
@@ -0,0 +1,130 @@
+import sys
+import numpy as np
+from ..approxhpvm_translator import DFG, DFGNode
+from ..promise_translator import PromiseRtTranslator
+from ..hpvm_dfg_translator import HPVMTranslator
+from ..weight_utils import dumpLabels, dumpData, dumpConvWeights, dumpFcWeights, dumpFcBias
+from ..utils import *
+import keras
+import os
+
+
+
+def reloadModelParams(model, reload_dir, x_test, y_test):
+
+  print ("\n\n*****NOTE: Reloading pre-trained weights \n")
+
+  score = model.evaluate(x_test, y_test, verbose=0)
+  print('Test loss2:', score[0])
+  print('Test accuracy2:', score[1])
+
+  for i in range(len(model.layers)):
+    layer = model.layers[i]
+    layer_name = layer.name
+    print ("*layer_name = ", layer_name)
+
+    if "conv" not in layer_name and "dense" not in layer_name:
+      continue
+    
+    w_path = reload_dir + layer_name + "_w.bin"
+    b_path = reload_dir + layer_name + "_b.bin"
+   
+    print ("** w_path = ", w_path)
+    print ("** b_path = ", b_path)
+
+    w_arr = np.fromfile(w_path, dtype='float32')
+    b_arr = np.fromfile(b_path, dtype='float32')
+
+    w_shape = layer.get_weights()[0].shape
+    b_shape = layer.get_weights()[1].shape
+    
+    if "conv" in layer_name:      
+      w_nchw_shape = (w_shape[3], w_shape[2], w_shape[0], w_shape[1])      
+      w_arr = np.reshape(w_arr, w_nchw_shape)
+      b_arr = np.reshape(b_arr, b_shape)
+    
+      w_arr = np.transpose(w_arr, (2,3,1,0))
+      print ("old_shape = ", w_shape, " new_shape = ", w_arr.shape)
+
+    if "dense" in layer_name:      
+      w_arr = np.reshape(w_arr, w_shape)
+      b_arr = np.reshape(b_arr, b_shape)
+    
+    weights = []
+    weights.append(w_arr)
+    weights.append(b_arr)
+    # NOTE: overriding weights
+    layer.set_weights(weights)
+
+  score = model.evaluate(x_test, y_test, verbose=0)
+  print('Test loss2:', score[0])
+  print('Test accuracy2:', score[1])
+ 
+
+def getUniquePath(weights_dir):
+
+  # Do not overwrite existing directories - create new with unique ID
+  if os.path.exists(weights_dir):
+    char_count = len(weights_dir)
+    if weights_dir[char_count - 1] == "/":
+      weights_dir = weights_dir[:char_count-1]
+    
+    tokens = weights_dir.split("_")
+    last_tok = tokens[len(tokens) - 1]
+    if last_tok.isdigit():
+      id = int(last_tok)
+      id += 1
+      weights_dir = "_".join(tokens[:-1]) + "_" + str(id) + "/"
+    else:
+      weights_dir = "_".join(tokens) + "_1/"
+
+    weights_dir = getUniquePath(weights_dir)
+      
+  #print (weights_dir)
+  
+  return weights_dir
+  
+    
+#***** Top level External Function ******* 
+def translate_to_approxhpvm(model, 
+                            weights_dir, 
+                            test_data=None, 
+                            test_labels=None,
+                            num_classes=10, 
+                            reload_dir=None):
+
+
+  weights_dir = getUniquePath(weights_dir)
+  os.mkdir(weights_dir)   
+
+  
+  if reload_dir is not None:
+    y_test = keras.utils.to_categorical(test_labels, num_classes)
+    reloadModelParams(model, reload_dir, test_data, y_test)
+
+  
+  dfg = DFG()    
+  for i in range(len(model.layers)):
+    layer = model.layers[i]
+    # NOTE: Add DNN layer to graph
+    dfg.add_to_graph(layer)
+
+  # Build and Print DFG in reverse postorder
+  dfg.buildDFG()
+
+
+  print ("test_data.shape = ", test_data.shape, "\n")
+  print ("test_labels.shape = ", test_labels.shape, "\n")
+
+  tensorRtTranslator = TensorRtTranslator(dfg)    
+  tensorRtTranslator.translate(model, weights_dir, test_data, test_labels)
+  weight_str = tensorRtTranslator.getWeightStr()
+  input_str = tensorRtTranslator.getInputStr()
+
+
+  promiseRtTranslator = PromiseRtTranslator(dfg, weight_str)    
+  promiseRtTranslator.translate(model, weights_dir, test_data)
+
+  filter_names = tensorRtTranslator.getFilterNames()
+  hpvmTranslator = HPVMTranslator(dfg, weight_str, input_str, filter_names)    
+  hpvmTranslator.translate(model, weights_dir, test_data)
\ No newline at end of file
diff --git a/hpvm/projects/onnx/keras_ref/keras_frontend/utils.py b/hpvm/projects/onnx/frontend/keras_frontend/utils.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/keras_frontend/utils.py
rename to hpvm/projects/onnx/frontend/keras_frontend/utils.py
diff --git a/hpvm/projects/onnx/keras_ref/keras_frontend/weight_utils.py b/hpvm/projects/onnx/frontend/keras_frontend/weight_utils.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/keras_frontend/weight_utils.py
rename to hpvm/projects/onnx/frontend/keras_frontend/weight_utils.py
diff --git a/hpvm/projects/onnx/onnx2hpvm/mnist.py b/hpvm/projects/onnx/frontend/mnist.py
similarity index 81%
rename from hpvm/projects/onnx/onnx2hpvm/mnist.py
rename to hpvm/projects/onnx/frontend/mnist.py
index 925fc8dc84e7e08e0262172192f875f301c7b862..8a4f3a85d7dde6ee244915ebf24f1ad205a5e5e8 100644
--- a/hpvm/projects/onnx/onnx2hpvm/mnist.py
+++ b/hpvm/projects/onnx/frontend/mnist.py
@@ -8,9 +8,10 @@ from onnxruntime.backend.backend import OnnxRuntimeBackend as backend
 from onnx import numpy_helper, version_converter
 
 # onnx2hpvm modules
-from frontend import convert_to_hpvm
+from onnx_frontend.util import convert_to_hpvm
 
-model = onnx.load('../models/mnist/mnist.onnx')
+#model = onnx.load('../models/mnist/mnist.onnx')
+model = onnx.load('../models/alexnet/alexnet.onnx')
 test_data_dir = '../models/mnist/test_data_set_0'
 # print('The model before conversion:\n{}'.format(model))
 
diff --git a/hpvm/projects/onnx/frontend/onnx_frontend/__init__.py b/hpvm/projects/onnx/frontend/onnx_frontend/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/hpvm/projects/onnx/onnx2hpvm/frontend.py b/hpvm/projects/onnx/frontend/onnx_frontend/graph_builder.py
similarity index 62%
rename from hpvm/projects/onnx/onnx2hpvm/frontend.py
rename to hpvm/projects/onnx/frontend/onnx_frontend/graph_builder.py
index 1a14731876a7750c03524bb07fc9b4a10bdab485..2a4fb4d9b187e41dc48f4bfed22ec012ba9ad727 100644
--- a/hpvm/projects/onnx/onnx2hpvm/frontend.py
+++ b/hpvm/projects/onnx/frontend/onnx_frontend/graph_builder.py
@@ -6,7 +6,10 @@ class Node(object):
     def __init__(self, name, shape, dtype):
         self._name = name
         self._shape = shape if shape else {}
-        self_dtype = dtype
+        self._dtype = dtype
+    def __str__(self):
+        return "Node: " + self._name + " with shape: " + str(self._shape) + " and data type " + str(self._dtype)
+    __repr__ = __str__
         
 class GraphBuilder(object):
     
@@ -22,15 +25,11 @@ class GraphBuilder(object):
         self._shape = shape if shape else self._build_shape()
     
     def build_cfg(self):
-        # parse parameters
+        # parse init tensors
         for init_tensor in self._graph.initializer:
             if not init_tensor.name.strip():
                 raise ValueError("Tensor's name is required.")
-            print(init_tensor.name)
-            print("###############################")
             self._params[init_tensor.name] = self._parse_array(init_tensor)
-            print(self._params[init_tensor.name])
-            print("###############################")
             self._nodes[init_tensor.name] = Node(init_tensor.name,
                                                  self._params[init_tensor.name].shape,
                                                  self._params[init_tensor.name].dtype)
@@ -61,18 +60,23 @@ class GraphBuilder(object):
                 self._nodes[i_name] = Node(i_name,
                                            tshape, 
                                            dtype)
+        for node in self._graph.node:
+            op_name = node.op_type
+            print("###############################")
+            print(op_name)
+            print(node.attribute)
+            print(node.input)
+            print(node.output)
         print(self._nodes)
     
     def _build_shape(self):
         shape = {}
         for input in self._graph.input:
-            print (input.name, end=": ")
             # get type of input tensor
             tensor_type = input.type.tensor_type
             # check if it has a shape:
             if (tensor_type.HasField("shape")):
                 shape[input.name] = tensor_type.shape
-        print(shape)
         return shape
     
     def _parse_array(self, tensor_proto):
@@ -98,59 +102,4 @@ class GraphBuilder(object):
             from onnx.mapping import TENSOR_TYPE_TO_NP_TYPE
             return TENSOR_TYPE_TO_NP_TYPE[value_proto.type.tensor_type.elem_type].name
         except AttributeError:
-            return dtype
-    
-def convert_to_hpvm(model,
-                      shape=None,
-                      dtype="float32",
-                      opset=None):
-    """Converting an onnx model to equivalent HPVM IR
-    
-    ONNX graphs are represented as Python Protobuf objects.
-    The companion parameters will be handled automatically.
-    However, the input names from onnx graph is vague, mixing inputs and
-    network weights/bias such as "1", "2"...
-    For convenience, we rename the `real` input names to "input_0",
-    "input_1"... And renaming parameters to "param_0", "param_1"...
-    
-    Parameters
-    ----------
-    model : protobuf object
-        ONNX ModelProto after ONNX v1.1.0
-    
-    shape : dict of str to tuple, optional
-        The input shape to the graph
-    
-    dtype : str or dict of str to str
-        The input types to the graph
-    
-    opset : int, optional
-        Override to autodetected opset.
-        This can be helpful for some testing.
-    
-    Returns
-    -------
-
-    """
-    try:
-        from onnx import checker, onnx_cpp2py_export
-        if hasattr(checker, 'check_model'):
-            # try use onnx's own model checker before converting any model
-            try:
-                checker.check_model(model)
-            except onnx_cpp2py_export.checker.ValidationError as e:
-                import warnings
-                    # the checker is a bit violent about errors, so simply print warnings here
-                warnings.warn(str(e))
-    except ImportError:
-        pass
-    print("onnx model is checked valid.")
-    graph = model.graph
-    if opset is None:
-        try:
-            opset = model.opset_import[0].version if model.opset_import else 1
-        except AttributeError:
-            opset = 1 # default opset version set to 1 if not specified
-    print("opset version: ", opset)
-    gb = GraphBuilder(model, shape, dtype, opset)
-    gb.build_cfg()
\ No newline at end of file
+            return dtype
\ No newline at end of file
diff --git a/hpvm/projects/onnx/frontend/onnx_frontend/util.py b/hpvm/projects/onnx/frontend/onnx_frontend/util.py
new file mode 100644
index 0000000000000000000000000000000000000000..2900f2faf30f5ccbaec6bc74424d62694ea29bda
--- /dev/null
+++ b/hpvm/projects/onnx/frontend/onnx_frontend/util.py
@@ -0,0 +1,62 @@
+import sys
+import numpy as np
+import os
+from .graph_builder import GraphBuilder
+
+def check_model(onnx_model):
+    try:
+        from onnx import checker, onnx_cpp2py_export
+        if hasattr(checker, 'check_model'):
+            # try use onnx's own model checker before converting any model
+            try:
+                checker.check_model(onnx_model)
+                print("onnx model is checked valid.")
+            except onnx_cpp2py_export.checker.ValidationError as e:
+                import warnings
+                    # the checker is a bit violent about errors, so simply print warnings here
+                warnings.warn(str(e))
+    except ImportError as e:
+        raise ImportError("Unable to import onnx.checker which is required {}".format(e))
+        
+def convert_to_hpvm(model,
+                      shape=None,
+                      dtype="float32",
+                      opset=None):
+    """Converting an onnx model to equivalent HPVM IR
+    
+    ONNX graphs are represented as Python Protobuf objects.
+    The companion parameters will be handled automatically.
+    However, the input names from onnx graph is vague, mixing inputs and
+    network weights/bias such as "1", "2"...
+    For convenience, we rename the `real` input names to "input_0",
+    "input_1"... And renaming parameters to "param_0", "param_1"...
+    
+    Parameters
+    ----------
+    model : protobuf object
+        ONNX ModelProto after ONNX v1.1.0
+    
+    shape : dict of str to tuple, optional
+        The input shape to the graph
+    
+    dtype : str or dict of str to str
+        The input types to the graph
+    
+    opset : int, optional
+        Override to autodetected opset.
+        This can be helpful for some testing.
+    
+    Returns
+    -------
+
+    """
+    check_model(model)
+    graph = model.graph
+    if opset is None:
+        try:
+            opset = model.opset_import[0].version if model.opset_import else 1
+        except AttributeError:
+            opset = 1 # default opset version set to 1 if not specified
+    print("opset version: ", opset)
+    gb = GraphBuilder(model, shape, dtype, opset)
+    gb.build_cfg()
\ No newline at end of file
diff --git a/hpvm/projects/onnx/models/alexnet/model.onnx b/hpvm/projects/onnx/models/alexnet/alexnet.onnx
similarity index 100%
rename from hpvm/projects/onnx/models/alexnet/model.onnx
rename to hpvm/projects/onnx/models/alexnet/alexnet.onnx
diff --git a/hpvm/projects/onnx/models/resnet50/resnet50v1.onnx b/hpvm/projects/onnx/models/resnet50/resnet50.onnx
similarity index 100%
rename from hpvm/projects/onnx/models/resnet50/resnet50v1.onnx
rename to hpvm/projects/onnx/models/resnet50/resnet50.onnx
diff --git a/hpvm/projects/onnx/onnx_environment.yml b/hpvm/projects/onnx/onnx_environment.yml
index 1f1d42b762f24aedbc2909a4a017d3d5e1c6f0f6..4953af48fc364109b18860a7486ea7f523208ecb 100644
--- a/hpvm/projects/onnx/onnx_environment.yml
+++ b/hpvm/projects/onnx/onnx_environment.yml
@@ -77,7 +77,6 @@ dependencies:
   - wheel=0.32.2=py36_0
   - widgetsnbextension=3.4.2=py36_0
   - xlwt=1.3.0=py36_0
-  - _license=1.1=py36_1
   - _tflow_select=2.1.0=gpu
   - alabaster=0.7.12=py36_0
   - anaconda-client=1.7.2=py36_0
@@ -230,7 +229,7 @@ dependencies:
   - pcre=8.42=h439df22_0
   - pep8=1.7.1=py36_0
   - pillow=5.3.0=py36h34e0f95_0
-  - pip=18.1=py36_0
+  - pip=20.0.2=py36_0
   - pixman=0.34.0=hceecf20_3
   - pkginfo=1.4.2=py36_1
   - pluggy=0.8.0=py36_0
@@ -319,4 +318,10 @@ dependencies:
     - msgpack==0.5.6
     - tables==3.4.4
     - torch==0.4.1
+    - fire==0.2.1
+    - keras2onnx==1.6.0
+    - onnxconverter-common==1.6.0
+    - onnxruntime==1.1.1
+    - onnxruntime-gpu==1.1.1
+
 
diff --git a/hpvm/projects/onnx/setup.py b/hpvm/projects/onnx/setup.py
index 8405aca7ecd52b484681273b77fa806b188df949..7bcdce7a1d126e0c792bd3bf49026cb61b39f5c1 100644
--- a/hpvm/projects/onnx/setup.py
+++ b/hpvm/projects/onnx/setup.py
@@ -2,11 +2,11 @@
 from setuptools import setup
 
 setup(
-    name='onnx2hpvm',
+    name='frontend',
     version='1.0',
-    description='HPVM onnx frontend modules',
+    description='HPVM frontend modules',
     author='Yuanjing Shi',
     author_email='ys26@illinois.edu',
-    packages=['onnx2hpvm'],
+    packages=['fronend'],
     install_requires=[],
 )
diff --git a/hpvm/projects/onnx/src/.ipynb_checkpoints/mnist-checkpoint.ipynb b/hpvm/projects/onnx/src/.ipynb_checkpoints/mnist-checkpoint.ipynb
index 2fd64429bf421126b7000c94ce0f6fd186fbd01f..bbac5d491d80f5f4aaa9286b2323704e55555b48 100644
--- a/hpvm/projects/onnx/src/.ipynb_checkpoints/mnist-checkpoint.ipynb
+++ b/hpvm/projects/onnx/src/.ipynb_checkpoints/mnist-checkpoint.ipynb
@@ -1,6 +1,105 @@
 {
- "cells": [],
- "metadata": {},
+ "cells": [
+  {
+   "cell_type": "code",
+   "execution_count": 4,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import os\n",
+    "import sys\n",
+    "import numpy as np\n",
+    "import onnx\n",
+    "import glob\n",
+    "from onnxruntime.backend.backend import OnnxRuntimeBackend as backend\n",
+    "\n",
+    "from onnx import numpy_helper\n",
+    "\n",
+    "# onnx2hpvm modules\n",
+    "from onnx2hpvm.onnx_translator import from_onnx_to_hpvm"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 6,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "model = onnx.load('../models/mnist/mnist.onnx')\n",
+    "test_data_dir = '../models/mnist/test_data_set_0'"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 7,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "1\n"
+     ]
+    }
+   ],
+   "source": [
+    "# Load inputs\n",
+    "inputs = []\n",
+    "inputs_num = len(glob.glob(os.path.join(test_data_dir, 'input_*.pb')))\n",
+    "print(inputs_num)\n",
+    "for i in range(inputs_num):\n",
+    "    input_file = os.path.join(test_data_dir, 'input_{}.pb'.format(i))\n",
+    "    tensor = onnx.TensorProto()\n",
+    "    with open(input_file, 'rb') as f:\n",
+    "        tensor.ParseFromString(f.read())\n",
+    "    inputs.append(numpy_helper.to_array(tensor))\n",
+    "\n",
+    "# Load reference outputs\n",
+    "ref_outputs = []\n",
+    "ref_outputs_num = len(glob.glob(os.path.join(test_data_dir, 'output_*.pb')))\n",
+    "for i in range(ref_outputs_num):\n",
+    "    output_file = os.path.join(test_data_dir, 'output_{}.pb'.format(i))\n",
+    "    tensor = onnx.TensorProto()\n",
+    "    with open(output_file, 'rb') as f:\n",
+    "        tensor.ParseFromString(f.read())\n",
+    "    ref_outputs.append(numpy_helper.to_array(tensor))\n",
+    "\n",
+    "# Run the model on the backend\n",
+    "outputs = list(backend.run_model(model, inputs))\n",
+    "\n",
+    "#from_onnx_to_hpvm(model)\n",
+    "# Compare the results with reference outputs.\n",
+    "#for ref_o, o in zip(ref_outputs, outputs):\n",
+    "#    np.testing.assert_almost_equal(ref_o, o)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "Python 3",
+   "language": "python",
+   "name": "python3"
+  },
+  "language_info": {
+   "codemirror_mode": {
+    "name": "ipython",
+    "version": 3
+   },
+   "file_extension": ".py",
+   "mimetype": "text/x-python",
+   "name": "python",
+   "nbconvert_exporter": "python",
+   "pygments_lexer": "ipython3",
+   "version": "3.7.3"
+  }
+ },
  "nbformat": 4,
  "nbformat_minor": 2
 }
diff --git a/hpvm/projects/onnx/keras_ref/src/alexnet.py b/hpvm/projects/onnx/src/alexnet.py
similarity index 97%
rename from hpvm/projects/onnx/keras_ref/src/alexnet.py
rename to hpvm/projects/onnx/src/alexnet.py
index b1f29bfc05da52cf1cded1d1f27761c33af3695b..feceaf99e6e4d74dfe560b6e46bd9dfdcfa7745d 100644
--- a/hpvm/projects/onnx/keras_ref/src/alexnet.py
+++ b/hpvm/projects/onnx/src/alexnet.py
@@ -1,6 +1,5 @@
 
 import numpy as np
-
 from keras.datasets import cifar10
 from keras.models import Sequential
 from keras.layers.core import Dense, Dropout, Flatten, Activation
@@ -17,8 +16,6 @@ import struct
 import keras
 import numpy as np
 import os
-from frontend.approxhpvm_translator import translate_to_approxhpvm
-from frontend.weight_utils import dumpCalibrationData
 
 
 
@@ -171,3 +168,7 @@ if __name__ == "__main__":
 
     model = buildModel2()
     trainModel(model)
+    import keras2onnx
+    onnx_model = keras2onnx.convert_keras(model, model.name)
+    import onnx
+    onnx.save(onnx_model, "../models/keras/alexnet.onnx")
diff --git a/hpvm/projects/onnx/keras_ref/src/alexnet2.py b/hpvm/projects/onnx/src/alexnet2.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/src/alexnet2.py
rename to hpvm/projects/onnx/src/alexnet2.py
diff --git a/hpvm/projects/onnx/keras_ref/src/lenet.py b/hpvm/projects/onnx/src/lenet.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/src/lenet.py
rename to hpvm/projects/onnx/src/lenet.py
diff --git a/hpvm/projects/onnx/keras_ref/src/mobilenet_cifar10.py b/hpvm/projects/onnx/src/mobilenet_cifar10.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/src/mobilenet_cifar10.py
rename to hpvm/projects/onnx/src/mobilenet_cifar10.py
diff --git a/hpvm/projects/onnx/keras_ref/src/mobilenet_shallow.py b/hpvm/projects/onnx/src/mobilenet_shallow.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/src/mobilenet_shallow.py
rename to hpvm/projects/onnx/src/mobilenet_shallow.py
diff --git a/hpvm/projects/onnx/keras_ref/src/mobilenetv2_cifar10.py b/hpvm/projects/onnx/src/mobilenetv2_cifar10.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/src/mobilenetv2_cifar10.py
rename to hpvm/projects/onnx/src/mobilenetv2_cifar10.py
diff --git a/hpvm/projects/onnx/keras_ref/src/resnet.py b/hpvm/projects/onnx/src/resnet.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/src/resnet.py
rename to hpvm/projects/onnx/src/resnet.py
diff --git a/hpvm/projects/onnx/keras_ref/src/vgg16_cifar10.py b/hpvm/projects/onnx/src/vgg16_cifar10.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/src/vgg16_cifar10.py
rename to hpvm/projects/onnx/src/vgg16_cifar10.py
diff --git a/hpvm/projects/onnx/keras_ref/src/vgg16_cifar100.py b/hpvm/projects/onnx/src/vgg16_cifar100.py
similarity index 100%
rename from hpvm/projects/onnx/keras_ref/src/vgg16_cifar100.py
rename to hpvm/projects/onnx/src/vgg16_cifar100.py