diff --git a/doc/doc_ch/add_new_algorithm.md b/doc/doc_ch/add_new_algorithm.md index 79c29249dd7dd0b25ffa7625d11ed2378bfafec4..bb97e00aa66771e99feb799dc4945f3d13b5b247 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 db72fe7d4b4b5b5d12e06ff34140c9da1186319b..a8903b0a20ca38f29ccaf4fc7f368fa2dae317a0 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 d3d353042575671826da3fc56bf02ccf40dfa5d4..5c864b1e98779adf9cd9126f58bb1f40d6fc7fa0 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 41b7ac2bad041295ad67a2de3461c109cf76a84a..2f8ba3b222022099501e6bda48266ef51a40e9db 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 5510a9bf586d600684353863e9e8e9e8e866b8cb..75503f62da1979fafa9269488d037504e4ac101a 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 33fe4dbb5e809388b135ee467d7e7c230f0eabcc..9ff5d0602e4d0b691b22bf865012267b78fda7da 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 eeff2bfbbe466b29b8b46e83058e2199fd5cafed..f4cfee27893b889b1f622e6d8c68531dc85ef0a6 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 d96505985ea8a291b3579acb2aaee1b3d66c1baa..9e9d15fb674ca04558b1f8cb616dc4e44934dbb9 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 e9aff6d210114a1ebcb42409a7b9480f69ead664..f419a21ca7a50fd99200785eba14bd18bbdca501 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 18494e372523f32baa054dd9beb6e632d61f7efa..78b3b1b79d05f39c8cc12d50d04dfd277572be1c 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 7522e43907b50b84cc52930ff4eeb8e537cb2c73..ab6a49120b6e22621b462b680a161d70ee965e78 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 96dbac8e83cb8651ca19c05d5a680a4efebc6ff6..7a948bdc3768f4469a1dc3b8bb22a4a9045330e6 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}