def main_all(size, nbiter, lr): #neurons_init = None #ALLGISTS[0:size**2].reshape((size,size,-1)) neurons_init = ALLGISTS[0:size**2].reshape((size, size, -1)) k = km(size, DIM, neurons_init) k.learn(ALLGISTS, nbiter, lr) logging.info('Map computing ... finish') save_img(k, 100000, thumb_size=64)
def main_all(size,nbiter,lr): #neurons_init = None #ALLGISTS[0:size**2].reshape((size,size,-1)) neurons_init = ALLGISTS[0:size**2].reshape((size,size,-1)) k = km(size,DIM,neurons_init) k.learn(ALLGISTS,nbiter,lr) logging.info('Map computing ... finish') save_img(k,100000,thumb_size=64)
def main(size, nbiter, lr): NBCHANNEL = 3 init = np.random.random_integers(0, 255, size**2 * NBCHANNEL) init = init.reshape(size, size, NBCHANNEL) sample = np.array([[0, 0, 0], [255, 0, 0], [0, 255, 0], [0, 0, 255], [255, 255, 0], [0, 255, 255]]) k = km(size, NBCHANNEL, init) kohonen.save_rgb(k, 0) k.learn(sample, nbiter, lr, callback=kohonen.save_rgb) kohonen.save_rgb(k, 100000)
def main(size, nbiter, lr): neurons_init = ALLGISTS[0:size**2].reshape((size, size, -1)) k = km(size, DIM, neurons_init) pics = [ 'forest_text111.jpg', 'mountain_n44001.jpg', 'coast_bea1.jpg', 'street_art1041.jpg', 'highway_bost161.jpg', 'opencountry_land381.jpg', 'insidecity_bost141.jpg', 'tallbuilding_a632011.jpg' ] sample = np.array([GISTS[os.path.join(PICS_DIR, p)] for p in pics]) k.learn(sample, nbiter, lr) #,callback=save_img)
def main(size,nbiter,lr): NBCHANNEL = 3 init = np.random.random_integers(0,255,size**2*NBCHANNEL) init = init.reshape(size,size,NBCHANNEL) sample = np.array([[0,0,0], [255,0,0], [0,255,0], [0,0,255], [255,255,0], [0,255,255]]) k = km(size,NBCHANNEL,init) kohonen.save_rgb(k,0) k.learn(sample,nbiter,lr,callback=kohonen.save_rgb) kohonen.save_rgb(k,100000)
def main(size,nbiter,lr): neurons_init = ALLGISTS[0:size**2].reshape((size,size,-1)) k = km(size,DIM,neurons_init) pics = ['forest_text111.jpg', 'mountain_n44001.jpg', 'coast_bea1.jpg', 'street_art1041.jpg', 'highway_bost161.jpg', 'opencountry_land381.jpg', 'insidecity_bost141.jpg', 'tallbuilding_a632011.jpg'] sample = np.array([ GISTS[os.path.join(PICS_DIR,p)] for p in pics ]) k.learn(sample,nbiter,lr)#,callback=save_img)