vendredi 14 août 2020

ValueError: low >= high

def training(epochs=1, batch_size=128):

valid = np.ones((batch_size, 1))
fake = np.zeros((batch_size, 1))

for e in range(1,epochs+1 ):
    print("Epoch %d" %e)
    for _ in tqdm(range(batch_size)):
    #generate  random noise as an input  to  initialize the  generator
        noise= np.random.normal(0,1, [batch_size, 50])
        
        # Generate fake data from noised input
        generated_data = generator.predict(noise)
        
        # Get a random set of  real data
        data =b[np.random.randint(0,b[0],size=batch_size)]
        
        #Training the discriminator to detect more accurately 
        #whether a generated image is real or fake 
        discm_loss_real = discriminator.train_on_batch(data, valid) 
        discm_loss_fake = discriminator.train_on_batch(generated_data, fake) 
        discm_loss = 0.5 * np.add(discm_loss_real, discm_loss_fake) 
        
        #Training the Generator 

        #Training the generator to generate images 
        #which pass the authenticity test 
        genr_loss = combined_network.train_on_batch(noise, valid) 
        
    if e == 1 or e % 20 == 0:
       
        generate_and_save_data()

training(500,128)

enter image description here

Plesae help me to solve the issue. I went through similar problems but could not find effective solution.




Aucun commentaire:

Enregistrer un commentaire