How to use the sidekit.Key.read_txt function in SIDEKIT

To help you get started, we’ve selected a few SIDEKIT examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Anwarvic / Speaker-Recognition / ubm.py View on Github external
def plotDETcurve(self):
        """
        This method is used to plot the DET (Detection Error Tradeoff) and 
        save it on the disk.
        """
        # Read test scores
        filename = "ubm_scores_{}.h5".format(self.NUM_GAUSSIANS)
        scores_dir = os.path.join(self.BASE_DIR, "result", filename)
        scores_gmm_ubm = sidekit.Scores.read(scores_dir)
        # Read the key
        key = sidekit.Key.read_txt(os.path.join(self.BASE_DIR, "task", "test_trials.txt"))

        # Make DET plot
        logging.info("Drawing DET Curve")
        dp = sidekit.DetPlot(window_style='sre10', plot_title='Scores GMM-UBM')
        dp.set_system_from_scores(scores_gmm_ubm, key, sys_name='GMM-UBM')
        dp.create_figure()
        # DET type
        if self.conf['DET_curve'] == "rocch":
            dp.plot_rocch_det(idx=0)
        elif self.conf['DET_curve'] == "steppy":
            dp.plot_steppy_det(idx=0)
        else:
            raise NameError("Unsupported DET-curve-plotting method!!")
        dp.plot_DR30_both(idx=0) #dotted line for Doddington's Rule
        prior = sidekit.logit_effective_prior(0.001, 1, 1)
        dp.plot_mindcf_point(prior, idx=0) #minimum dcf point
github Anwarvic / Speaker-Recognition / data_init.py View on Github external
def create_Ndx(self):
        """
        Key are used to store information about which trial is a target trial
        and which one is a non-target (or impostor) trial. tar(i,j) is true
        if the test between model i and segment j is target. non(i,j) is true
        if the test between model i and segment j is non-target.
        """
        #Define Key and Ndx from text file
        #SEE: https://projets-lium.univ-lemans.fr/sidekit/_modules/sidekit/bosaris/key.html
        key = sidekit.Key.read_txt(os.path.join(self.task_dir, "test_trials.txt"))
        ndx = key.to_ndx()
        if ndx.validate():
            ndx.write(os.path.join(self.task_dir, 'test_ndx.h5'))
        else:
            raise RuntimeError('Problems with creating idMap file')