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

Inference on custom example #1

Closed
danielcrane opened this issue Mar 30, 2021 · 3 comments
Closed

Inference on custom example #1

danielcrane opened this issue Mar 30, 2021 · 3 comments

Comments

@danielcrane
Copy link

danielcrane commented Mar 30, 2021

Hi there,

Thanks for sharing your code!

I was wondering if you know of any easy way to run inference on a custom sample image (that the user provides)? Or if there's any plan on adding this functionality in the near future, ideally with some kind of way to visualise the output?

Daniel

@Turoad
Copy link
Member

Turoad commented Mar 30, 2021

Hi Daniel,

Maybe the following example code is an easy way to run inference:

import torch
from models.resa import RESANet
from utils.config import Config
from datasets import build_dataloader

cfg = Config.fromfile('configs/culane.py')

resa = RESANet(cfg)
resa = resa.cuda()

# random init input tensor
x = torch.randn(1, 3, 288, 800).cuda()
out = resa(x)

You can also get input tensor from dataloader

loader = build_dataloader(cfg.dataset.val, cfg, is_train=False)

img_idx = 0
x = loader.dataset[img_idx]['img'].unsqueeze(0).cuda()
out = resa(x)

@danielcrane
Copy link
Author

Thanks so much!

@Turoad
Copy link
Member

Turoad commented Apr 6, 2021

Please ref this issue:#2.
You can get the visualization now.

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