neuraloperator / Geo-FNO

Geometry-Aware Fourier Neural Operator (Geo-FNO)
MIT License
174 stars 46 forks source link

FNO2D outputs constant prediction value #5

Closed jinyi12 closed 1 year ago

jinyi12 commented 1 year ago

I am trying to utilize FNO2D on my own set of data and got constant prediction as the model output. I have modified

Details: in_channels = 3 out_channels = 1

We aim to map a non-gaussian random field to an output field.

The input field is a non-gaussian random field, with coefficients on each mesh points. The output field have different coordinates of mesh points, with the solution a(x_out, y_out) on each mesh points.

Input data is of shape [Number of samples, Number of mesh points, 3], where 3 equates to having x values, y values and the coefficients of the non-gaussian random field.

the x_in, y_in coordinates of the input field were given as x_in to the model, and x_out, y_out coordinates were given as x_out to the model.

Problem: The output solution on every mesh points is a single value. I investigated the output of each Fourier layer and noticed that the output values of each layer gets more similar (constant-ish) as it progresses through each Fourier layer. I have tried increasing the Fourier modes in hopes to account for higher frequency variations in the input data, to no avail.

Any help or advice is appreciated!

zongyi-li commented 1 year ago

It sounds like there is a bug in the setup, so the model can't learn anything. Just to check, when you call the FNO model, did you use out = model(u, x_in= x_in, x_out= x_out), where x_in is (x_in, y_in) and x_out is (x_out, y_out).

And to begin, it may be helpful to define the deformation IPHI as a constant function (just return x in the forward function).

A few more questions: what is your Number of samples? what are the training and testing/validation errors?

jinyi12 commented 1 year ago

Hi! Thanks for the prompt reply!

I did use out = model(u, x_in = x_in, x_out = x_out). u have shape [batch_size, Number of mesh points, 3]. Just to clarify, my x_out and y_out are x coordinates and y coordinates of the output field respectively.

Number of samples: 3207 Both training and validation errors floats around a constant after just 2 or 3 epochs.

Will definitely try out having the deformation IPHI as a constant function.

Thanks!

jinyi12 commented 1 year ago

Hi! With the deformation IPHI set as a constant function, the output I am receiving is the same as before, which is a constant value for all points on the mesh.

jinyi12 commented 1 year ago

Hi, thank you for your time, as I have found the issue lies within the output data construction.

Best, Jin