Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can I get box or TSR and TSSR when predict not eval? #4

Open
TheHonestBob opened this issue Mar 31, 2023 · 2 comments
Open

how can I get box or TSR and TSSR when predict not eval? #4

TheHonestBob opened this issue Mar 31, 2023 · 2 comments

Comments

@TheHonestBob
Copy link

No description provided.

@TheHonestBob TheHonestBob changed the title how can I get how can I get box or TSR and TSSR when predict not eval? Mar 31, 2023
@hsl323
Copy link
Collaborator

hsl323 commented Apr 21, 2023

I apologize for the late response.

The box is the content that should be given for inference. You can use the OCR information that exists in the dataset or use your own box.

As you can see in Instructions for proposed method in the readme, the inference code has the argument attention_vis. You can get TSR, and TSSR using this argument.

If you want to get something that is not synthesized with the image for visualization, you can use the model's seventh output, att_set

garnet/CODE/inference.py

Lines 106 to 121 in c5a7adb

_, _, _, _, result, _, att_set, att = net(x)
# save result
result = (1 - box_mask) * im + box_mask * result.cpu()
img = (torch.clamp(result[0] + 1, 0, 2) * 127.5).cpu().detach().numpy().transpose(1, 2, 0).astype(np.uint8)
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
img = cv2.resize(img, (H, W))
cv2.imwrite(os.path.join(args.result_path, name), img)
if args.attention_vis:
stroke_att = []
surround_att = []
gate_att = []
for i in range(0, 4):
stroke_att_map = attention_visualize(result.cpu(), att_set[i][0], args.input_size)
surround_att_map = attention_visualize(result.cpu(), att_set[i][1], args.input_size)

att_set[i][0]: TSR on the i-th layer
att_set[i][1]: TSSR on the i-th layer

@TheHonestBob
Copy link
Author

thanks for your reply, I will try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants