MICR Code Length Dependency

#2
by bartuteber - opened

Hi @DunnBC22 , I have installed and used your model along with TrOcr tokenizer since your model do not have its own tokenizer. Here is how I use it:

processor = TrOCRProcessor.from_pretrained("microsoft/trocr-large-printed")
model = VisionEncoderDecoderModel.from_pretrained('DunnBC22/trocr-large-printed-cmc7_tesseract_MICR_ocr')

pixel_values = processor(images=image, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)

However, the accuracy is highly dependent to micr code length. When the length is too long, the model skips some characters and when it is too short, it adds randomly generated numbers. Do you have any idea why this happens and do you have any solution?

Thank you in advance for any help

Sign up or log in to comment