-
Notifications
You must be signed in to change notification settings - Fork 837
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #328 from cliveseldon/bin_data
ResNet Latency test
- Loading branch information
Showing
12 changed files
with
1,694 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
|
||
build_image: | ||
s2i build -E environment_grpc . seldonio/seldon-core-s2i-python36:0.4-SNAPSHOT seldon-resnet2.4 | ||
|
||
|
||
clean: | ||
rm -rf model | ||
rm -rf proto/__pycache__ | ||
rm -f proto/*.py | ||
rm -r proto/*.proto | ||
rm -rf tensorflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import tensorflow as tf | ||
import numpy as np | ||
import logging | ||
import datetime | ||
|
||
def get_logger(name): | ||
logger = logging.getLogger(name) | ||
log_formatter = logging.Formatter("%(asctime)s - %(name)s - " | ||
"%(levelname)s - %(message)s") | ||
logger.setLevel('DEBUG') | ||
|
||
console_handler = logging.StreamHandler() | ||
console_handler.setFormatter(log_formatter) | ||
logger.addHandler(console_handler) | ||
|
||
return logger | ||
|
||
logger = get_logger(__name__) | ||
|
||
class Resnet(object): | ||
def __init__(self): | ||
self.class_names = ["class:{}".format(str(i)) for i in range(1000)] | ||
self.sess = tf.Session() | ||
tf.saved_model.loader.load(self.sess, ["serve"], "model", clear_devices=True) | ||
|
||
graph = tf.get_default_graph() | ||
self.x = graph.get_tensor_by_name("input:0") | ||
self.y = graph.get_tensor_by_name("resnet_v1_50/predictions/Reshape_1:0") | ||
|
||
def predict(self,X,feature_names): | ||
start_time = datetime.datetime.now() | ||
predictions = self.sess.run(self.y,feed_dict={self.x:X}) | ||
end_time = datetime.datetime.now() | ||
duration = (end_time - start_time).total_seconds() * 1000 | ||
logger.debug("Processing time: {:.2f} ms".format(duration)) | ||
return predictions.astype(np.float64) | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MODEL_NAME=Resnet | ||
API_TYPE=GRPC | ||
SERVICE_TYPE=MODEL | ||
PERSISTENCE=0 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tensorflow |
Oops, something went wrong.