Exemplo n.º 1
0
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()
Exemplo n.º 2
0
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()
Exemplo n.º 3
0
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()
Exemplo n.º 4
0
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()
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()
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
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()