def __init__(self, labelfile, imagesdir, mean, std, width=800, height=800):

        self.width = width
        self.height = height
        self.items = common.load_webface(labelfile, imagesdir)
        self.mean = mean
        self.std = std
Exemple #2
0
# create logger
trial_name = "small-H-dense-wide64-UCBA"
jobdir = f"jobs/{trial_name}"
log = logger.create(trial_name, f"{jobdir}/logs/eval.log")

# load and init model
model = DBFace(has_landmark=True, wide=64, has_ext=True, upmode="UCBA")
model.load(f"{jobdir}/models/150.pth")
model.eval()
model.cuda()

# load dataset
mean = [0.408, 0.447, 0.47]
std = [0.289, 0.274, 0.278]
files, anns = zip(
    *common.load_webface("webface/val/label.txt", "webface/WIDER_val/images"))

# forward and summary
prefix = "webface/WIDER_val/images/"
all_result_dict = {}
total_file = len(files)

for i in range(total_file):

    # preper key and file_name
    file = files[i]
    key = file[len(prefix):file.rfind("/")]
    file_name = common.file_name_no_suffix(file)

    # load image and forward
    image = common.imread(file)