OCR-D / ocrd_froc

7 stars 2 forks source link

add confidence to OCR result #1

Closed bertsky closed 1 year ago

bertsky commented 1 year ago

https://github.com/MegaloPat/ocrd_froc/blob/4c207eb708235bf6a7696e6feed62630e08c20b1/ocrd_froc/processor.py#L91

Would that be possible? (I guess we would first have to factor out the sum(torch.max(out, 2)) of run_cocr, run_selocr and run_adaptive, right?)

GemCarr commented 1 year ago

we can add something that would output some kind of confidence on the character level, however on the line level that would leave us with multiple options on how to handle that. We can have a conservative approach by multiplying the individual character confidence scores but then we would rarely have a good line confidence. We could also have a more 'optimistic' approach by having the mean average of the character confidence scores as line confidence. What do you think would be best ?

bertsky commented 1 year ago

We can have a conservative approach by multiplying the individual character confidence scores but then we would rarely have a good line confidence.

Yes, it would have little value because you would need to pair the score with the line length.

Also, I have not seen it implemented as a multiplication – anywhere ever.

We could also have a more 'optimistic' approach by having the mean average of the character confidence scores as line confidence.

Yes, that's what everyone seems to use.

As an alternative, one could calculate the perplexity...

GemCarr commented 1 year ago

mean average is a good option imo

bertsky commented 1 year ago

Thanks a lot!