Upgrade insightface #447
No files matched your search
@@ -49,7 +49,7 @@ class Face_detect_crop:
|
|||||||
|
|
||||||
|
|
||||||
def prepare(self, ctx_id, det_thresh=0.5, det_size=(640, 640), mode ='None'):
|
def prepare(self, ctx_id, det_thresh=0.5, det_size=(640, 640), mode ='None'):
|
||||||
self.det_thresh = det_thresh
|
self.det_model.det_thresh = det_thresh
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
assert det_size is not None
|
assert det_size is not None
|
||||||
print('set det-size:', det_size)
|
print('set det-size:', det_size)
|
||||||
@@ -62,7 +62,6 @@ class Face_detect_crop:
|
|||||||
|
|
||||||
def get(self, img, crop_size, max_num=0):
|
def get(self, img, crop_size, max_num=0):
|
||||||
bboxes, kpss = self.det_model.detect(img,
|
bboxes, kpss = self.det_model.detect(img,
|
||||||
threshold=self.det_thresh,
|
|
||||||
max_num=max_num,
|
max_num=max_num,
|
||||||
metric='default')
|
metric='default')
|
||||||
if bboxes.shape[0] == 0:
|
if bboxes.shape[0] == 0:
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class Face_detect_crop:
|
|||||||
|
|
||||||
|
|
||||||
def prepare(self, ctx_id, det_thresh=0.5, det_size=(640, 640), mode ='None'):
|
def prepare(self, ctx_id, det_thresh=0.5, det_size=(640, 640), mode ='None'):
|
||||||
self.det_thresh = det_thresh
|
self.det_model.det_thresh = det_thresh
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
assert det_size is not None
|
assert det_size is not None
|
||||||
print('set det-size:', det_size)
|
print('set det-size:', det_size)
|
||||||
@@ -62,7 +62,6 @@ class Face_detect_crop:
|
|||||||
|
|
||||||
def get(self, img, crop_size, max_num=0):
|
def get(self, img, crop_size, max_num=0):
|
||||||
bboxes, kpss = self.det_model.detect(img,
|
bboxes, kpss = self.det_model.detect(img,
|
||||||
threshold=self.det_thresh,
|
|
||||||
max_num=max_num,
|
max_num=max_num,
|
||||||
metric='default')
|
metric='default')
|
||||||
if bboxes.shape[0] == 0:
|
if bboxes.shape[0] == 0:
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ class fsModel(BaseModel):
|
|||||||
|
|
||||||
# Id network
|
# Id network
|
||||||
netArc_checkpoint = opt.Arc_path
|
netArc_checkpoint = opt.Arc_path
|
||||||
netArc_checkpoint = torch.load(netArc_checkpoint, map_location=torch.device("cpu"))
|
netArc_checkpoint = torch.load(netArc_checkpoint, map_location=torch.device("cpu"), weights_only=False)
|
||||||
self.netArc = netArc_checkpoint
|
self.netArc = netArc_checkpoint
|
||||||
self.netArc = self.netArc.to(device)
|
self.netArc = self.netArc.to(device)
|
||||||
self.netArc.eval()
|
self.netArc.eval()
|
||||||
|
|||||||
@@ -154,9 +154,9 @@ def reverse2wholeimage(b_align_crop_tenor_list,swaped_imgs, mats, crop_size, ori
|
|||||||
# target_image_parsing = postprocess(target_image, source_image, tgt_mask)
|
# target_image_parsing = postprocess(target_image, source_image, tgt_mask)
|
||||||
|
|
||||||
if use_mask:
|
if use_mask:
|
||||||
target_image = np.array(target_image, dtype=np.float) * 255
|
target_image = np.array(target_image, dtype=np.float32) * 255
|
||||||
else:
|
else:
|
||||||
target_image = np.array(target_image, dtype=np.float)[..., ::-1] * 255
|
target_image = np.array(target_image, dtype=np.float32)[..., ::-1] * 255
|
||||||
|
|
||||||
|
|
||||||
img_mask_list.append(img_mask)
|
img_mask_list.append(img_mask)
|
||||||
@@ -165,7 +165,7 @@ def reverse2wholeimage(b_align_crop_tenor_list,swaped_imgs, mats, crop_size, ori
|
|||||||
|
|
||||||
# target_image /= 255
|
# target_image /= 255
|
||||||
# target_image = 0
|
# target_image = 0
|
||||||
img = np.array(oriimg, dtype=np.float)
|
img = np.array(oriimg, dtype=np.float32)
|
||||||
for img_mask, target_image in zip(img_mask_list, target_image_list):
|
for img_mask, target_image in zip(img_mask_list, target_image_list):
|
||||||
img = img_mask * target_image + (1-img_mask) * img
|
img = img_mask * target_image + (1-img_mask) * img
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user