From 4e1e5b0c56161afe00af0598ab43080602398892 Mon Sep 17 00:00:00 2001 From: hanxiaoxuan Date: Mon, 9 Jan 2023 15:44:25 +0800 Subject: [PATCH] add compile time 0109 --- .../Face-ResNet50_ID1372_for_TensorFlow/TrainResNet_rt.py | 4 ++++ .../test/train_RT2_performance_1p.sh | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/TensorFlow/built-in/cv/image_classification/Face-ResNet50_ID1372_for_TensorFlow/TrainResNet_rt.py b/TensorFlow/built-in/cv/image_classification/Face-ResNet50_ID1372_for_TensorFlow/TrainResNet_rt.py index ecd88cace..3d81546a5 100644 --- a/TensorFlow/built-in/cv/image_classification/Face-ResNet50_ID1372_for_TensorFlow/TrainResNet_rt.py +++ b/TensorFlow/built-in/cv/image_classification/Face-ResNet50_ID1372_for_TensorFlow/TrainResNet_rt.py @@ -229,8 +229,12 @@ def Train(epochs=100): # Training and calculating cost resnet_model.set_is_training(True) + minibatch_start = time.time() temp_cost, _ = sess.run([cost, train], feed_dict={images: minibatch_X, labels: minibatch_Y}) minibatch_cost += np.sum(temp_cost) + minibath_time = time.time() - minibatch_start + if batch_index <= 5: + print("minibatch time: {}".format(minibath_time)) # tensorboard if(tensorboard_on) and (batch_index % TensorBoard_refresh == 0): diff --git a/TensorFlow/built-in/cv/image_classification/Face-ResNet50_ID1372_for_TensorFlow/test/train_RT2_performance_1p.sh b/TensorFlow/built-in/cv/image_classification/Face-ResNet50_ID1372_for_TensorFlow/test/train_RT2_performance_1p.sh index 31cd52203..c0310c3bd 100644 --- a/TensorFlow/built-in/cv/image_classification/Face-ResNet50_ID1372_for_TensorFlow/test/train_RT2_performance_1p.sh +++ b/TensorFlow/built-in/cv/image_classification/Face-ResNet50_ID1372_for_TensorFlow/test/train_RT2_performance_1p.sh @@ -74,6 +74,8 @@ FPS=`awk 'BEGIN{printf "%.2f\n",'${batch_size}'*'${steps_per_s}'}'` #打印,不需要修改 echo "Final Performance images/sec : $FPS" +#输出CompileTime +CompileTime=`grep "minibatch time:" ${cur_path}/test/output/${ASCEND_DEVICE_ID}/train_${ASCEND_DEVICE_ID}.log |head -n 1|awk '{sum+=$3} END {print sum}'` #输出训练精度,需要模型审视修改 train_accuracy="None" @@ -114,4 +116,5 @@ echo "ActualFPS = ${ActualFPS}" >> $cur_path/test/output/$ASCEND_DEV echo "TrainingTime = ${TrainingTime}" >> $cur_path/test/output/$ASCEND_DEVICE_ID/${CaseName}.log echo "TrainAccuracy = ${train_accuracy}" >> $cur_path/test/output/$ASCEND_DEVICE_ID/${CaseName}.log echo "ActualLoss = ${ActualLoss}" >> $cur_path/test/output/$ASCEND_DEVICE_ID/${CaseName}.log -echo "E2ETrainingTime = ${e2e_time}" >> $cur_path/test/output/$ASCEND_DEVICE_ID/${CaseName}.log \ No newline at end of file +echo "E2ETrainingTime = ${e2e_time}" >> $cur_path/test/output/$ASCEND_DEVICE_ID/${CaseName}.log +echo "CompileTime = ${CompileTime}" >> $cur_path/test/output/$ASCEND_DEVICE_ID/${CaseName}.log \ No newline at end of file -- Gitee