diff --git a/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/data/.keep b/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/data/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/data/classes/coco.names b/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/data/classes/coco.names new file mode 100644 index 0000000000000000000000000000000000000000..ec82f0ffde8100863d293f3d45555cc58dbfab7c --- /dev/null +++ b/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/data/classes/coco.names @@ -0,0 +1,80 @@ +person +bicycle +car +motorbike +aeroplane +bus +train +truck +boat +traffic light +fire hydrant +stop sign +parking meter +bench +bird +cat +dog +horse +sheep +cow +elephant +bear +zebra +giraffe +backpack +umbrella +handbag +tie +suitcase +frisbee +skis +snowboard +sports ball +kite +baseball bat +baseball glove +skateboard +surfboard +tennis racket +bottle +wine glass +cup +fork +knife +spoon +bowl +banana +apple +sandwich +orange +broccoli +carrot +hot dog +pizza +donut +cake +chair +sofa +potted plant +bed +dining table +toilet +tvmonitor +laptop +mouse +remote +keyboard +cell phone +microwave +oven +toaster +sink +refrigerator +book +clock +vase +scissors +teddy bear +hair drier +toothbrush diff --git a/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/data/classes/voc.names b/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/data/classes/voc.names new file mode 100644 index 0000000000000000000000000000000000000000..1168c39990e4604bb76326833eb7814ed275fcec --- /dev/null +++ b/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/data/classes/voc.names @@ -0,0 +1,20 @@ +aeroplane +bicycle +bird +boat +bottle +bus +car +cat +chair +cow +diningtable +dog +horse +motorbike +person +pottedplant +sheep +sofa +train +tvmonitor \ No newline at end of file diff --git a/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/data/classes/yymnist.names b/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/data/classes/yymnist.names new file mode 100644 index 0000000000000000000000000000000000000000..8b1acc12b635c26f3decadeaa251729d3ce512e9 --- /dev/null +++ b/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/data/classes/yymnist.names @@ -0,0 +1,10 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 diff --git a/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/offline_inference/benchmark_tf.sh b/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/offline_inference/benchmark_tf.sh index 02d60f4204f940e221df7317a51793fe60d9077b..dc8e5b9cd6fab60da0dce9a0da0195d0c24497d3 100644 --- a/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/offline_inference/benchmark_tf.sh +++ b/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/offline_inference/benchmark_tf.sh @@ -8,7 +8,7 @@ fi run_script_file=$(readlink -f "$0") run_script_dir=$(dirname $run_script_file) -root_dir=$(dirname run_script_dir) +root_dir=$(dirname $run_script_dir) model_name=Yolov5 # 已下参数请根据实际路径修改 diff --git a/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/offline_inference/postprocess.py b/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/offline_inference/postprocess.py index cd06a8663e36d6f97307e29467aa9fcb31eb39a8..91772dbe0816c3807c5ced8342e897234e087d0b 100644 --- a/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/offline_inference/postprocess.py +++ b/ACL_TensorFlow/contrib/cv/Yolov5_for_ACL/offline_inference/postprocess.py @@ -92,7 +92,7 @@ class COCOevaluator: test_data, _, batch_image_id, scale, dw, dh = fetcher.process_annotations(annotations) pred_result = [] for j in range(6): - output_data = np.fromfile(inference_path + '/davinci_' + str(k).zfill(6) + '_output' + str(j) + '.bin', + output_data = np.fromfile(inference_path + '/davinci_' + str(batch_image_id).zfill(12) + '_output' + str(j) + '.bin', dtype='float32') pred_result.append(output_data) k += 1 diff --git a/ACL_TensorFlow/contrib/nlp/Transformer_for_ACL/README.md b/ACL_TensorFlow/contrib/nlp/Transformer_for_ACL/README.md index 00e7aaf42cfded0bb727439b23afda6a92115a3e..fd29c31b96ec820f8f852943b1a5900ae463fba9 100644 --- a/ACL_TensorFlow/contrib/nlp/Transformer_for_ACL/README.md +++ b/ACL_TensorFlow/contrib/nlp/Transformer_for_ACL/README.md @@ -66,21 +66,15 @@ python3 xnlp_fmk.py \ **Pb模型转换为om模型** ```Bash -python3 xnlp_fmk.py \ - --output_dir=./save/model \ - --vocab_file=./config/translate_ende_wmt32k/vocab.translate_ende_wmt32k.32768.subwords \ - --pb_model_file=./save/model/TRANSFORMER_TRANSLATION_BatchSize_1.pb \ - --om_model_file=./save/model/TRANSFORMER_TRANSLATION_BatchSize_1.om \ - --predict_batch_size=1 \ - --soc_version="Ascend310" \ - --in_nodes="\"input:1,128\"" \ - --out_nodes="\"transformer/strided_slice_11:0\"" \ - --precision_mode="allow_mix_precision" \ - --op_select_implmode="high_precision" \ - --model_name=transformer \ - --task_name=translation \ - --action_type=atc - +atc + --framework 3 \ + --soc_version "Ascend310" \ + --model ./save/model/TRANSFORMER_TRANSLATION_BatchSize_1.pb \ + --input_shape "input:1,128" \ + --output ./save/model/TRANSFORMER_TRANSLATION_BatchSize_1 \ + --out_nodes "transformer/strided_slice_11:0" \ + --op_select_implmode "high_precision" \ + --precision_mode "allow_mix_precision" ``` **运行推理** diff --git a/ACL_TensorFlow/contrib/nlp/Transformer_for_ACL/README_EN.md b/ACL_TensorFlow/contrib/nlp/Transformer_for_ACL/README_EN.md index ee663d7485fe0119c39b8e222ad4c7a021e24c0a..0a5e9272559df25d286d0b552d028b9a5e743cc4 100644 --- a/ACL_TensorFlow/contrib/nlp/Transformer_for_ACL/README_EN.md +++ b/ACL_TensorFlow/contrib/nlp/Transformer_for_ACL/README_EN.md @@ -66,21 +66,15 @@ python3 xnlp_fmk.py \ **Convert pb to om** ```Bash -python3 xnlp_fmk.py \ - --output_dir=./save/model \ - --vocab_file=./config/translate_ende_wmt32k/vocab.translate_ende_wmt32k.32768.subwords \ - --pb_model_file=./save/model/TRANSFORMER_TRANSLATION_BatchSize_1.pb \ - --om_model_file=./save/model/TRANSFORMER_TRANSLATION_BatchSize_1.om \ - --predict_batch_size=1 \ - --soc_version="Ascend310" \ - --in_nodes="\"input:1,128\"" \ - --out_nodes="\"transformer/strided_slice_11:0\"" \ - --precision_mode="allow_mix_precision" \ - --op_select_implmode="high_precision" \ - --model_name=transformer \ - --task_name=translation \ - --action_type=atc - +atc + --framework 3 \ + --soc_version "Ascend310" \ + --model ./save/model/TRANSFORMER_TRANSLATION_BatchSize_1.pb \ + --input_shape "input:1,128" \ + --output ./save/model/TRANSFORMER_TRANSLATION_BatchSize_1 \ + --out_nodes "transformer/strided_slice_11:0" \ + --op_select_implmode "high_precision" \ + --precision_mode "allow_mix_precision" ``` **Run the inference**