samedi 19 décembre 2020

randint method does not work because of parameters in python

Hi in our project we use randint method to produce real samples for machine learning but it does not work. How can we fix it?

def generate_real_samples(dataset, n_samples, patch_shape):
    # unpack dataset
    trainA, trainB = dataset
    # choose random instances
    ix = random.randint(0, trainA.shape[0], n_samples)
    # retrieve selected images
    X1, X2 = trainA[ix], trainB[ix]
    # generate 'real' class labels (1)
    y = numpy.ones((n_samples, patch_shape, patch_shape, 1))
    return [X1, X2], y

error is about parameter dimension. Explanation of this code is here

The generate_real_samples() function below will prepare a batch of random pairs of images from the training dataset, and the corresponding discriminator label of class=1 to indicate they are real.




Aucun commentaire:

Enregistrer un commentaire