class ALLoneAPI(): """ ALLoneAPI RPI4 CNN Core Class Core class for the oneAPI RPI4 Acute Lymphoblastic Leukemia Classifier. """ def __init__(self): """ Initializes the class. """ self.Helpers = Helpers("Core") self.Core = Model() self.Helpers.logger.info("ALLoneAPI RPI4 CNN initialization complete.") def do_load_model(self): """ Loads the model """ self.Core.load_model_and_weights() def do_classify(self): """ Loads model and classifies test data """ self.do_load_model() self.Core.test_classifier() def do_server(self): """ Loads the API server """ self.do_load_model() self.Server = Server(self.Core) self.Server.start() def do_http_classify(self): """ Loads model and classifies test data """ self.Core.test_http_classifier()
class ALLOpenVINO(): """ ALLOpenVINO CNN Core class for the OneAPI OpenVINO Acute Lymphoblastic Leukemia Classifier CNN. """ def __init__(self): """ Initializes the class. """ self.Helpers = Helpers("Core") self.Core = OpenVINO() self.Helpers.logger.info("Class initialization complete.") def do_classify(self): """ Loads model and classifies test data """ self.Core.test_classifier() def do_server(self): """ Loads the API server """ self.Server = Server(self.Core) self.Server.start() def do_http_classify(self): """ Loads model and classifies test data """ self.Core.test_http_classifier()
def test_server_constructor(conf): server1 = Server(conf['UMAX'], conf['TTASK']) assert 1 == server1.get_server_tick() assert 0 == server1.get_current_number_of_clients() assert type(server1.get_id()) == str
def test_server_add_client(conf): server1 = Server(conf['UMAX'], conf['TTASK']) client1 = Client() server1.add_client(client1) assert 1 == len(server1.clients), "There was an error an adding the client" assert 1 == server1.get_current_number_of_clients( ), "There was an error an counting the number of clients"
def do_server(self): """ Loads the API server """ # Load the model class self.Model = Model() # Load the model self.do_load_model() # Load the server class self.Server = Server(self.Model) # Start the server self.Server.start()
class COVID19DN(): """ COVID19DN Class Core COVID-19 Tensorflow DenseNet Classifier wrapper class using Tensroflow 2. """ def __init__(self): """ Initializes the class. """ self.Helpers = Helpers("Core") self.Model = Model() self.Helpers.logger.info( "COVID19DN Tensorflow initialization complete.") def do_data(self): """ Sorts the training data. """ self.Data = Data() self.Data.process_data( self.Data.paths_n_labels()) def do_train(self): """ Creates & trains the model. """ self.Model.do_model(self.Data) self.Model.do_train() self.Model.do_evaluate() def do_load_model(self): """ Loads the model """ self.Model.load_model_and_weights() def do_classify(self): """ Loads model and classifies test data """ self.do_load_model() self.Model.test_classifier() def do_server(self): """ Loads the API server """ self.do_load_model() self.Server = Server(self.Model) self.Server.start() def do_http_classify(self): """ Loads model and classifies test data """ self.Model.test_http_classifier()
def start(): nodeName = str(input("Enter your name: ")) config = Config(nodeName) server = Server(config.getMyName(), config.getMyIp(), config.getMyPort(), config.getMyPort(), 1024) tServer = threading.Thread(target=server.recievePacket, daemon=True) tServer.start() router = Router() tRouter = threading.Thread(target=router.watchNeighbours, daemon=True) tRouter.start() queue = Queue() tQueue = threading.Thread(target=queue.run, daemon=True) tQueue.start() ui = UI() network = Network() segmenter = Segmenter() crypto = Crypto() main = Main(router, server, network, segmenter, crypto, queue, config, ui) ui.startChat()
class AllDS2020(): """ AllDS2020 CNN Class Core AllDS2020 CNN Tensorflow 2.0 class. """ def __init__(self): """ Initializes the class. """ self.Helpers = Helpers("Core") self.Core = Model() self.Helpers.logger.info("AllDS2020 CNN initialization complete.") def do_train(self): """ Creates & trains the model. """ self.Core.do_data() self.Core.do_network() self.Core.do_train() self.Core.do_evaluate() def do_load_model(self): """ Loads the model """ self.Core.load_model_and_weights() def do_classify(self): """ Loads model and classifies test data """ self.do_load_model() self.Core.test_classifier() def do_server(self): """ Loads the API server """ self.do_load_model() self.Server = Server(self.Core) self.Server.start() def do_http_classify(self): """ Loads model and classifies test data """ self.Core.test_http_classifier()
class ALLoneAPI(): """ ALLoneAPI CNN Core class for the OneAPI Acute Lymphoblastic Leukemia Classifier CNN. """ def __init__(self): """ Initializes the class. """ self.Helpers = Helpers("Core") self.Core = Model() self.Helpers.logger.info("Class initialization complete.") def do_train(self): """ Creates & trains the model. """ self.Core.do_data() self.Core.do_network() self.Core.do_train() self.Core.do_evaluate() def do_load_model(self): """ Loads the model """ self.Core.load_model_and_weights() def do_classify(self): """ Loads model and classifies test data """ self.do_load_model() self.Core.test_classifier() def do_server(self): """ Loads the API server """ self.do_load_model() self.Server = Server(self.Core) self.Server.start() def do_http_classify(self): """ Loads model and classifies test data """ self.Core.test_http_classifier()
def test_remove_client_from_server(conf): server1 = Server(conf['UMAX'], conf['TTASK']) client1 = Client() client_hash_code = client1.get_hash_code() server1.add_client(client1) assert str == type(client_hash_code), "The hash code must be a string" # before removing, the server length should be 1 assert 1 == server1.get_current_number_of_clients() server1._remove_client_from_server_using_hash_code(client_hash_code) # now the server should not have any clients assert 0 == server1.get_current_number_of_clients()
def test_clients_who_have_hops_larger_than_umax_shall_not_stay_on_server(conf): server1 = Server(conf['UMAX'], conf['TTASK']) client1 = Client() for i in range(0, conf['UMAX'] + 5): client1.increase_hop() server1.add_client(client1) server1.update_server_status() assert 0 == server1.get_current_number_of_clients()
class AllDS2020(): """ AllDS2020 CNN For Raspberry Pi 4 Class Core AllDS2020 CNN For Raspberry Pi 4 Tensorflow 2.0 class. """ def __init__(self): """ Initializes the class. """ self.Helpers = Helpers("Core") self.Core = Model() self.Helpers.logger.info("AllDS2020 CNN initialization complete.") def do_load_model(self): """ Loads the model """ self.Core.load_model_and_weights() def do_classify(self): """ Loads model and classifies test data """ self.do_load_model() self.Core.test_classifier() def do_server(self): """ Loads the API server """ self.do_load_model() self.Server = Server(self.Core) self.Server.start() def do_http_classify(self): """ Loads model and classifies test data """ self.Core.test_http_classifier()
def listarServidor(self): s = Server() s.listar()
class COVID19DN(): """ COVID19DN Class Core COVID-19 Tensorflow DenseNet Classifier wrapper class using Tensroflow 2. """ def __init__(self): """ Initializes the class. """ self.Helpers = Helpers("Core") self.Helpers.logger.info( "COVID-19 Tensorflow DenseNet Classifier initialization complete.") def life(self): """ Sends vital statistics to HIAS """ cpu = psutil.cpu_percent() mem = psutil.virtual_memory()[2] hdd = psutil.disk_usage('/').percent tmp = psutil.sensors_temperatures()['cpu-thermal'][0].current r = requests.get('http://ipinfo.io/json?token=' + self.Helpers.confs["iotJumpWay"]["key"]) data = r.json() location = data["loc"].split(',') self.Helpers.logger.info("COVID19DN Life (TEMPERATURE): " + str(tmp) + "\u00b0") self.Helpers.logger.info("COVID19DN Life (CPU): " + str(cpu) + "%") self.Helpers.logger.info("COVID19DN Life (Memory): " + str(mem) + "%") self.Helpers.logger.info("COVID19DN Life (HDD): " + str(hdd) + "%") self.Helpers.logger.info("COVID19DN Life (LAT): " + str(location[0])) self.Helpers.logger.info("COVID19DN Life (LNG): " + str(location[1])) # Send iotJumpWay notification self.iotJumpWayDevice.devicePub( "Life", { "CPU": cpu, "Memory": mem, "Diskspace": hdd, "Temperature": tmp, "Latitude": location[0], "Longitude": location[1] }) threading.Timer(60.0, self.life).start() def iotjumpway_client(self): """ Starts iotJumpWay Client. """ # Initiates the iotJumpWay connection class self.iotJumpWayDevice = iotJumpWay({ "host": self.Helpers.confs["iotJumpWay"]["host"], "port": self.Helpers.confs["iotJumpWay"]["port"], "lid": self.Helpers.confs["iotJumpWay"]["loc"], "zid": self.Helpers.confs["iotJumpWay"]["zne"], "did": self.Helpers.confs["iotJumpWay"]["id"], "dn": self.Helpers.confs["iotJumpWay"]["name"], "un": self.Helpers.confs["iotJumpWay"]["mqtt"]["username"], "pw": self.Helpers.confs["iotJumpWay"]["mqtt"]["password"] }) self.iotJumpWayDevice.connect() def threading(self): """ Creates required module threads. """ # Life thread Thread(target=self.life, args=()).start() threading.Timer(60.0, self.life).start() def do_train(self): """ Creates & trains the model. """ # Load the model class self.Model = Model() # Create the model self.Model.do_model() # Train the model self.Model.do_train() # Validate the model self.Model.do_evaluate() def do_load_model(self): """ Loads the model """ # Load the model and weights self.Model.load_model_and_weights() def do_classify(self): """ Loads model and classifies test data """ # Load the model class self.Model = Model() # Load the model self.do_load_model() # Classify the test data self.Model.test_classifier() def do_server(self): """ Loads the API server """ # Load the model class self.Model = Model() # Load the model self.do_load_model() # Load the server class self.Server = Server(self.Model) # Start the server self.Server.start() def do_http_classify(self): """ Loads model and classifies test data """ # Load the model class self.Model = Model() # Classify the test data via the server self.Model.test_http_classifier()
def removerServidor(self): nome = raw_input("Digite o nome do servidor:") s = Server() s.remove(nome)
class ALLOpenVINO(): """ ALLOpenVINO RPI 4 Core class for the OneAPI OpenVINO Raspberry Pi 4 Acute Lymphoblastic Leukemia Classifier. """ def __init__(self): """ Initializes the class. """ self.Helpers = Helpers("Core") self.Core = OpenVINO() self.Helpers.logger.info("Class initialization complete.") def iotJumpWayConn(self): # Initiates the iotJumpWay connection class self.iot = iot() self.iot.connect() def life(self): """ Sends vital statistics to HIAS """ cpu = psutil.cpu_percent() mem = psutil.virtual_memory()[2] hdd = psutil.disk_usage('/').percent tmp = psutil.sensors_temperatures()['cpu_thermal'][0].current r = requests.get('http://ipinfo.io/json?token=' + self.Helpers.confs["iotJumpWay"]["ipinfo"]) data = r.json() location = data["loc"].split(',') self.Helpers.logger.info("GeniSysAI Life (TEMPERATURE): " + str(tmp) + "\u00b0") self.Helpers.logger.info("GeniSysAI Life (CPU): " + str(cpu) + "%") self.Helpers.logger.info("GeniSysAI Life (Memory): " + str(mem) + "%") self.Helpers.logger.info("GeniSysAI Life (HDD): " + str(hdd) + "%") self.Helpers.logger.info("GeniSysAI Life (LAT): " + str(location[0])) self.Helpers.logger.info("GeniSysAI Life (LNG): " + str(location[1])) # Send iotJumpWay notification self.iot.channelPub( "Life", { "CPU": str(cpu), "Memory": str(mem), "Diskspace": str(hdd), "Temperature": str(tmp), "Latitude": "", "Longitude": "" }) threading.Timer(300.0, self.life).start() def do_classify(self): """ Loads model and classifies test data """ self.Core.test_classifier() def do_server(self): """ Loads the API server """ self.Server = Server(self.Core, self.iot) self.Server.start() def do_http_classify(self): """ Loads model and classifies test data """ self.Core.test_http_classifier() def threading(self): """ Creates required module threads. """ # Life thread threading.Timer(10.0, self.life).start() def signal_handler(self, signal, frame): self.Helpers.logger.info("Disconnecting") self.iot.disconnect() sys.exit(1)
def do_server(self): """ Loads the API server """ self.Server = Server(self.Core, self.iot) self.Server.start()
def do_server(self): """ Loads the API server """ self.do_load_model() self.Server = Server(self.Core) self.Server.start()
def criarServidor(self): nome = raw_input("Digite o nome do servidor: ") novo = Server(nome) novo.instalar()