Commit bc5f42f9 authored by chalaka78's avatar chalaka78

Add sound detection models

parent fe01bf90
......@@ -429,6 +429,66 @@ def Customer_Frequency(request):
def AdminHome(request):
return render(request,'Admin/AdminHome.html')
# tensorflow sound detection model
# import tensorflow as tf
# import tensorflow_io as tfio
#
# import tensorflow as tf
# import tensorflow_io as tfio
#
# audio = tfio.audio.AudioIOTensor('gs://clouds-sample-tests/speech/brooklyn.flac')
#
# print(audio)
#
#
# # remove last dimension
# audio_tensor = tf.squeeze(audio_slice, axis=[-1])
#
# print(audio_tensor)
#
# from IPython.display import Audio
#
# Audio(audio_tensor.numpy(), rate=audio.rate.numpy())
#
#
# import matplotlib.pyplot as plt
#
#
# tensor = tf.cast(audio_tensor, tf.float32) / 32768.0
#
# plt.figure()
# plt.plot(tensor.numpy())
# pyaudio sound detection model
# import numpy as np
#
# import warnings
# warnings.filterwarnings("ignore")
#
# from pyaudioclassification import feature_extraction, train, predict, print_leaderboard
#
# parent_dir = '.'
#
#
# if np.DataSource().exists("./feat.npy") and np.DataSource().exists("./label.npy"):
# features, labels = np.load('./feat.npy'), np.load('./label.npy')
# else:
# features, labels = feature_extraction('./data/')
# np.save('./feat.npy', features)
# np.save('./label.npy', labels)
#
#
# if np.DataSource().exists("./model.h5"):
# from keras.models import load_model
# model = load_model('./model.h5')
# else:
# model = train(features, labels, epochs=100)
# model.save('./model.h5')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment