Add compiling packnet model, refactor modules to not duplicate loaders and trainers

This commit is contained in:
Piv
2021-07-23 22:41:46 +09:30
parent 66cbc7faf6
commit 3254eef4bf
8 changed files with 135 additions and 96 deletions

16
metric.py Normal file
View 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))