opt = Adam(lr=0.1, beta_1=0.9, beta_2=0.999) model = Sequential() model.add(Dense(250, input_shape=[5, 199], activation='relu')) model.add(Dense(120, activation='relu')) model.add(Flatten()) #model.add(Dropout(rate=0.25)) model.add(Dense(5, activation='softmax')) model.load_weights('nn_weights_5000_5_parameters.h5') model.compile(optimizer=opt, loss='categorical_crossentropy') audio_file = sys.argv[1] print(audio_file) file_freq_peaks = check_peaks.check_peaks(sys.argv[1]) file_phases = check_phase.check_phase(sys.argv[1]) file_samples_peaks = check_samples.check_peaks_sample(sys.argv[1]) file_signal_noise_ratio = check_signal_to_noise_ratio.check_signal_to_noise( sys.argv[1]) file_odd_numbers = check_odd_numbers.check_odd_numbers(sys.argv[1]) input_data = [ file_freq_peaks, file_phases, file_samples_peaks, file_signal_noise_ratio, file_odd_numbers ] input_data = np.array([input_data], dtype=np.float32) print(model.predict(input_data))
file_samples_peaks = [] file_phases = [] file_types = [] file_samples_signal_noise = [] file_odd_numbers = [] dir_counter = 0 counter = 0 for directory_name in directories[0]: dir_counter += 1 for audio_file in audio_files[dir_counter]: file_freq_peaks.append(check_peaks.check_peaks(original_path + directory_name + '/' + audio_file)) file_phases.append(check_phase.check_phase(original_path + directory_name + '/' + audio_file)) file_samples_peaks.append(check_samples.check_peaks_sample(original_path + directory_name + '/' + audio_file)) file_samples_signal_noise.append(check_signal_to_noise_ratio.check_signal_to_noise(original_path + directory_name + '/' + audio_file)) file_odd_numbers.append(check_odd_numbers.check_odd_numbers(original_path + directory_name + '/' + audio_file)) if 'audio in' in directory_name: file_types.append([1, 0, 0, 0, 0]) elif 'Echo Hiding' in directory_name: file_types.append([0, 1, 0, 0, 0]) elif 'LSB' in directory_name: file_types.append([0, 0, 1, 0, 0]) elif 'Phase Coding' in directory_name: file_types.append([0, 0, 0, 1, 0]) elif 'Spread Spectrum' in directory_name: file_types.append([0, 0, 0, 0, 1]) counter += 1 percentage_done = (counter/(len(directories[0]) * len(audio_files[1])))*100
# input_data = np.array([input_data], dtype=np.float32) # print(model.predict(input_data)) counter = 0 audio_in = [1, 0, 0, 0, 0] echo_hiding = [0, 1, 0, 0, 0] lsb = [0, 0, 1, 0, 0] phase_coding = [0, 0, 0, 1, 0] spread_spectrum = [0, 0, 0, 0, 1] for audio_file in audio_files[0]: file_freq_peaks = check_peaks.check_peaks(original_path + '/' + audio_file) file_phases = check_phase.check_phase(original_path + '/' + audio_file) file_samples_peaks = check_samples.check_peaks_sample(original_path + '/' + audio_file) file_signal_to_noise = check_signal_to_noise_ratio.check_signal_to_noise( original_path + '/' + audio_file) file_odd_numbers = check_odd_numbers.check_odd_numbers(original_path + '/' + audio_file) input_data = [ file_freq_peaks, file_phases, file_samples_peaks, file_signal_to_noise, file_odd_numbers ] input_data = np.array([input_data], dtype=np.float32) # print(input_data.shape) predicted_results = model.predict(input_data) real_result = np.array(audio_in) if real_result.argmax() == predicted_results.argmax():
import check_samples print(check_samples.check_peaks_sample('wav_stego/audio in/ballad.wav')) array1 = [1, 0, 0, 0] array2 = [1, 0, 0, 0] print(array1 == array2)