Exemplo n.º 1
0
import numpy as np
from utils.dvector_tool import *
import os
import utils.dvector_io as dvector_io
import sys


def eer(trials, enroll_dict, transform_mat, test_dict=None):
    if test_dict == None:
        eer, eer_th = compute_eer(trials, enroll_dict, enroll_dict,
                                  transform_mat)
        print("eer: %.4f, threshold: %.4f" % (eer, eer_th))
    else:
        eer, eer_th = compute_eer(trials, enroll_dict, test_dict,
                                  transform_mat)
        print("eer: %.4f, threshold: %.4f" % (eer, eer_th))


if __name__ == "__main__":
    if len(sys.argv) != 4:
        print("Usage: " + sys.argv[0] +
              " <trials:string> <test-dvector:string> <transform_mat:string>")
        exit(1)
    trials = sys.argv[1]
    test_dvector = sys.argv[2]
    transform_mat_file = sys.argv[3]
    test_dict = dvector_io.read_vec(test_dvector)
    print(len(test_dict))
    transform_mat = np.load(transform_mat_file)
    eer(trials, test_dict, transform_mat)
Exemplo n.º 2
0
from utils.dvector_tool import compute_eer
import os
import utils.dvector_io as dvector_io
import sys

def eer(trials, enroll_dict, test_dict=None):
    if test_dict == None:
        eer, eer_th = compute_eer(trials, enroll_dict, enroll_dict)
        print("eer: %.4f, threshold: %.4f" % (eer, eer_th))
    else:
        eer, eer_th = compute_eer(trials, enroll_dict, test_dict)
        print("eer: %.4f, threshold: %.4f" % (eer, eer_th))



if __name__ == "__main__":
    if len(sys.argv) < 3 or len(sys.argv) > 4:
        print("Usage: " + sys.argv[0] + " <trials:string> <enroll_file:string> [<test_file:string>]")
        exit(1)
    trials = sys.argv[1]
    if len(sys.argv) == 3:
        enroll_file = sys.argv[2]
        enroll_dict = dvector_io.read_vec(enroll_file)
        eer(trials, enroll_dict)
    else:
        enroll_file = sys.argv[2]
        test_file = sys.argv[3]
        enroll_dict = dvector_io.read_vec(enroll_file)
        test_dict = dvector_io.read_vec(test_file)
        eer(trials, enroll_dict, test_dict)
Exemplo n.º 3
0
#!/usr/bin/env python2.7
#coding=utf-8

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import time
import tables as tb
import numpy as np
from utils.dvector_tool import compute_eer
import os
import utils.dvector_io as dvector_io
import sys
import model.score_model as sc_model

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("Usage: " + sys.argv[0] + " <train_dvector:string>" + " <number of vector:int>")
        exit(1)
    train_file = sys.argv[1]
    k = int(sys.argv[2])
    train_dict = dvector_io.read_vec(train_file)
    P = sc_model.matrix_eig(train_dict, k)
    np.save("eig.mat", P)