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 to view image result in opencv #198

Open
bb6698 opened this issue Oct 17, 2023 · 1 comment
Open

How to view image result in opencv #198

bb6698 opened this issue Oct 17, 2023 · 1 comment

Comments

@bb6698
Copy link

bb6698 commented Oct 17, 2023

Hi!! I'm using Yolop with my images but I want to visualisate the result. How to could do it?

My code is:

`import torch
import torchvision.transforms as transforms
import cv2

normalize = transforms.Normalize(
mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]
)

transform=transforms.Compose([
transforms.ToTensor(),
normalize,
])

IMAGE = "/home/oem/images/image1.jpg"

image = cv2.imread(IMAGE)

resized = cv2.resize(image, (640,640), interpolation = cv2.INTER_AREA)

model = torch.hub.load('hustvl/yolop', 'yolop', pretrained=True)

img = torch.unsqueeze(transform(resized), dim=0)

det_out, da_seg_out,ll_seg_out = model(img)`

Thanks!!

@sachinkum0009
Copy link

You might want to check the tools/demo.py file which uses the show_seg_result function to show the result.

def show_seg_result(img, result, index, epoch, save_dir=None, is_ll=False,palette=None,is_demo=False,is_gt=False):

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