Ejemplo n.º 1
0
class Controller():
    def __init__(self):
    	self.nn = None#NN()
    
    def set_file(self,file):
        #print("seteo",file)
        self.nn = NN()
        self.nn.config(tickle.load(file))
        return "Archivo seteado con éxito"
    def classify(self,images):
    	msg = False
    	if self.nn:
    		imgs = []
    		for i in images:
    			imgs.append(cv2.imread(i,cv2.IMREAD_GRAYSCALE).flatten())
    		msg = str(self.nn.classify_image(imgs))
    	return msg
    def get_input_size(self):
    	return "Input size: "+ str(self.nn.input_size)
    def get_output_size(self):
    	return "Output size: "+str(self.nn.output_size)
    def get_hidden_layers(self):
    	return "Hidden layers(Ws): "+str(self.nn.hidden_layers_size)
    def get_learning_rate(self):
    	return "Learning rate: "+str(self.nn.learning_rate)
    def get_dropout(self):
    	return "Dropout: "+str(self.nn.dropout)
Ejemplo n.º 2
0
try:
    hyper_parameters = tickle.load(name)
    print("*** Cargo la config ***")
except:

    hyper_parameters["input_size"] = x[0].shape[0]
    hyper_parameters["output_size"] = 10
    hyper_parameters["hidden_layers_size"] = eval(sys.argv[1])  #[32,16]
    hyper_parameters["learning_rate"] = float(sys.argv[2])
    hyper_parameters["batch_size"] = batch_size
    hyper_parameters["dropout"] = float(sys.argv[3])
    print("*** Creo la config ***")

network = NN()
network.config(hyper_parameters)


def plot_graphic(name, loss, eficiencia):
    range_of = list(range(len(eficiencia)))
    fig1 = plt.figure(figsize=(8, 8))
    plt.subplots_adjust(hspace=0.4)

    p1 = plt.subplot(2, 1, 1)
    l1 = plt.plot(range_of, eficiencia, 'g-')
    xl = plt.xlabel('Epoch n')
    yl = plt.ylabel('Exactitud(%)')
    grd = plt.grid(True)

    p2 = plt.subplot(2, 1, 2)
    ll2 = plt.plot(range_of, loss, 'c-')