def run(): image = read() input = list(read_image(image)) net = Network.load(LAYER1_FILENAME) hidden = net.forward(input) for _ in xrange(5): print_images([net.backwards(hidden)])
def run(): net = Network.load(LAYER1_FILENAME) input = [.0] * IMAGE_DIM * IMAGE_DIM while True: hidden = net.forward(input) input = net.backwards(hidden) print_images([input]) time.sleep(.075)
def train_input_list(self, input_list): assert len(input_list) > 0 assert all(len(input) == self.insz for input in input_list) weight_deltas = [.0] * len(self.weights) #sample_size = len(input_list) / 3 #for input in random.sample(input_list, sample_size): for input in input_list: train_deltas = self.train_input(input) weight_deltas = [a + b for a, b in zip(weight_deltas, train_deltas)] self.apply_deltas(weight_deltas) mod_inputs = [] if can_show_something(): for input in random.sample(input_list, 1): mod_inputs.append(input) mod_inputs.append(self.backwards(self.forward(input))) print_images(mod_inputs) self.save()