Hi, the segmentation seems better than commonly used Bisenet, espectially it is not limited to crop - which is great. But I see artifacs (wide vertical line) on some images like this:
The problem is that I inferenced on video which I cannot share and there those artifacts are quite frequent:
Is there any way to deal with them?
My code:
import sys
import torch
from PIL import Image
import numpy as np
#sys.path.append('..')
device = 'cuda' if torch.cuda.is_available() else 'cpu'
import facer
image = facer.hwc2bchw(facer.read_hwc('girls.jpg')).to(device=device) # image: 1 x 3 x h x w
face_detector = facer.face_detector('retinaface/mobilenet', device=device)
faces = face_detector(image)
face_parser = facer.face_parser('farl/lapa/448', device=device)
with torch.inference_mode():
faces = face_parser(image, faces)
seg_logits = faces['seg']['logits']
seg_probs = seg_logits.softmax(dim=1) # nfaces x nclasses x h x w
print(seg_probs.shape)
from facer.util import bchw2hwc
out = facer.draw_bchw(image, faces)
print(out.shape)
image = bchw2hwc(out)
if image.dtype != torch.uint8:
image = image.to(torch.uint8)
if image.size(2) == 1:
image = image.repeat(1, 1, 3)
pimage = Image.fromarray(image.cpu().numpy())
pimage.save('out.png')
Hi, the segmentation seems better than commonly used Bisenet, espectially it is not limited to crop - which is great. But I see artifacs (wide vertical line) on some images like this:
The problem is that I inferenced on video which I cannot share and there those artifacts are quite frequent:
Is there any way to deal with them?
My code: