예제 #1
0
파일: evaluate.py 프로젝트: lyu-xg/drqn
    def run_scenario():  # returns total reward
        reset(env, frame_buf)
        terminal, total_r = 0, 0

        while not terminal:
            Q = model.predict([[frame_buf.toarray()],
                               np.ones((1, env.action_space.n))])
            optimal_action = np.argmax(Q)

            r, terminal = step_multiple(env,
                                        optimal_action,
                                        frame_buf,
                                        6,
                                        clip=False)
            total_r += r

            if is_render: env.render()
        return total_r
예제 #2
0
    reset_formants = args.formant_reset
    directories = [
        x for x in os.listdir(base_dir) if os.path.isdir(x) and x != 'Common'
    ]

    if args.corpus_name not in directories:
        print(
            'The corpus {0} does not have a directory (available: {1}).  Please make it with a {0}.yaml file inside.'
            .format(args.corpus_name, ', '.join(directories)))
        sys.exit(1)
    corpus_conf = common.load_config(corpus_name)
    print('Processing...')

    ignored_speakers = corpus_conf.get('ignore_speakers', [])
    if reset:
        common.reset(corpus_name)
    ip = common.server_ip
    if docker:
        ip = common.docker_ip
    with ensure_local_database_running(corpus_name,
                                       ip=ip,
                                       port=common.server_port,
                                       token=common.load_token()) as params:
        print(params)
        config = CorpusConfig(corpus_name, **params)
        config.formant_source = 'praat'
        # Common set up

        common.loading(config, corpus_conf['corpus_directory'],
                       corpus_conf['input_format'])
예제 #3
0
    if args.corpus_name not in directories:
        print(
            'The corpus {0} does not have a directory (available: {1}).  Please make it with a {0}.yaml file inside.'
            .format(args.corpus_name, ', '.join(directories)))
        sys.exit(1)
    corpus_conf = common.load_config(corpus_name)
    print('Processing...')
    with ensure_local_database_running(corpus_name) as params:
        print(params)
        config = CorpusConfig(corpus_name, **params)
        config.formant_source = 'praat'
        with CorpusContext(config) as c:
            print(c.hierarchy)
        # Common set up
        if reset:
            common.reset(config)
        common.loading(config, corpus_conf['corpus_directory'],
                       corpus_conf['input_format'])

        common.lexicon_enrichment(config,
                                  corpus_conf['unisyn_spade_directory'],
                                  corpus_conf['dialect_code'])
        common.speaker_enrichment(config,
                                  corpus_conf['speaker_enrichment_file'])

        common.basic_enrichment(
            config, corpus_conf['vowel_inventory'] +
            corpus_conf['extra_syllabic_segments'], corpus_conf['pauses'])

        common.basic_queries(config)