Ejemplo n.º 1
0
	# Discover the magic number
	net = convVAE(dim_z,x_train,x_test)
	get_magic = net.get_flattened(net.x_train[:2,:,:,:])
	# actual nework
	#net1 = convVAE(dim_z,x_train,x_test,diff = dif,magic = get_magic.shape[1])
	net = convVAE(dim_z,x_train,x_test,diff=None,magic = get_magic.shape[1])

	# load the parameters from the model:
	params = pickle_loader(model_dir+"model.pkl")

	for p in params:
		net.params.set_value(p.get_value())


	# Writing paths
	path_array,original_array = sound_write.path_write(net,sample_rate,duration = 3.,data_points = 10)
	wav.write("sound/"+experiment_name+"_paths_rewrite.wav",sample_rate,path_array)
	wav.write("sound/"+experiment_name+"_paths_original_rewrite.wav",sample_rate,original_array)
	# Reconstruction sounds and random latent configurations
	random,reconstruction,original = sound_write.sample_write(net,sample_rate,duration = 10)
	wav.write("sound/"+experiment_name+"_random_rewrite.wav",sample_rate,random)
	wav.write("sound/"+experiment_name+"_reconstruction_rewrite.wav",sample_rate,reconstruction)
	wav.write("sound/"+experiment_name+"_reconstruction_original_rewrite.wav",sample_rate,original)
	# Weights
	plot_params(net.params,weight_plot_dir)
	#ou1 = net1.output(x_train[:50])
	idxx = np.random.randint(0,x_train.shape[0],50)
	# Reconstruction images
	ou2 = net.output(x_train[idxx])
	for i in range(ou2.shape[0]):
		if i <100:
Ejemplo n.º 2
0
    print "magic_value", net.magic
    iterations = 100
    disc = 1.01
    for i in range(iterations):
        net1.iterate()
        net2.iterate()
        rows = 1
        columns = 3
        print "ITERATION", i
        print net2.performance['train'][-1]

    net1.dropout_prob.set_value(np.float32(0.0))
    net2.dropout_prob.set_value(np.float32(0.0))

    path_array, original_array = sound_write.path_write(net2,
                                                        880,
                                                        duration=0.2,
                                                        data_points=10)
    wav.write("sound/" + experiment_name + "_paths.wav", sample_rate,
              path_array)
    wav.write("sound/" + experiment_name + "_paths_original.wav", sample_rate,
              original_array)

    random, reconstruction, original = sound_write.sample_write(net1,
                                                                880,
                                                                duration=10)
    wav.write("sound/" + experiment_name + "_random.wav", sample_rate, random)
    wav.write("sound/" + experiment_name + "_reconstruction.wav", sample_rate,
              reconstruction)
    wav.write("sound/" + experiment_name + "_reconstruction_original.wav",
              sample_rate, original)
Ejemplo n.º 3
0
		print net.performance['train'][-1]

	###### Shifting experiments ####
	num = 100
	h_val = np.zeros([num,net.magic]).astype(np.float32)
	for i in range(num):
		h_val[i,i]=1

	out = net.generate_h(h_val)
	plt.plot(out.T)
	plt.show()
	pdb.set_trace()

	############## ALL THE BOOKEEPING #########################
	# Writing paths
	path_array,original_array = sound_write.path_write(net,880,duration = 0.2,data_points = 10)
	wav.write("sound/"+experiment_name+"_paths.wav",sample_rate,path_array)
	wav.write("sound/"+experiment_name+"_paths_original.wav",sample_rate,original_array)
	# Reconstruction sounds and random latent configurations
	random,reconstruction,original = sound_write.sample_write(net,880,duration = 10)
	wav.write("sound/"+experiment_name+"_random.wav",sample_rate,random)
	wav.write("sound/"+experiment_name+"_reconstruction.wav",sample_rate,reconstruction)
	wav.write("sound/"+experiment_name+"_reconstruction_original.wav",sample_rate,original)
	# Weights
	plot_params(net.params,weight_plot_dir)
	#ou1 = net1.output(x_train[:50])

	# Reconstruction images
	ou2 = net.output(x_train[:50])
	for i in range(ou2.shape[0]):
		if i <100: