python - Why is my TF Slim Metric slow? -
i'm computing auc score pr curve using 2 different methods:
using both functions in unit test shows official implementation bit faster own (one call takes 3 instead of 5 seconds).
but if start using official version in evaluation routine makes run super slow. here timing:
- without computing, auc score batch needs 16.703 seconds.
- computing auc score own version takes 31.572 seconds (per batch).
- computing auc score tf.metrics takes 53.525 seconds (per batch).
can me figure out why? here how code looks overall:
# setup of neural network... # either: computation of auc score version 1 auc, update_op = tf.metrics.auc(label, prediction, weights, name) dict_metrics[name] = (auc, update_op) dict_metrics["stream/" + name] = slim.metrics.streaming_mean(auc) # or: computation of auc score version 2 auc = compute_my_own_auc_score(label, prediction, weights) dict_metrics[name] = slim.metrics.streaming_mean(auc) # adding auc summary... # computation of few other metrics... # getting list of metrics , updates names_to_values, names_to_updates = slim.metrics.aggregate_metric_map(dict_metrics) # calling tf.slim evaluate slim.evaluation.evaluation_loop(eval_op=list(names_to_updates.values()), ...)
i don't how slim deals update operations, maybe have use eval_ops in different way?
Comments
Post a Comment