Exemple #1
0
    def __init__(self, dictionary, mode):
        """
        Initial the Retrival Object, including parameters (sample rate, hashing density,
        freqency offset, number of keys used in hashing) and initializing hashing table.
        """
        self.sr = 8000
        # the target hashes-per-sec
        self.density = 20
        # number of hash keys are corresponded to the composition of landmarks
        # They are <freq-bin number, delta frequency, delta time span>
        self.nkey = 3
        # The fist two elements relate with spectrumgram and FFT bands
        # The last is relevant with the targetdt in find_landmarks
        # The calculate of hashlength is log2(original value)
        self.hashlength = [8,6,8]
        # time span for sampling
        self.hopt = 0.01
        # Configures for extract time slot from database
        self.window = 4500      # extract features within 45s
        self.step = 20          # the searching step is 200ms
        # load the trained SVM classifier
        self.svm = LibSvm.load_model("svm.model")
        # Take frequncy offset into consideration
        self.freqoffset = 4

        self.numoftable = 10
        self.dict = dictionary
        self.mode = mode