def main(argv): numpy.random.seed(123456) # let's make randomization predictable parser = argparse.ArgumentParser( prefix_chars='-+', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent('''\ DCASE 2017 Task 3: Sound Event Detection in Real-life Audio Baseline System --------------------------------------------- Tampere University of Technology / Audio Research Group Author: Toni Heittola ( [email protected] ) System description This is an baseline implementation for the D-CASE 2016, task 3 - Sound event detection in real life audio. The system has binary classifier for each included sound event class. The GMM classifier is trained with the positive and negative examples from the mixture signals, and classification is done between these two models as likelihood ratio. Acoustic features are MFCC+Delta+Acceleration (MFCC0 omitted). ''')) # Setup argument handling parser.add_argument('-m', '--mode', choices=('dev', 'challenge'), default=None, help="Selector for system mode", required=False, dest='mode', type=str) parser.add_argument('-p', '--parameters', help='parameter file override', dest='parameter_override', required=False, metavar='FILE', type=argument_file_exists) parser.add_argument('-s', '--parameter_set', help='Parameter set id', dest='parameter_set', required=False, type=str) parser.add_argument("-n", "--node", help="Node mode", dest="node_mode", action='store_true', required=False) parser.add_argument("-show_sets", help="List of available parameter sets", dest="show_set_list", action='store_true', required=False) parser.add_argument("-show_datasets", help="List of available datasets", dest="show_dataset_list", action='store_true', required=False) parser.add_argument("-show_parameters", help="Show parameters", dest="show_parameters", action='store_true', required=False) parser.add_argument("-o", "--overwrite", help="Overwrite mode", dest="overwrite", action='store_true', required=False) parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + __version__) # Parse arguments args = parser.parse_args() # Load default parameters from a file default_parameters_filename = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'parameters', os.path.splitext(os.path.basename(__file__))[0] + '.defaults.yaml') if args.parameter_set: parameters_sets = args.parameter_set.split(',') else: parameters_sets = [None] for parameter_set in parameters_sets: # Initialize ParameterContainer params = ParameterContainer( project_base=os.path.dirname(os.path.realpath(__file__))) # Load default parameters from a file params.load(filename=default_parameters_filename) if args.parameter_override: # Override parameters from a file params.override(override=args.parameter_override) if parameter_set: # Override active_set params['active_set'] = parameter_set # Process parameters params.process() # Force overwrite if args.overwrite: params['general']['overwrite'] = True # Override dataset mode from arguments if args.mode == 'dev': # Set dataset to development params['dataset']['method'] = 'development' # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters(section='dataset') elif args.mode == 'challenge': # Set dataset to training set for challenge params['dataset']['method'] = 'challenge_train' params['general']['challenge_submission_mode'] = True # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters(section='dataset') if args.node_mode: params['general']['log_system_progress'] = True params['general']['print_system_progress'] = False # Setup logging setup_logging(parameter_container=params['logging']) app = Task3AppCore( name= 'DCASE 2017::Sound Event Detection in Real-life Audio / Baseline System', params=params, system_desc=params.get('description'), system_parameter_set_id=params.get('active_set'), setup_label='Development setup', log_system_progress=params.get_path('general.log_system_progress'), show_progress_in_console=params.get_path( 'general.print_system_progress'), ) # Show parameter set list and exit if args.show_set_list: params_ = ParameterContainer( project_base=os.path.dirname(os.path.realpath(__file__))).load( filename=default_parameters_filename) if args.parameter_override: # Override parameters from a file params_.override(override=args.parameter_override) if 'sets' in params_: app.show_parameter_set_list(set_list=params_['sets']) return # Show dataset list and exit if args.show_dataset_list: app.show_dataset_list() return # Show system parameters if params.get_path( 'general.log_system_parameters') or args.show_parameters: app.show_parameters() # Initialize application # ================================================== if params['flow']['initialize']: app.initialize() # Extract features for all audio files in the dataset # ================================================== if params['flow']['extract_features']: app.feature_extraction() # Prepare feature normalizers # ================================================== if params['flow']['feature_normalizer']: app.feature_normalization() # System training # ================================================== if params['flow']['train_system']: app.system_training() # System evaluation in development mode if not args.mode or args.mode == 'dev': # System testing # ================================================== if params['flow']['test_system']: app.system_testing() # System evaluation # ================================================== if params['flow']['evaluate_system']: app.system_evaluation() # System evaluation with challenge data elif args.mode == 'challenge': # Set dataset to testing set for challenge params['dataset']['method'] = 'challenge_test' # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters('dataset') if params['general']['challenge_submission_mode']: # If in submission mode, save results in separate folder for easier access params['path']['recognizer'] = params.get_path( 'path.recognizer_challenge_output') challenge_app = Task3AppCore( name= 'DCASE 2017::Sound Event Detection in Real-life Audio / Baseline System', params=params, system_desc=params.get('description'), system_parameter_set_id=params.get('active_set'), setup_label='Evaluation setup') # Initialize application if params['flow']['initialize']: challenge_app.initialize() # Extract features for all audio files in the dataset if params['flow']['extract_features']: challenge_app.feature_extraction() # System testing if params['flow']['test_system']: if params['general']['challenge_submission_mode']: params['general']['overwrite'] = True challenge_app.system_testing() if params['general']['challenge_submission_mode']: challenge_app.ui.line(" ") challenge_app.ui.line( "Results for the challenge data are stored at [" + params['path']['recognizer_challenge_output'] + "]") challenge_app.ui.line(" ") # System evaluation if params['flow']['evaluate_system']: challenge_app.system_evaluation() return 0
def main(argv): numpy.random.seed(123456) # let's make randomization predictable parser = argparse.ArgumentParser( prefix_chars='-+', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent('''\ DCASE 2017 Task 2: Rare Sound Event Detection A custom learner where you can create FNNs, CNNs, RNNs and CRNNs of any size and depth Code used in the paper: Convolutional Recurrent Neural Networks for Rare Sound Event Detection (Emre Cakir, Tuomas Virtanen) http://www.cs.tut.fi/sgn/arg/dcase2017/documents/challenge_technical_reports/DCASE2017_Cakir_104.pdf --------------------------------------------- Tampere University of Technology / Audio Research Group Author: Emre Cakir ( [email protected] ) ''')) # Setup argument handling parser.add_argument('-m', '--mode', choices=('dev', 'challenge'), default=None, help="Selector for system mode", required=False, dest='mode', type=str) parser.add_argument('-p', '--parameters', help='parameter file override', dest='parameter_override', required=False, metavar='FILE', type=argument_file_exists) parser.add_argument('-s', '--parameter_set', help='Parameter set id', dest='parameter_set', required=False, type=str) parser.add_argument("-n", "--node", help="Node mode", dest="node_mode", action='store_true', required=False) parser.add_argument("-show_sets", help="List of available parameter sets", dest="show_set_list", action='store_true', required=False) parser.add_argument("-show_datasets", help="List of available datasets", dest="show_dataset_list", action='store_true', required=False) parser.add_argument("-show_parameters", help="Show parameters", dest="show_parameters", action='store_true', required=False) parser.add_argument("-show_eval", help="Show evaluated setups", dest="show_eval", action='store_true', required=False) parser.add_argument("-o", "--overwrite", help="Overwrite mode", dest="overwrite", action='store_true', required=False) parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + __version__) # Parse arguments args = parser.parse_args() # Load default parameters from a file default_parameters_filename = os.path.join( os.path.dirname(os.path.realpath(__file__)), os.path.splitext(os.path.basename(__file__))[0] + '.defaults.yaml') if args.parameter_set: parameters_sets = args.parameter_set.split(',') else: parameters_sets = [None] for parameter_set in parameters_sets: # Initialize ParameterContainer params = ParameterContainer( project_base=os.path.dirname(os.path.realpath(__file__)), path_structure={ 'feature_extractor': ['dataset', 'feature_extractor.parameters.*'], 'feature_normalizer': ['dataset', 'feature_extractor.parameters.*'], 'learner': [ 'dataset', 'feature_extractor', 'feature_normalizer', 'feature_aggregator', 'learner' ], 'recognizer': [ 'dataset', 'feature_extractor', 'feature_normalizer', 'feature_aggregator', 'learner', 'recognizer' ], }) # Load default parameters from a file params.load(filename=default_parameters_filename) if args.parameter_override: # Override parameters from a file params.override(override=args.parameter_override) if parameter_set: # Override active_set params['active_set'] = parameter_set # Process parameters params.process() # Force overwrite if args.overwrite: params['general']['overwrite'] = True # Override dataset mode from arguments if args.mode == 'dev': # Set dataset to development params['dataset']['method'] = 'development' # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters(section='dataset') elif args.mode == 'challenge': # Set dataset to training set for challenge params['dataset']['method'] = 'challenge_train' params['general']['challenge_submission_mode'] = True # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters(section='dataset') if args.node_mode: params['general']['log_system_progress'] = True params['general']['print_system_progress'] = False # Force ascii progress bar under Windows console if platform.system() == 'Windows': params['general']['use_ascii_progress_bar'] = True # Setup logging setup_logging(parameter_container=params['logging']) app = CustomAppCore( name= 'DCASE 2017::Rare Sound Event Detection / Custom Multifunctional Deep Learning', params=params, system_desc=params.get('description'), system_parameter_set_id=params.get('active_set'), setup_label='Development setup', log_system_progress=params.get_path('general.log_system_progress'), show_progress_in_console=params.get_path( 'general.print_system_progress'), use_ascii_progress_bar=params.get_path( 'general.use_ascii_progress_bar')) # Show parameter set list and exit if args.show_set_list: params_ = ParameterContainer( project_base=os.path.dirname(os.path.realpath(__file__))).load( filename=default_parameters_filename) if args.parameter_override: # Override parameters from a file params_.override(override=args.parameter_override) if 'sets' in params_: app.show_parameter_set_list(set_list=params_['sets']) return # Show dataset list and exit if args.show_dataset_list: app.show_dataset_list() return # Show system parameters if params.get_path( 'general.log_system_parameters') or args.show_parameters: app.show_parameters() # Show evaluated systems if args.show_eval: app.show_eval() return # Initialize application # ================================================== if params['flow']['initialize']: app.initialize() # Extract features for all audio files in the dataset # ================================================== if params['flow']['extract_features']: app.feature_extraction() # Prepare feature normalizers # ================================================== if params['flow']['feature_normalizer']: app.feature_normalization() # System training # ================================================== if params['flow']['train_system']: app.system_training() # System evaluation if not args.mode or args.mode == 'dev': # System testing # ================================================== if params['flow']['test_system']: app.system_testing() # System evaluation # ================================================== if params['flow']['evaluate_system']: app.system_evaluation() # System evaluation in challenge mode elif args.mode == 'challenge': # Set dataset to testing set for challenge params['dataset']['method'] = 'challenge_test' # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters('dataset') if params['general']['challenge_submission_mode']: # If in submission mode, save results in separate folder for easier access params['path']['recognizer'] = params.get_path( 'path.recognizer_challenge_output') challenge_app = CustomAppCore( name= 'DCASE 2017::Rare Sound Event Detection / Custom Multifunctional Deep Learning', params=params, system_desc=params.get('description'), system_parameter_set_id=params.get('active_set'), setup_label='Evaluation setup', log_system_progress=params.get_path( 'general.log_system_progress'), show_progress_in_console=params.get_path( 'general.print_system_progress'), use_ascii_progress_bar=params.get_path( 'general.use_ascii_progress_bar')) # Initialize application if params['flow']['initialize']: challenge_app.initialize() # Extract features for all audio files in the dataset if params['flow']['extract_features']: challenge_app.feature_extraction() # System testing if params['flow']['test_system']: if params['general']['challenge_submission_mode']: params['general']['overwrite'] = True challenge_app.system_testing() if params['general']['challenge_submission_mode']: challenge_app.ui.line(" ") challenge_app.ui.line( "Results for the challenge are stored at [" + params.get_path('path.recognizer_challenge_output') + "]") challenge_app.ui.line(" ") # System evaluation if not in challenge submission mode if params['flow']['evaluate_system']: challenge_app.system_evaluation() return 0
def main(argv): numpy.random.seed(123456) # let's make randomization predictable parser = argparse.ArgumentParser( prefix_chars='-+', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent( ''' DCASE 2017 Task 2: Detection of rare sound events Baseline System ''' )) # Setup argument handling parser.add_argument('-m', '--mode', choices=('dev', 'challenge'), default='challenge', help="Selector for system mode", required=False, dest='mode', type=str) parser.add_argument("-o", "--overwrite", choices=('true', 'false'), default='false', help="Overwrite exsiting files", dest="overwrite", required=False) parser.add_argument("-gpu", "--gpu", default=0, help="choose which gpu to use", required=True) # Parse arguments args = parser.parse_args() # set GPU number os.environ['CUDA_VISIBLE_DEVICES'] = args.gpu # Load default parameters from a file default_parameters_filename = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'parameters/task2.defaults.yaml') # Initialize ParameterContainer params = ParameterContainer( project_base=os.path.dirname(os.path.realpath(__file__)), path_structure={ 'feature_extractor': ['dataset', 'feature_extractor.parameters.*'], 'feature_normalizer': ['dataset', 'feature_extractor.parameters.*'], 'learner': [ 'dataset', 'feature_extractor', 'feature_stacker', 'feature_normalizer', 'feature_aggregator', 'learner' ], 'recognizer': [ 'dataset', 'feature_extractor', 'feature_stacker', 'feature_normalizer', 'feature_aggregator', 'learner', 'recognizer' ], }) # Load default parameters from a file params.load(filename=default_parameters_filename) # Process parameters params.process() # Force overwrite if args.overwrite == 'true': params['general']['overwrite'] = True # Override dataset mode from arguments if args.mode == 'dev': # Set dataset to development params['dataset']['method'] = 'development' # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters(section='dataset') elif args.mode == 'challenge': # Set dataset to training set for challenge params['dataset']['method'] = 'challenge_train' params['general']['challenge_submission_mode'] = True # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters(section='dataset') # Setup logging setup_logging(parameter_container=params['logging']) app = Task2AppCore( name='DCASE 2017::Detection of rare sound events / Baseline System', params=params, system_desc=params.get('description'), system_parameter_set_id=params.get('active_set'), setup_label='Development setup', log_system_progress=params.get_path('general.log_system_progress'), show_progress_in_console=params.get_path( 'general.print_system_progress'), use_ascii_progress_bar=params.get_path( 'general.use_ascii_progress_bar')) # Initialize application # ================================================== if params['flow']['initialize']: app.initialize() # Extract features for all audio files in the dataset # ================================================== if params['flow']['extract_features']: app.feature_extraction() # Prepare feature normalizers # ================================================== if params['flow']['feature_normalizer']: app.feature_normalization() # System training # ================================================== if params['flow']['train_system']: app.system_training() # System evaluation in development mode if not args.mode or args.mode == 'dev': # System testing # ================================================== if params['flow']['test_system']: app.system_testing() # System evaluation # ================================================== if params['flow']['evaluate_system']: app.system_evaluation() # System evaluation with challenge data elif args.mode == 'challenge': # Set dataset to testing set for challenge params['dataset']['method'] = 'challenge_test' # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters('dataset') if params['general']['challenge_submission_mode']: # If in submission mode, save results in separate folder for easier access params['path']['recognizer'] = params.get_path( 'path.recognizer_challenge_output') challenge_app = Task2AppCore( name='DCASE 2017::Detection of rare sound events / Baseline System', params=params, system_desc=params.get('description'), system_parameter_set_id=params.get('active_set'), setup_label='Evaluation setup', log_system_progress=params.get_path('general.log_system_progress'), show_progress_in_console=params.get_path( 'general.print_system_progress'), use_ascii_progress_bar=params.get_path( 'general.use_ascii_progress_bar')) # Initialize application if params['flow']['initialize']: challenge_app.initialize() # Extract features for all audio files in the dataset if params['flow']['extract_features']: challenge_app.feature_extraction() # System testing if params['flow']['test_system']: if params['general']['challenge_submission_mode']: params['general']['overwrite'] = True challenge_app.system_testing(single_file_per_fold=True) if params['general']['challenge_submission_mode']: challenge_app.ui.line(" ") challenge_app.ui.line( "Results for the challenge data are stored at [" + params['path']['recognizer_challenge_output'] + "]") challenge_app.ui.line(" ") # System evaluation if not in challenge submission mode if params['flow']['evaluate_system']: challenge_app.system_evaluation(single_file_per_fold=True) return 0
def main(argv): numpy.random.seed(123456) # let's make randomization predictable parser = argparse.ArgumentParser( prefix_chars='-+', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent('''\ DCASE 2017 Task 4: Large-scale weakly supervised sound event detection for smart cars --------------------------------------------- Carnegie Mellon University Author: Rohan Badlani ( [email protected] ) System description The baseline system for task 4 in DCASE 2017 Challenge. Features: log mel-band energies Classifier: MLP ''')) # Setup argument handling parser.add_argument('-m', '--mode', choices=('dev', 'challenge'), default=None, help="Selector for system mode", required=False, dest='mode', type=str) parser.add_argument('-p', '--parameters', help='parameter file override', dest='parameter_override', required=False, metavar='FILE', type=argument_file_exists) parser.add_argument('-s', '--parameter_set', help='Parameter set id', dest='parameter_set', required=False, type=str) parser.add_argument("-n", "--node", help="Node mode", dest="node_mode", action='store_true', required=False) parser.add_argument("-show_sets", help="List of available parameter sets", dest="show_set_list", action='store_true', required=False) parser.add_argument("-show_datasets", help="List of available datasets", dest="show_dataset_list", action='store_true', required=False) parser.add_argument("-show_parameters", help="Show parameters", dest="show_parameters", action='store_true', required=False) parser.add_argument("-show_eval", help="Show evaluated setups", dest="show_eval", action='store_true', required=False) parser.add_argument("-o", "--overwrite", help="Overwrite mode", dest="overwrite", action='store_true', required=False) parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + __version__) # Parse arguments args = parser.parse_args() # Load default parameters from a file default_parameters_filename = os.path.join( os.path.dirname(os.path.realpath(__file__)), os.path.splitext(os.path.basename(__file__))[0] + '.defaults.yaml') if args.parameter_set: parameters_sets = args.parameter_set.split(',') else: parameters_sets = [None] for parameter_set in parameters_sets: # Initialize ParameterContainer params = ParameterContainer( project_base=os.path.dirname(os.path.realpath(__file__))) # Load default parameters from a file params.load(filename=default_parameters_filename) if args.parameter_override: # Override parameters from a file params.override(override=args.parameter_override) if parameter_set: # Override active_set params['active_set'] = parameter_set # Process parameters params.process() # Force overwrite if args.overwrite: params['general']['overwrite'] = True # Override dataset mode from arguments if args.mode == 'dev': # Set dataset to development params['dataset']['method'] = 'development' # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters(section='dataset') elif args.mode == 'challenge': # Set dataset to training set for challenge params['dataset']['method'] = 'challenge_train' params['general']['challenge_submission_mode'] = True # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters(section='dataset') if args.node_mode: params['general']['log_system_progress'] = True params['general']['print_system_progress'] = False # Force ascii progress bar under Windows console if platform.system() == 'Windows': params['general']['use_ascii_progress_bar'] = True # Setup logging setup_logging(parameter_container=params['logging']) app = CustomAppCore( name='DCASE 2017::Acoustic Scene Classification / Baseline System', params=params, system_desc=params.get('description'), system_parameter_set_id=params.get('active_set'), setup_label='Development setup', log_system_progress=params.get_path('general.log_system_progress'), show_progress_in_console=params.get_path( 'general.print_system_progress'), use_ascii_progress_bar=params.get_path( 'general.use_ascii_progress_bar')) # Show parameter set list and exit if args.show_set_list: params_ = ParameterContainer( project_base=os.path.dirname(os.path.realpath(__file__))).load( filename=default_parameters_filename) if args.parameter_override: # Override parameters from a file params_.override(override=args.parameter_override) if 'sets' in params_: app.show_parameter_set_list(set_list=params_['sets']) return # Show dataset list and exit if args.show_dataset_list: app.show_dataset_list() return # Show system parameters if params.get_path( 'general.log_system_parameters') or args.show_parameters: app.show_parameters() # Show evaluated systems if args.show_eval: app.show_eval() return # Initialize application # ================================================== if params['flow']['initialize']: app.initialize() # Extract features for all audio files in the dataset # ================================================== if params['flow']['extract_features']: app.feature_extraction() # Prepare feature normalizers # ================================================== if params['flow']['feature_normalizer']: app.feature_normalization() # System training # ================================================== if params['flow']['train_system']: app.system_training() # System evaluation if not args.mode or args.mode == 'dev': # System testing # ================================================== if params['flow']['test_system']: app.system_testing() # System evaluation # ================================================== if params['flow']['evaluate_system']: app.system_evaluation() # System evaluation in challenge mode elif args.mode == 'challenge': # Set dataset to testing set for challenge params['dataset']['method'] = 'challenge_test' # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters('dataset') if params['general']['challenge_submission_mode']: # If in submission mode, save results in separate folder for easier access params['path']['recognizer'] = params.get_path( 'path.recognizer_challenge_output') challenge_app = CustomAppCore( name= 'DCASE 2017::Acoustic Scene Classification / Baseline System', params=params, system_desc=params.get('description'), system_parameter_set_id=params.get('active_set'), setup_label='Evaluation setup', log_system_progress=params.get_path( 'general.log_system_progress'), show_progress_in_console=params.get_path( 'general.print_system_progress'), use_ascii_progress_bar=params.get_path( 'general.use_ascii_progress_bar')) # Initialize application if params['flow']['initialize']: challenge_app.initialize() # Extract features for all audio files in the dataset if params['flow']['extract_features']: challenge_app.feature_extraction() # System testing if params['flow']['test_system']: if params['general']['challenge_submission_mode']: params['general']['overwrite'] = True challenge_app.system_testing() if params['general']['challenge_submission_mode']: challenge_app.ui.line(" ") challenge_app.ui.line( "Results for the challenge are stored at [" + params.get_path('path.recognizer_challenge_output') + "]") challenge_app.ui.line(" ") # System evaluation if not in challenge submission mode if params['flow']['evaluate_system']: challenge_app.system_evaluation() return 0
def main(argv): numpy.random.seed(123456) # let's make randomization predictable parser = argparse.ArgumentParser( prefix_chars='-+', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent('''\ DCASE 2017 Task 1: Acoustic Scene Classification Example how to customize applicationS --------------------------------------------- Tampere University of Technology / Audio Research Group Author: Toni Heittola ( [email protected] ) System description A system for acoustic scene classification, using DCASE 2013 Challenge evalution dataset. Features: mean and std of centroid + zero crossing rate inside 1 second non-overlapping segments Classifier: SVM ''')) # Setup argument handling parser.add_argument('-m', '--mode', choices=('dev', 'challenge'), default=None, help="Selector for system mode", required=False, dest='mode', type=str) parser.add_argument('-p', '--parameters', help='parameter file override', dest='parameter_override', required=False, metavar='FILE', type=argument_file_exists) parser.add_argument('-s', '--parameter_set', help='Parameter set id', dest='parameter_set', required=False, type=str) parser.add_argument("-n", "--node", help="Node mode", dest="node_mode", action='store_true', required=False) parser.add_argument("-show_sets", help="List of available parameter sets", dest="show_set_list", action='store_true', required=False) parser.add_argument("-show_datasets", help="List of available datasets", dest="show_dataset_list", action='store_true', required=False) parser.add_argument("-show_parameters", help="Show parameters", dest="show_parameters", action='store_true', required=False) parser.add_argument("-eval_path", help="path to save evaluation results", dest="eval_path", required=False, metavar="DIR") parser.add_argument("-o", "--overwrite", help="Overwrite mode", dest="overwrite", action='store_true', required=False) parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + __version__) # Parse arguments args = parser.parse_args() # Load default parameters from a file default_parameters_filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.splitext(os.path.basename(__file__))[0]+'.defaults.yaml') if args.parameter_set: parameters_sets = args.parameter_set.split(',') else: parameters_sets = [None] for parameter_set in parameters_sets: # Initialize ParameterContainer params = ParameterContainer(project_base=os.path.dirname(os.path.realpath(__file__))) # Load default parameters from a file params.load(filename=default_parameters_filename) if args.parameter_override: # Override parameters from a file params.override(override=args.parameter_override) if parameter_set: # Override active_set params['active_set'] = parameter_set # Process parameters params.process() # Force overwrite if args.overwrite: params['general']['overwrite'] = True # Override dataset mode from arguments if args.mode == 'dev': params['dataset']['method'] = 'development' # Set dataset to development params.process_method_parameters(section='dataset') # Process dataset again, move correct parameters from dataset_parameters elif args.mode == 'challenge': params['dataset']['method'] = 'challenge_train' # Set dataset to training set for challenge params.process_method_parameters(section='dataset') # Process dataset again, move correct parameters from dataset_parameters if args.node_mode: params['general']['log_system_progress'] = True params['general']['print_system_progress'] = False # Setup logging setup_logging(parameter_container=params['logging']) app = CustomAppCore(name='DCASE 2017::Acoustic Scene Classification / Baseline System', params=params, system_desc=params.get('description'), system_parameter_set_id=params.get('active_set'), setup_label='Development setup', log_system_progress=params.get_path('general.log_system_progress'), show_progress_in_console=params.get_path('general.print_system_progress'), ) # Show parameter set list and exit if args.show_set_list: params_ = ParameterContainer(project_base=os.path.dirname(os.path.realpath(__file__))).load(filename=default_parameters_filename) if args.parameter_override: # Override parameters from a file params_.override(override=args.parameter_override) if 'sets' in params_: app.show_parameter_set_list(set_list=params_['sets']) return # Show dataset list and exit if args.show_dataset_list: app.show_dataset_list() return # Show system parameters if params.get_path('general.log_system_parameters') or args.show_parameters: app.show_parameters() # Initialize application # ================================================== if params['flow']['initialize']: app.initialize() # Extract features for all audio files in the dataset # ================================================== if params['flow']['extract_features']: app.feature_extraction() # Prepare feature normalizers # ================================================== if params['flow']['feature_normalizer']: app.feature_normalization() # System training # ================================================== if params['flow']['train_system']: app.system_training() # System evaluation if not args.mode or args.mode == 'dev': # System testing # ================================================== if params['flow']['test_system']: app.system_testing() # System evaluation # ================================================== if params['flow']['evaluate_system']: app.system_evaluation() # System evaluation in challenge mode elif args.mode == 'challenge': # Set dataset to testing set for challenge params['dataset']['method'] = 'challenge_test' # Process dataset again, move correct parameters from dataset_parameters params.process_method_parameters('dataset') if params['general']['challenge_submission_mode']: # If in submission mode, save results in separate folder for easier access params['path']['recognizer'] = params.get_path('path.recognizer_challenge_output') challenge_app = CustomAppCore(name='DCASE 2017::Acoustic Scene Classification / Baseline System', params=params, setup_label='Evaluation setup' ) # Initialize application # ================================================== if params['flow']['initialize']: challenge_app.initialize() # Extract features for all audio files in the dataset if params['flow']['extract_features']: challenge_app.feature_extraction() # System testing if params['flow']['test_system']: if params['general']['challenge_submission_mode']: params['general']['overwrite'] = True challenge_app.system_testing() if params['general']['challenge_submission_mode']: challenge_app.ui.line(" ") challenge_app.ui.line("Results for the challenge are stored at ["+params.get_path('path.recognizer_challenge_output')+"]") challenge_app.ui.line(" ") # System evaluation if not in challenge submission mode if params['flow']['evaluate_system']: challenge_app.system_evaluation() return 0