We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
import cv2 import torch import torchvision.transforms as transforms
model = torch.load("hrnetv2_w18_imagenet_pretrained.pth")
image = cv2.imread("images.jpg") image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # Convert BGR to RGB image = transforms.ToTensor()(image) # Convert image to tensor image = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])(image) # Normalize the image
output = model.forward(image)
I try something like these, but it doens't work, how to use the pre-trained model directly and detect the face in a image?
Thank you
The text was updated successfully, but these errors were encountered:
No branches or pull requests
import cv2
import torch
import torchvision.transforms as transforms
Load the pre-trained model
model = torch.load("hrnetv2_w18_imagenet_pretrained.pth")
Load and preprocess the input image
image = cv2.imread("images.jpg")
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # Convert BGR to RGB
image = transforms.ToTensor()(image) # Convert image to tensor
image = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])(image) # Normalize the image
Run the inference
output = model.forward(image)
I try something like these, but it doens't work, how to use the pre-trained model directly and detect the face in a image?
Thank you
The text was updated successfully, but these errors were encountered: