From 57c130d5c8a3de06cd1ccd633c0cd2ab6d254c49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=BD=A6=E5=9B=BD?= Date: Tue, 1 Aug 2023 02:37:59 +0000 Subject: [PATCH 1/6] update ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙彦国 --- ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md index 4b5811973..bfe431d31 100644 --- a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md @@ -50,7 +50,7 @@ python3 pb_to_pbtxt.py 20180408-102900.pb 1.删除第一个节点batch_size -2.第二个节点phase_train的op修改为const +2.第二个节点phase_train的op修改为Const 3.删除第三个节点batch_join/fifo_queue -- Gitee From 697e85b78c3756f3f1294ab3550b7617ac4569d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=BD=A6=E5=9B=BD?= Date: Tue, 1 Aug 2023 02:47:31 +0000 Subject: [PATCH 2/6] update ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙彦国 --- .../built-in/cv/Facenet_for_ACL/README.md | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md index bfe431d31..e7d80b211 100644 --- a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md @@ -50,7 +50,28 @@ python3 pb_to_pbtxt.py 20180408-102900.pb 1.删除第一个节点batch_size -2.第二个节点phase_train的op修改为Const +2.第二个节点phase_train修改为: +node { + name: "phase_train" + op: "Const" + attr { + key: "dtype" + value { + type: DT_BOOL + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_BOOL + tensor_shape { + } + bool_val: false + } + } + } +} 3.删除第三个节点batch_join/fifo_queue -- Gitee From 08c43aef33ba96a1e6d703374b84b4dfeec988da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=BD=A6=E5=9B=BD?= Date: Mon, 7 Aug 2023 00:58:34 +0000 Subject: [PATCH 3/6] update ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data.py. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙彦国 --- .../built-in/cv/Facenet_for_ACL/script/preprocess_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data.py b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data.py index 5d839bb5a..0eedf0c7e 100644 --- a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data.py +++ b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data.py @@ -149,7 +149,7 @@ def main(args): control_placeholder = tf.compat.v1.placeholder(tf.int32, shape=(None, 1), name='control') phase_train_placeholder = tf.compat.v1.placeholder(tf.bool, name='phase_train') - nrof_preprocess_threads = 4 + nrof_preprocess_threads = 1 image_size = (args.image_size, args.image_size) eval_input_queue = data_flow_ops.FIFOQueue(capacity=2000000, dtypes=[tf.string, tf.int32, tf.int32], -- Gitee From 4aee181431f9f8678084396c46651939723d2fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=BD=A6=E5=9B=BD?= Date: Mon, 7 Aug 2023 00:59:47 +0000 Subject: [PATCH 4/6] rename preprocess_data_forquant.py to preprocess_data_fp32.py. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙彦国 --- .../{preprocess_data_forquant.py => preprocess_data_fp32.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/{preprocess_data_forquant.py => preprocess_data_fp32.py} (97%) diff --git a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data_forquant.py b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data_fp32.py similarity index 97% rename from ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data_forquant.py rename to ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data_fp32.py index 8563095c5..f2e7b62b7 100644 --- a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data_forquant.py +++ b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data_fp32.py @@ -150,7 +150,7 @@ def main(args): control_placeholder = tf.compat.v1.placeholder(tf.int32, shape=(None, 1), name='control') phase_train_placeholder = tf.compat.v1.placeholder(tf.bool, name='phase_train') - nrof_preprocess_threads = 4 + nrof_preprocess_threads = 1 image_size = (args.image_size, args.image_size) eval_input_queue = data_flow_ops.FIFOQueue(capacity=2000000, dtypes=[tf.string, tf.int32, tf.int32], -- Gitee From a5d8e88cd3854ca84968c29415787f1bed1f9790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=BD=A6=E5=9B=BD?= Date: Mon, 7 Aug 2023 01:03:01 +0000 Subject: [PATCH 5/6] update ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙彦国 --- ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md index e7d80b211..348b9bcf7 100644 --- a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/README.md @@ -155,11 +155,11 @@ pip3 install amct_tensorflow-2.16.8-py3-none-linux_x86_64.tar.gz 2.重新导出一份原始数据集用于量化 -python3 pre_process_data_forquant.py Path_of_Data_after_face_alignment Outpath_of_Data_after_face_alignment --use_fixed_image_standardization --lfw_batch_size 1 --use_flipped_images +python3 pre_process_data_fp32.py Path_of_Data_after_face_alignment Outpath_of_Data_after_face_alignment --use_fixed_image_standardization --lfw_batch_size 1 --use_flipped_images 3.量化模型 -python3 amct_python.py ./facenet_20180408-102900.pb ./datasets_bin/data_image_bin_original ./quant +python3 amct_python.py ./facenet_20180408-102900.pb ./datasets_bin/data_image_bin_fp32 ./quant 4.pb转om -- Gitee From bd8494b392db231e1e6db4289f33e0ad7d61363f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=BD=A6=E5=9B=BD?= Date: Mon, 7 Aug 2023 01:04:06 +0000 Subject: [PATCH 6/6] update ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data_fp32.py. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙彦国 --- .../Facenet_for_ACL/script/preprocess_data_fp32.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data_fp32.py b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data_fp32.py index f2e7b62b7..5c9b8be2b 100644 --- a/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data_fp32.py +++ b/ACL_TensorFlow/built-in/cv/Facenet_for_ACL/script/preprocess_data_fp32.py @@ -113,15 +113,15 @@ def evaluate(sess,output_path, enqueue_op,image_paths_placeholder,labels_placeho assert nrof_images % batch_size == 0, 'The number of LFW images must be an integer multiple of the LFW batch size' nrof_batches = nrof_images // batch_size print("#############nrof_batches",nrof_batches) - if not os.path.exists(os.path.join(output_path ,"data_image_bin_original/")): - os.makedirs(os.path.join(output_path ,"data_image_bin_original/")) - if not os.path.exists(os.path.join(output_path ,"data_label_bin_original/")): - os.makedirs(os.path.join(output_path ,"data_label_bin_original/")) + if not os.path.exists(os.path.join(output_path ,"data_image_bin_fp32/")): + os.makedirs(os.path.join(output_path ,"data_image_bin_fp32/")) + if not os.path.exists(os.path.join(output_path ,"data_label_bin_fp32/")): + os.makedirs(os.path.join(output_path ,"data_label_bin_fp32/")) for i in range(nrof_batches): ###########save bin ############### feed_dict2 = {batch_size_placeholder:batch_size} - bin_image2 = os.path.join(output_path,"data_image_bin_original/{}.bin".format(str(i).zfill(6))) - bin_label2 = os.path.join(output_path,"data_label_bin_original/{}.bin".format(str(i).zfill(6))) + bin_image2 = os.path.join(output_path,"data_image_bin_fp32/{}.bin".format(str(i).zfill(6))) + bin_label2 = os.path.join(output_path,"data_label_bin_fp32/{}.bin".format(str(i).zfill(6))) emb, lab = sess.run([image_batch,labels],feed_dict=feed_dict2) #emb.astype(np.uint8).tofile(bin_image2) emb.tofile(bin_image2) -- Gitee