From f7e1ba1dd50ac742b2ea10431a005de27baebab5 Mon Sep 17 00:00:00 2001 From: Shuangchi He <34329208+Yulv-git@users.noreply.github.com> Date: Mon, 2 May 2022 13:59:01 +0800 Subject: [PATCH] Fix some typos for Jetson, metrics and result. (#6118) --- doc/doc_ch/add_new_algorithm.md | 2 +- doc/doc_en/add_new_algorithm_en.md | 2 +- ppocr/metrics/det_metric.py | 4 ++-- ppocr/metrics/e2e_metric.py | 4 ++-- ppocr/metrics/kie_metric.py | 4 ++-- ppstructure/vqa/infer_ser_e2e.py | 2 +- ppstructure/vqa/train_re.py | 10 +++++----- test_tipc/docs/jeston_test_train_inference_python.md | 8 ++++---- tools/infer/predict_system.py | 6 +++--- tools/infer/utility.py | 2 +- tools/infer_cls.py | 4 ++-- tools/infer_e2e.py | 2 +- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/doc_ch/add_new_algorithm.md b/doc/doc_ch/add_new_algorithm.md index 79c29249..bb97e00a 100644 --- a/doc/doc_ch/add_new_algorithm.md +++ b/doc/doc_ch/add_new_algorithm.md @@ -246,7 +246,7 @@ class MyMetric(object): def get_metric(self): """ - return metircs { + return metrics { 'acc': 0, 'norm_edit_dis': 0, } diff --git a/doc/doc_en/add_new_algorithm_en.md b/doc/doc_en/add_new_algorithm_en.md index db72fe7d..a8903b0a 100644 --- a/doc/doc_en/add_new_algorithm_en.md +++ b/doc/doc_en/add_new_algorithm_en.md @@ -237,7 +237,7 @@ class MyMetric(object): def get_metric(self): """ - return metircs { + return metrics { 'acc': 0, 'norm_edit_dis': 0, } diff --git a/ppocr/metrics/det_metric.py b/ppocr/metrics/det_metric.py index d3d35304..5c864b1e 100644 --- a/ppocr/metrics/det_metric.py +++ b/ppocr/metrics/det_metric.py @@ -65,9 +65,9 @@ class DetMetric(object): } """ - metircs = self.evaluator.combine_results(self.results) + metrics = self.evaluator.combine_results(self.results) self.reset() - return metircs + return metrics def reset(self): self.results = [] # clear results diff --git a/ppocr/metrics/e2e_metric.py b/ppocr/metrics/e2e_metric.py index 41b7ac2b..2f8ba3b2 100644 --- a/ppocr/metrics/e2e_metric.py +++ b/ppocr/metrics/e2e_metric.py @@ -78,9 +78,9 @@ class E2EMetric(object): self.results.append(result) def get_metric(self): - metircs = combine_results(self.results) + metrics = combine_results(self.results) self.reset() - return metircs + return metrics def reset(self): self.results = [] # clear results diff --git a/ppocr/metrics/kie_metric.py b/ppocr/metrics/kie_metric.py index 5510a9bf..75503f62 100644 --- a/ppocr/metrics/kie_metric.py +++ b/ppocr/metrics/kie_metric.py @@ -59,9 +59,9 @@ class KIEMetric(object): def get_metric(self): - metircs = self.combine_results(self.results) + metrics = self.combine_results(self.results) self.reset() - return metircs + return metrics def reset(self): self.results = [] # clear results diff --git a/ppstructure/vqa/infer_ser_e2e.py b/ppstructure/vqa/infer_ser_e2e.py index 33fe4dbb..9ff5d060 100644 --- a/ppstructure/vqa/infer_ser_e2e.py +++ b/ppstructure/vqa/infer_ser_e2e.py @@ -149,7 +149,7 @@ if __name__ == "__main__": result, _ = ser_engine(img) fout.write(img_path + "\t" + json.dumps( { - "ser_resule": result, + "ser_result": result, }, ensure_ascii=False) + "\n") img_res = draw_ser_results(img, result) diff --git a/ppstructure/vqa/train_re.py b/ppstructure/vqa/train_re.py index eeff2bfb..f4cfee27 100644 --- a/ppstructure/vqa/train_re.py +++ b/ppstructure/vqa/train_re.py @@ -145,7 +145,7 @@ def train(args): global_step = 0 model.clear_gradients() train_dataloader_len = len(train_dataloader) - best_metirc = {'f1': 0} + best_metric = {'f1': 0} model.train() train_reader_cost = 0.0 @@ -192,8 +192,8 @@ def train(args): # Log metrics # Only evaluate when single GPU otherwise metrics may not average well results = evaluate(model, eval_dataloader, logger) - if results['f1'] >= best_metirc['f1']: - best_metirc = results + if results['f1'] >= best_metric['f1']: + best_metric = results output_dir = os.path.join(args.output_dir, "best_model") os.makedirs(output_dir, exist_ok=True) if distributed: @@ -206,7 +206,7 @@ def train(args): logger.info("Saving model checkpoint to {}".format( output_dir)) logger.info("eval results: {}".format(results)) - logger.info("best_metirc: {}".format(best_metirc)) + logger.info("best_metric: {}".format(best_metric)) reader_start = time.time() if rank == 0: @@ -220,7 +220,7 @@ def train(args): tokenizer.save_pretrained(output_dir) paddle.save(args, os.path.join(output_dir, "training_args.bin")) logger.info("Saving model checkpoint to {}".format(output_dir)) - logger.info("best_metirc: {}".format(best_metirc)) + logger.info("best_metric: {}".format(best_metric)) if __name__ == "__main__": diff --git a/test_tipc/docs/jeston_test_train_inference_python.md b/test_tipc/docs/jeston_test_train_inference_python.md index d9650598..9e9d15fb 100644 --- a/test_tipc/docs/jeston_test_train_inference_python.md +++ b/test_tipc/docs/jeston_test_train_inference_python.md @@ -1,6 +1,6 @@ -# Jeston端基础训练预测功能测试 +# Jetson端基础训练预测功能测试 -Jeston端基础训练预测功能测试的主程序为`test_inference_inference.sh`,由于Jeston端CPU较差,Jeston只需要测试TIPC关于GPU和TensorRT预测推理的部分即可。 +Jetson端基础训练预测功能测试的主程序为`test_inference_inference.sh`,由于Jetson端CPU较差,Jetson只需要测试TIPC关于GPU和TensorRT预测推理的部分即可。 ## 1. 测试结论汇总 @@ -42,7 +42,7 @@ Jeston端基础训练预测功能测试的主程序为`test_inference_inference. 先运行`prepare.sh`准备数据和模型,然后运行`test_inference_inference.sh`进行测试,最终在```test_tipc/output```目录下生成`python_infer_*.log`格式的日志文件。 -`test_inference_inference.sh`仅有一个模式`whole_infer`,在Jeston端,仅需要测试预测推理的模式即可: +`test_inference_inference.sh`仅有一个模式`whole_infer`,在Jetson端,仅需要测试预测推理的模式即可: ``` - 模式3:whole_infer,不训练,全量数据预测,走通开源模型评估、动转静,检查inference model预测时间和精度; @@ -51,7 +51,7 @@ bash test_tipc/prepare.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_lin # 用法1: bash test_tipc/test_inference_inference.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_infer_python_jetson.txt 'whole_infer' # 用法2: 指定GPU卡预测,第三个传入参数为GPU卡号 -bash test_tipc/test_inference_jeston.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_infer_python_jetson.txt 'whole_infer' '1' +bash test_tipc/test_inference_jetson.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_infer_python_jetson.txt 'whole_infer' '1' ``` 运行相应指令后,在`test_tipc/output`文件夹下自动会保存运行日志。如`whole_infer`模式下,会运行训练+inference的链条,因此,在`test_tipc/output`文件夹有以下文件: diff --git a/tools/infer/predict_system.py b/tools/infer/predict_system.py index e9aff6d2..f419a21c 100755 --- a/tools/infer/predict_system.py +++ b/tools/infer/predict_system.py @@ -93,11 +93,11 @@ class TextSystem(object): self.draw_crop_rec_res(self.args.crop_res_save_dir, img_crop_list, rec_res) filter_boxes, filter_rec_res = [], [] - for box, rec_reuslt in zip(dt_boxes, rec_res): - text, score = rec_reuslt + for box, rec_result in zip(dt_boxes, rec_res): + text, score = rec_result if score >= self.drop_score: filter_boxes.append(box) - filter_rec_res.append(rec_reuslt) + filter_rec_res.append(rec_result) return filter_boxes, filter_rec_res diff --git a/tools/infer/utility.py b/tools/infer/utility.py index 18494e37..78b3b1b7 100644 --- a/tools/infer/utility.py +++ b/tools/infer/utility.py @@ -187,7 +187,7 @@ def create_predictor(args, mode, logger): gpu_id = get_infer_gpuid() if gpu_id is None: logger.warning( - "GPU is not found in current device by nvidia-smi. Please check your device or ignore it if run on jeston." + "GPU is not found in current device by nvidia-smi. Please check your device or ignore it if run on jetson." ) config.enable_use_gpu(args.gpu_mem, 0) if args.use_tensorrt: diff --git a/tools/infer_cls.py b/tools/infer_cls.py index 7522e439..ab6a4912 100755 --- a/tools/infer_cls.py +++ b/tools/infer_cls.py @@ -73,8 +73,8 @@ def main(): images = paddle.to_tensor(images) preds = model(images) post_result = post_process_class(preds) - for rec_reuslt in post_result: - logger.info('\t result: {}'.format(rec_reuslt)) + for rec_result in post_result: + logger.info('\t result: {}'.format(rec_result)) logger.info("success!") diff --git a/tools/infer_e2e.py b/tools/infer_e2e.py index 96dbac8e..7a948bdc 100755 --- a/tools/infer_e2e.py +++ b/tools/infer_e2e.py @@ -104,7 +104,7 @@ def main(): preds = model(images) post_result = post_process_class(preds, shape_list) points, strs = post_result['points'], post_result['texts'] - # write resule + # write result dt_boxes_json = [] for poly, str in zip(points, strs): tmp_json = {"transcription": str} -- GitLab