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
# Convert SE-ResNet-50 from Caffe to Keras | |
# Using the model from https://github.com/shicai/SENet-Caffe | |
import os | |
import numpy as np | |
# The caffe module needs to be on the Python path; we'll add it here explicitly. | |
import sys | |
caffe_root = "/path/to/caffe" | |
sys.path.insert(0, caffe_root + "python") |
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
# from https://cloud.google.com/solutions/machine-learning-with-financial-time-series-data | |
def tf_confusion_metrics(model, actual_classes, session, feed_dict): | |
predictions = tf.argmax(model, 1) | |
actuals = tf.argmax(actual_classes, 1) | |
ones_like_actuals = tf.ones_like(actuals) | |
zeros_like_actuals = tf.zeros_like(actuals) | |
ones_like_predictions = tf.ones_like(predictions) | |
zeros_like_predictions = tf.zeros_like(predictions) |