Is my Keras Convolutional Model returning any values?

BBirdsell

For my project I'm mostly following this simple GAN tutorial except that my data is in a time series of 3 values between {-1,1}. I striped away a lot of its complexity to try to understand where the discrepancy is coming from. However, after lots of trail & error and Stack Overflow searches it's time I raise my hand and ask for help. I'm running Python 3.6 / Conda 4.8.3 in a VSCode Jupyter notebook on OSX with TensorFlow 2.0.0. My simplified discriminator does not return any errors in my notebook.

def build_discriminator():

    discriminator_input = Input(shape=(4000,3), name='discriminator_input')
    
    x = discriminator_input

    x = Conv1D(32, 3, strides=1, padding="same", input_shape=(4000,3)) (x)
    
    x = LeakyReLU()(x)

    x = Dropout(0.3)(x)

    x = Flatten()(x)

    discriminator_output = Dense(1, activation='sigmoid')(x)

    return Model(discriminator_input, discriminator_output)


#Test it with some random noise of the same shape as the training data

d = build_discriminator()

noise = tf.random.uniform(
    (1,4000,3), minval=-1, maxval=1, dtype=tf.dtypes.float32
)

decision = d(noise)

Output I'm getting:

print(decision)

<tf.Tensor 'model_1/dense_6/Sigmoid:0' shape=(1, 1) dtype=float32>

I was expecting to put random noise in the untrained discriminator the same size as a training sample and at least get a value between [0,1] to test that the network is processing data.

Expected output:

<tf.Tensor [[0.014325]] shape=(1, 1) dtype=float32>

I need a bit of help interpreting this discrepancy. Does that mean my model isn't processing at all? Or am I missing something more subtle? What do I need to change so that my discriminator returns a tensor of values?

BBirdsell

Against recommendations I spend some time removing Keras & Tensorflow from Conda and installing it with pip so that tf.__version__ correctly returned 2.2.0 in the notebook. To my surprise it worked and returned the expected result.

<tf.Tensor: shape=(1, 1), dtype=float32, numpy=array([[0.49497133]], dtype=float32)>

Posting here in case anyone else stumbles across this question with the same problem.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

My PHP function is not returning any values

my Keras model does not predict negative values

Cannot find the reason behind very low accuracy in my Convolutional Net model with Keras

My Keras convolutional model predicted the same image which were imported from different paths, but the prediction results are different

How to add convolutional layer to Keras model?

How to model Convolutional recurrent network ( CRNN ) in Keras

Not returning any values

Count not returning any values

Function is not returning any values

Why does my convolutional model does not learn?

Model.Predict is returning same values when using TF Keras ImageDataGenerator

Any way to correctly implement taylor expansion of convolutional NN in keras?

Implementing custom convolutional layer in Keras - error when loading model

Strange behaviour of the loss function in keras model, with pretrained convolutional base

Java program not returning any values

$q function is not returning any values

Function not returning any values - Python

Laravel belongsTo not returning any values

SQL statement not returning any values

RegExp in Zapier not returning any values

FirebaseRecyclerAdapter model returning null values

How to set kernel values for Keras convolutional layer in TF 2.0?

Keras: My model trains without any given labels. How's it possible?

Keras model loss function returning nan

keras sequential model returning loss: nan

Dose any one know why post man is returning null values from fields that are not on my sql table?

Saving normalization values in Keras model

My code returning incorrect values

Problem in returning values with my procedure