Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
VOCAB= ascii_uppercase+digits+punctuation+" \t\n"
#Change to CUDA to run using GPU
device = 'cpu'
def get_test_data(etfo):
text = etfo
text_tensor = torch.zeros(len(text), 1, dtype=torch.long)
text_tensor[:, 0] = torch.LongTensor([VOCAB.find(c) for c in text])
etfo = get_info('invoice.png')
# etfo = get_info('X51005621482.jpeg')
etfo = etfo.upper()
text_tensor = get_test_data(etfo)
temp = []
for i in range(len(text_tensor)):
if text_tensor[i]>=0 and text_tensor[i]<=70:
text_tensor = torch.LongTensor(temp)
#model initialization
hidden_size = 256
device= torch.device('cpu')
model = ExtractLSTM(len(VOCAB), 16, hidden_size).to(device)
result = test(model)

This comment has been minimized.

Copy link
Owner Author

@ttchengab ttchengab commented Oct 29, 2020

Can you tell me what is the pre trained model you have used in place of 'model.pth' in line 26

I used the checkpoint from the solution I talked about in this blog:


This comment has been minimized.

Copy link

@yasmineChelly-95 yasmineChelly-95 commented Nov 11, 2020

Hi, thank you for sharing this implementation code. I read your blog and I followed the steps correctly now I have the code running. However I think I chose the wrong model because I have poor results. I generated the 'model.pth' from this repo please correct if I'm wrong and if not did you use different data that gave you these good results ?


This comment has been minimized.

Copy link

@Vibha111094 Vibha111094 commented Dec 13, 2020

I am facing the same issue that yasmineChelly-95 has.
I am getting very poor results.
Can you please let us know if you used any different data or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment