from sklearn import svm from sklearn.externals import joblib import pickle warnings.filterwarnings("ignore") """clf = joblib.load('input/detection_iris_new.pkl')## this is the vnear robust one""" clf = joblib.load( 'input/detection_new18july.pkl') ## this is taken at the beach #clm = joblib.load('input/detection_new18july.pkl') #clf1 = joblib.load('input/dronedetectionfinal_new.pkl') #discard this part---------------------------------------------------------- rows = 10 cols = 60 winlist = [] """set this part to the number of logs you want to save before computing confidence level""" log = logdata( 3) ##check getconfi.py for more details(in feature_extraction folder) ###################################################################################################### global itervalue #I used this when I needed to get only a certain number o iterations itervalue = 0 """this is the script which would record data""" def record(time=1, fs=44100): file = 'temp_out' duration = time recording = sd.rec(int(duration * fs), samplerate=fs, channels=1, blocking=False) for i in range(time):
warnings.filterwarnings("ignore") """set this true not to send any data to server""" test = True """clf = joblib.load('input/detection_iris_new.pkl')## this is the vnear robust one""" clf = joblib.load( 'input/detection_backyaardwithnoise.pkl') ## this is taken at the beach #clm = joblib.load('input/detection_new18july.pkl') #clf1 = joblib.load('input/dronedetectionfinal_new.pkl') rows = 10 cols = 60 winlist = [] datacount = 4 """set this part to the number of logs you want to save before computing confidence level""" log = logdata(datacount) ###################################################################################################### global itervalue itervalue = 0 """this is the script which would record data""" def record(time=1, fs=44100): file = 'temp_out' duration = time recording = sd.rec(int(duration * fs), samplerate=fs, channels=1, blocking=False)
from sklearn import svm from sklearn.externals import joblib import pickle warnings.filterwarnings("ignore") """clf = joblib.load('input/detection_iris_new.pkl')## this is the vnear robust one""" clf = joblib.load( 'input/detection_iris_new.pkl') ## this is taken at the beach #clm = joblib.load('input/detection_new18july.pkl') #clf1 = joblib.load('input/dronedetectionfinal_new.pkl') rows = 10 cols = 60 winlist = [] log = logdata(3) ###################################################################################################### global itervalue itervalue = 0 def record(time=1, fs=44100): file = 'temp_out' duration = time recording = sd.rec(int(duration * fs), samplerate=fs, channels=1, blocking=False) for i in range(time): i += 1
from sklearn import svm from sklearn.externals import joblib import pickle warnings.filterwarnings("ignore") """clf = joblib.load('input/detection_iris_new.pkl')## this is the vnear robust one""" clf = joblib.load( 'input/detection_backyaard.pkl') ## this is taken at the beach #clm = joblib.load('input/detection_new18july.pkl') #clf1 = joblib.load('input/dronedetectionfinal_new.pkl') rows = 10 cols = 60 winlist = [] log = logdata(4) ###################################################################################################### global itervalue itervalue = 0 def record(time=1, fs=44100): file = 'temp_out' duration = time recording = sd.rec(int(duration * fs), samplerate=fs, channels=1, blocking=False) for i in range(time): i += 1
elif value == 3: label = "vfar" elif value == 4: label = "vnear" return label def drone_prediction_label(value): if value == 1: label = "drone" elif value == 0: label = "no drone" return label log = logdata(10) log.insertdf(3, str(datetime.datetime.now())[:-7]) #dummy value i = 0 bandpass = [600, 10000] for root, dirs, files in os.walk(sys.argv[1]): for file in files: path = os.path.join(root, file) try: data, fs = rdt.readaudio(path) ns = fil.bandpass_filter(data, bandpass) try: p, freq, b = hmn.psddetectionresults(data) except IndexError: pass b = False b = True