V.validate_percentage_string.value = "40" V.mini_batch_string.value = "32" V.testing_files = "" V.replicates_string.value = "1" for batch_seed in ["1", "-1"]: V.batch_seed_string.value = batch_seed for weights_seed in ["1", "-1"]: V.weights_seed_string.value = weights_seed V.logs_folder.value = os.path.join(repo_path, "test/scratch/seeds/trained-classifier-bs="+batch_seed+"-ws="+weights_seed) asyncio.run(C.train_actuate()) wait_for_job(M.status_ticker_queue) check_file_exists(os.path.join(V.logs_folder.value, "train1.log")) check_file_exists(os.path.join(V.logs_folder.value, "train_1r.log")) check_file_exists(os.path.join(V.logs_folder.value, "train_1r", "ckpt-"+V.nsteps_string.value+".index")) run(["hetero", "stop"], stdout=PIPE, stderr=STDOUT) import tensorflow as tf import numpy as np same_weights = ["trained-classifier-bs=1-ws=1/train_1r/ckpt-0", "trained-classifier-bs=-1-ws=1/train_1r/ckpt-0"] diff_weights = ["trained-classifier-bs=1-ws=-1/train_1r/ckpt-0", "trained-classifier-bs=-1-ws=-1/train_1r/ckpt-0"]
wavpath_noext = os.path.join( repo_path, "test/scratch/tutorial-py/groundtruth-data/round1/PS_20130625111709_ch3") V.wavtfcsvfiles_string.value = wavpath_noext + ".wav" V.time_sigma_string.value = "6,3" V.time_smooth_ms_string.value = "6.4" V.frequency_n_ms_string.value = "25.6" V.frequency_nw_string.value = "4" V.frequency_p_string.value = "0.1,1.0" V.frequency_smooth_ms_string.value = "25.6" asyncio.run(C.detect_actuate()) wait_for_job(M.status_ticker_queue) check_file_exists(wavpath_noext + "-detect.log") check_file_exists(wavpath_noext + "-detected.csv") count_lines_with_word(wavpath_noext + "-detected.csv", "time", 543) count_lines_with_word(wavpath_noext + "-detected.csv", "frequency", 45) count_lines_with_word(wavpath_noext + "-detected.csv", "ambient", 1138) V.context_ms_string.value = "204.8" V.shiftby_ms_string.value = "0.0" V.representation.value = "mel-cepstrum" V.window_ms_string.value = "6.4" V.mel_dct_string.value = "7,7" V.stride_ms_string.value = "1.6" V.dropout_string.value = "0.5" V.optimizer.value = "adam" V.learning_rate_string.value = "0.0002" V.kernel_sizes_string.value = "5,3,3"
V.weights_seed_string.value = "1" V.replicates_string.value = "1" for representation in ["waveform", "spectrogram", "mel-cepstrum"]: V.representation.value = representation for stride_after_layer in ["0", "65535"]: V.model_parameters["stride_after_layer"].value = stride_after_layer V.logs_folder.value = os.path.join( repo_path, "test/scratch/freeze-classify", "trained-classifier-r=" + representation + "-s=" + stride_after_layer) asyncio.run(C.train_actuate()) wait_for_job(M.status_ticker_queue) check_file_exists(os.path.join(V.logs_folder.value, "train1.log")) check_file_exists(os.path.join(V.logs_folder.value, "train_1r.log")) check_file_exists( os.path.join(V.logs_folder.value, "train_1r", "ckpt-" + V.nsteps_string.value + ".index")) V.model_file.value = os.path.join( V.logs_folder.value, "train_" + V.replicates_string.value + "r", "ckpt-" + V.nsteps_string.value + ".meta") V.wavtfcsvfiles_string.value = os.path.join( repo_path, "test/scratch/freeze-classify/groundtruth-data/round1/PS_20130625111709_ch3.wav" ) V.prevalences_string.value = "" for nwindows in ["1", "9"]:
V.init(None) C.init(None) run(["hetero", "start", "1", "1", "1"]) V.groundtruth_folder.value = os.path.join( repo_path, "test/scratch/congruence/groundtruth-data") V.testfiles_string.value = "" V.validationfiles_string.value = "recording1.wav,recording2.wav,recording3.wav,recording4.wav" asyncio.run(C.congruence_actuate()) wait_for_job(M.status_ticker_queue) wavpath_noext = V.validationfiles_string.value[:-4] check_file_exists(os.path.join(V.groundtruth_folder.value, "congruence.log")) for i in range(1, 8): check_file_exists( os.path.join(V.groundtruth_folder.value, "congruence.tic.label" + str(i) + ".csv")) check_file_exists( os.path.join(V.groundtruth_folder.value, "congruence.word.label" + str(i) + ".csv")) l1 = pd.read_csv( os.path.join(V.groundtruth_folder.value, "congruence.word.label1.csv")) pr1 = l1.loc[l1['Unnamed: 0'] == '1.0pr'] check_value(pr1, "everyone", 1) check_value(pr1, "only person1", 2) check_value(pr1, "only person2", 3)