TrOCR large Printed outputs only in CAPITAL letters..why?
ld863×349 3.51 KBfrom transformers import TrOCRProcessor, VisionEncoderDecoderModelfrom PIL import Imageprocessor = TrOCRProcessor.from_pretrained(r".\TrOCR")model = VisionEncoderDecoderModel.from_pretrained(r".\TrOCR")image = Image.open(r".\ld.png").convert(“RGB”)pixel_values = processor(image, return_tensors=“pt”,attention_mask=True,Truncation=True).pixel_valuesgenerated_ids = model.generate(pixel_values,pad_token_id=2,eos_token_id=2,max_new_tokens = 10000)#foropen-end generation.generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]generated_textOUTPUT:‘THIS IS I1 MEANS L & 1’
2022-11-17T08:07:30Z
Hi,This question also has been asked at the original repository:[TrOCR, Huggingface] Inference predictions always upper case? · Issue #875 · microsoft/unilm · GitHub.
2022-11-17T08:16:27Z
Facing the same problem here as well. It should return the text as it is in the image not all upper case.