语义实体识别的置信度 #14894
Unanswered
eunij-peanut
asked this question in
Q&A
语义实体识别的置信度
#14894
Replies: 1 comment
-
在语义实体识别(SER)任务中,获取每个实体的置信度(score)可以通过模型的 后处理阶段 获取。在提供的代码中, 1. 模型推理preds = self.model(batch) 这里 2. 后处理提取置信度post_result = self.post_process_class(
preds, segment_offset_ids=batch[6], ocr_infos=batch[7]
) 这里 3. 输出每个实体的置信度在 filtered_result = [
{"transcription": item["transcription"], "pred": item["pred"], "score": item["score"]}
for item in result
if item["pred"].upper() not in excluded_preds
]
如何使用置信度如果你希望在调用 result, ocr_info = ser_engine(data)
for entity in result[0]: # 每个实体的信息
print(f"实体: {entity['transcription']}, 预测类别: {entity['pred']}, 置信度: {entity['score']}") 结论在 Response generated by 🤖 feifei-bot | chatgpt-4o-latest |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
请问进行关键信息提取时,如何得到语义实体识别(SER)过程中,每个实体识别结果的置信度?
`from future import absolute_import
from future import division
from future import print_function
import numpy as np
import os
import sys
dir = os.path.dirname(os.path.abspath(file))
sys.path.append(dir)
sys.path.insert(0, os.path.abspath(os.path.join(dir, "..")))
os.environ["FLAGS_allocator_strategy"] = "auto_growth"
import cv2
import json
import paddle
import time
from ppocr.data import create_operators, transform
from ppocr.modeling.architectures import build_model
from ppocr.postprocess import build_post_process
from ppocr.utils.save_load import load_model
from ppocr.utils.visual import draw_ser_results
from ppocr.utils.utility import get_image_file_list, load_vqa_bio_label_maps
import tools.program as program
def to_tensor(data):
import numbers
from collections import defaultdict
class SerPredictor(object):
def init(self, config):
global_config = config["Global"]
self.algorithm = config["Architecture"]["algorithm"]
import time
if name == "main":
# suppress_warnings() # 在主函数开始时调用这个函数
Beta Was this translation helpful? Give feedback.
All reactions