def main(): test_anomaly = load_dataset('anomaly') test_normal = load_dataset('normal') model = VAE() model, loss = model.vae_net() model.load_weights("weight/vae_model.h5") anomaly_detector(model, test_normal, test_anomaly)
latent_dim = 124 input_dim = len(int2labels_map) - 1 dropout = .1 maxnorm = None vae_b1 , vae_b2 = .02 , .1 print('Reinitiating VAE Model') # Build Model model = VAE(latent_dim, input_dim, measures, measure_len, dropout, maxnorm, vae_b1 , vae_b2) # Reload Saved Weights checkpoint_dir = './training_checkpoints' checkpoint_prefix = os.path.join(checkpoint_dir, "model_ckpt") model.load_weights(checkpoint_prefix) model.build(tf.TensorShape([None, measures, measure_len, ])) # Print Summary of Model model.summary() ### Sample Latent Variable Distributions #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Here we use SVD to more effectively sample from the orthogonal components # of our latent space # Parameters for sampling num_songs = 10 print('Generating Latent Samples to Generate {} New Tracks'.format(num_songs))