def __init__(self, select_largest=False, keep_all=True): self.pnet = PNet().to(device) self.rnet = RNet().to(device) self.onet = ONet().to(device) self.pnet.eval() self.rnet.eval() self.onet.eval() self.refrence = get_reference_facial_points(default_square=True)
def __init__(self): self.pnet = PNet().to(device) self.rnet = RNet().to(device) self.onet = ONet().to(device) self.pnet.eval() self.rnet.eval() self.onet.eval() self.refrence = get_reference_facial_points(default_square=True)
def __init__(self, device='cpu'): self.device = torch.device("cuda:0" if device == 'cuda' else "cpu") self.pnet = PNet().to(device) self.rnet = RNet().to(device) self.onet = ONet().to(device) self.pnet.eval() self.rnet.eval() self.onet.eval() self.refrence = get_reference_facial_points(default_square=True)
def __init__(self, weight_path='mtcnn_pytorch/src/weights'): self.device = torch.device( "cuda" if torch.cuda.is_available() else "cpu") self.pnet = PNet(weight_path).to(self.device) self.rnet = RNet(weight_path).to(self.device) self.onet = ONet(weight_path).to(self.device) self.pnet.eval() self.rnet.eval() self.onet.eval() self.refrence = get_reference_facial_points(default_square=True)
def __init__(self, device=devi, thresholds=[0.3, 0.6, 0.8], nms_thresholds=[0.6, 0.6, 0.6]): self.pnet = PNet().to(device) self.rnet = RNet().to(device) self.onet = ONet().to(device) self.onet.eval() self.rnet.eval() self.onet.eval() self.refrence = get_reference_facial_points(default_square=True) self.device = device self.thresholds = thresholds self.nms_thresholds = nms_thresholds
def __init__(self): self.pnet = PNet() self.rnet = RNet() self.onet = ONet() self.onet.eval()
from mtcnn_pytorch.src.get_nets import PNet, RNet, ONet import torch from PIL import Image from config import get_config # model definitions in get_nets.py if __name__ == '__main__': conf = get_config(False) device = 'gpu' # P-Net model = PNet().to(device) # to device model.eval() # to eval mode example = torch.ones([1, 3, 100, 300]).to(device) traced = torch.jit.trace(model, example) traced.save(str(conf.save_path / 'pnet-gpu.pt')) a, b = model(example) print('P-Net') print('Input size {}'.format( example.size())) # torch.Size([1, 3, 112, 112]) print('A size {}'.format(a.size())) # torch.Size([1, 4, 51, 51]) print('B size {}'.format(b.size())) # torch.Size([1, 2, 51, 51]) # R-Net model = RNet().to(device) # to device model.eval() # to eval mode example = torch.ones([1, 3, 24, 24]).to(device)