Skip to content

Commit

Permalink
add modelinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
laitassou committed Apr 23, 2020
1 parent 45c3abd commit 4604e65
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
16 changes: 15 additions & 1 deletion regression/fuel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#
# LAA model
#


import json

import pathlib

import matplotlib.pyplot as plt
Expand Down Expand Up @@ -55,19 +62,26 @@
train_stats = train_stats.transpose()
train_stats
print("train_stats:")
print (type(train_stats))
print(train_stats.to_numpy())


train_stats.to_json('ModelInfo.txt')


print(train_stats)

train_labels = train_dataset.pop('MPG')
test_labels = test_dataset.pop('MPG')


def norm(x):
return (x - train_stats['mean']) / train_stats['std']

normed_train_data = norm(train_dataset)
normed_test_data = norm(test_dataset)

print("length key:"+str(len(train_dataset.keys())))

def build_model():
model = keras.Sequential([
layers.Dense(64, activation='relu', input_shape=[len(train_dataset.keys())]),
Expand Down
3 changes: 3 additions & 0 deletions regression/testfroze.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

#
# model mpg
#
import tensorflow as tf
from tensorflow import keras
import numpy as np
Expand Down
6 changes: 6 additions & 0 deletions service/examples/mpg/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "../../include/Model.h"
#include "../../include/Tensor.h"
#include "../../include/ModelInfos.h"

#include <algorithm>
#include <iterator>

Expand All @@ -8,10 +10,14 @@ using namespace std;

int main() {


// Create model
Model m("../frozen_graph.pb");
//m.restore("../checkpoint/train.ckpt");

ModelInfos<float> mInfos("../ModelInfo.txt");
mInfos.show();

// Create Tensors
Tensor input(m, "x");
Tensor prediction(m, "Identity");
Expand Down

0 comments on commit 4604e65

Please sign in to comment.