Esempio n. 1
0
    def __init__(self, app_config):
        self.app_config = app_config
        reporter = reporting.Reporter(app_config)
        recordings_buffer_size = app_config.no_processes * 4  # only this number of recordings will be acquired

        self.recordings_q = multiprocessing.Queue(
            recordings_buffer_size)  # limited size of a queue
        self.output_q = multiprocessing.Queue()

        self.process_in = multiprocessing.Process(
            target=s3connection.RecordingsFetcher().get_recordings,
            args=(app_config, self.recordings_q))
        self.process_out = multiprocessing.Process(
            target=reporter.write_results_parallel, args=(self.output_q, ))
        self.process_kiwi = [
            multiprocessing.Process(target=self.worker, args=())
            for i in range(app_config.no_processes)
        ]
Esempio n. 2
0
 def __init__(self, app_config):
     self.app_config = app_config
     self.reporter = reporting.Reporter(app_config)
     self.kiwi_finder = identification.KiwiFinder(app_config)
     self.noise_remover = noise_reduction.NoiseRemover()
     self.fetcher = s3connection.RecordingsFetcher()
Esempio n. 3
0
Created on Sat Feb 22 17:50:43 2014

@author: Lukasz Tracewski

Identification of kiwi calls from audio recordings - main module.
"""

import configuration
import reporting
import recordings_io
import noise_reduction
import features
import identification

app_config = configuration.Configurator().parse_arguments()
reporter = reporting.Reporter(location=app_config.data_store,
                              write_to_stdout=app_config.write_stdout)
walker = recordings_io.get_recordings_walker(data_store=app_config.data_store,
                                             bucket=app_config.bucket)
kiwi_finder = identification.KiwiFinder()

for rate, sample, sample_name in walker.read_wave():
    noise_remover = noise_reduction.NoiseRemover()
    try:
        filtered_sample = noise_remover.remove_noise(sample, rate)
    except ValueError:
        filtered_sample = sample

    segmented_sounds = noise_remover.segmentator.get_segmented_sounds()

    feature_extractor = features.FeatureExtractor()
    extracted_features = feature_extractor.process(filtered_sample, rate,
Esempio n. 4
0
    
    c_layer = noiselayer(c_layer)
    predictions = Dense(trn.nb_classes, init='he_uniform', activation='softmax')(c_layer)
    model = Model(input=inputs, output=predictions)
    
    # Set up callbacks
    cbs = []
 
    def lrscheduler(epoch):
        lr = 0.0001 * 0.97**np.floor(epoch / 2)
        print('Learning rate: %.7f' % lr)
        return lr
    cbs.append(keras.callbacks.LearningRateScheduler(lrscheduler))
    
    import reporting
    reporter = reporting.Reporter(trn=trn, tst=tst, noiselayer=noiselayer, micalculator=micalculator,
                                 on_epoch_report_mi=args.epoch_report_mi)
    cbs.append(reporter)

    import keras.optimizers
    adam = keras.optimizers.Adam(lr=0.0001, beta_1 = 0.5, beta_2=0.999) # exponential weight decay?
    model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])

    try:
        model.fit(x=trn.X, y=trn.Y, verbose=2, batch_size=100, epochs=200, validation_data=(tst.X, tst.Y), callbacks=cbs)
    except KeyboardInterrupt:
        print("KeyboardInterrupt called")
    

    # Print and save results
    probs = 0.
    NUM_SAMPLES = 12
Esempio n. 5
0
   
if enable_wifi:
    my_utils.print_warning("=== WARNING ===")
    my_utils.print_warning( "1. Make sure you have a Wireless NIC enabled on mon0")
    my_utils.print_warning("Use this command to enable it  [$ sudo airmon-ng start  [**wireless interface**]     ]")
    ssid,essid=configs.get_bssid()
    tmp=raw_input(" BSSID of the Wifi access point is ["+essid+"]" )
    SSID=ssid
    # print "The SSID is NOT valid"


my_utils.print_summary("Configuration is finished.")
tmp=raw_input("Press 'Return' to launch the tests")
os.system("clear")
# Creating the reporting object
report = reporting.Reporter()


# Create a flooder object

if enable_dos:
    Flood=flooder.Flooder(DUREE)
    # launching attacks and taking results
    ######################################

    SYN_FLOOD_PORT= Flood.syn_flood(IP_LAN,PORT)
    SYN_FLOOD_ALL_PORT= Flood.syn_flood_thread(IP_LAN)
    UDP_FLOOD_PORT= Flood.udp_flood(IP_LAN,PORT)
    ICMP_FLOOD= Flood.icmp_flood(IP_LAN)
    SSL_DOS= Flood.ssl_dos(IP_LAN,PORT)
    IHM_DOS= Flood.ihm_dos(IP_LAN)