Add compiling packnet model, refactor modules to not duplicate loaders and trainers
This commit is contained in:
16
metric.py
Normal file
16
metric.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import tensorflow as tf
|
||||
|
||||
|
||||
def delta1_metric(y_true, y_pred):
|
||||
max_ratio = tf.maximum(y_pred / y_true, y_true / y_pred)
|
||||
return tf.reduce_mean(tf.cast(max_ratio < tf.convert_to_tensor(1.25), tf.float32))
|
||||
|
||||
|
||||
def delta2(y_true, y_pred):
|
||||
max_ratio = tf.maximum(y_pred / y_true, y_true / y_pred)
|
||||
return tf.reduce_mean(tf.cast(max_ratio < tf.convert_to_tensor(1.25 ** 2), tf.float32))
|
||||
|
||||
|
||||
def delta3(y_true, y_pred):
|
||||
max_ratio = tf.maximum(y_pred / y_true, y_true / y_pred)
|
||||
return tf.reduce_mean(tf.cast(max_ratio < tf.convert_to_tensor(1.25 ** 3), tf.float32))
|
||||
Reference in New Issue
Block a user