Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多行数据怎么标注呢?识别结果解码出来怎么分开呢 #33

Open
cqray1990 opened this issue May 11, 2023 · 0 comments
Open

Comments

@cqray1990
Copy link

cqray1990 commented May 11, 2023

    for index, (pred, prob, img_name) in enumerate(zip(outputs[:, 1:], probs, file_names)):
        predict_text = ""
        # pred_list = []
        pred_score_list = []
        for i in range(len(pred)):  # decode one sample
            if pred[i] == LabelTransformer.EOS:
                pred_score_list.append(prob[i])
                break
            if pred[i] == LabelTransformer.UNK:
                continue
            decoded_char = LabelTransformer.decode(pred[i])
            predict_text += decoded_char
            # pred_list.append(decoded_char)
            pred_score_list.append(prob[i])
        pred_score = sum(pred_score_list) / len(pred_score_list)
        pred_item = {"filename": Path(img_name).name,
                     "result": predict_text,
                     "pred_score": pred_score.cpu().item()}
        pred_results.append(pred_item)

这段代码多行数据直接合成一条后怎么分开呢,标注的时候多行用特殊符号隔开,解码的时候怎么把两行数据分开呢,会预测出特殊符号?

@cqray1990 cqray1990 changed the title 多行数据怎么标注呢? 多行数据怎么标注呢?识别结果解码出来怎么分开呢 May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant