Created
April 25, 2021 06:21
-
-
Save magesh-technovator/ceb4af826501595630f10957033bbb76 to your computer and use it in GitHub Desktop.
CRAFT Prediction and post-processing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load image as torch tensor | |
x = torch.from_numpy(x).permute(2, 0, 1) # [h, w, c] to [c, h, w] | |
x = Variable(x.unsqueeze(0)) # [c, h, w] to [b, c, h, w] | |
if cuda: | |
x = x.cuda() | |
# forward pass | |
with torch.no_grad(): | |
y, feature = net(x) | |
# Get Score and Affinity Map | |
score_text = y[0,:,:,0].cpu().data.numpy() | |
score_link = y[0,:,:,1].cpu().data.numpy() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment