1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

image regression in TF2 Keras

Discussion in 'Computer Science' started by V.Hunon, Sep 16, 2020.

  1. V.Hunon

    V.Hunon Guest

    I am trying to figure out, how I could build a model which takes an input image of varying illuminations and outputs an image which has adjusted illuminations by a given label-image.

    I found out that regression might be the right keyword to search for, unfortunately I haven't found anything useful yet (neural style transfer, regression). The closest thing would be this here. However, according to this git it will takes the image coordinates to "regress" towards the label pixels.

    What I have so far is something like this:

    input_shape = np.shape(img) # array of(300, 300, 3)

    model = tf.keras.models.Sequential([
    # Note the input shape is the desired size of the image 300x300 with 3 bytes color
    tf.keras.layers.Conv2D(64, (3,3), activation='relu', input_shape=input_shape),
    tf.keras.layers.MaxPooling2D(2, 2),

    tf.keras.layers.Conv2D(128, (3,3), activation='relu'),

    # Flatten the results to feed into a DNN

    tf.keras.layers.Dense(512, activation='relu'),
    tf.keras.layers.Dense(num_img_pixels, activation='relu')

    model.compile(loss='mean_squared_error', optimizer='adam')
    # x are training images, a tensor with 4 dims [batch_size, 300, 300, 3]
    # y are training labels a tensor with [batch_size, 300*300*3]
    model.fit(x, y, ...)

    result = model.predict([test_img])
    result = np.reshape(result[0], input_shape)

    Due to the lack of my knowledge I would like to know if there is a similar problem out there and how I could solve that. Thanks in advance.

    Login To add answer/comment

Share This Page