IDEALLab / bezier-gan

Bézier Generative Adversarial Networks
MIT License
37 stars 21 forks source link

Open trailing edge #2

Closed jethromoses closed 2 years ago

jethromoses commented 3 years ago

This method generates airfoils with an open (blunt) trailing edge. Was the GANs also trained on data with open trailing edges? The paper says you trained the GANs on the UIUC database. Did you modify the UIUC database airfoils to have open trailing edges?

wchen459 commented 3 years ago

There are airfoils with open trailing edges in the UIUC database. We did not modify the trailing edges in the data.

jethromoses commented 3 years ago

Is it possible to have the GANs generate airfoils with only sharp closed trailing edges?

wchen459 commented 3 years ago

You can probably add some code after this line in the generator to force the last Bezier control point to be the same as the first one. This would make the generator produce closed Bezier curves.

jethromoses commented 3 years ago

Where do you specify the x location of the control point?

wchen459 commented 3 years ago

In the generator, cp is a tensor with the shape (batch_size, num_control_points, 2). So cp[i, j, 0] is the x location of the j-th control point in the i-th sample.

jethromoses commented 3 years ago

So in your code, how would i do the following cp[:,0,0] = 1 cp[:,0,1] = 0 cp[:,-1,0]=1 cp[:,-1,1]=0

Basically, i'm trying to place the control points on the trailing edge. So the first and last control points should be at (1,0). What would the tensorflow command be for the above?

wchen459 commented 3 years ago

You can try the following:

cp = tf.assign(cp[:,0,0], 1)
cp = tf.assign(cp[:,0,1], 0)
cp = tf.assign(cp[:,-1,0], 1)
cp = tf.assign(cp[:,-1,0], 0)

However, by manually setting the trailing edge coordinates, the distribution of generated airfoils can no longer align with the distribution of the data. This may or may not cause issues when training Bezier-GAN, depends on how different the two distributions can get and the capacity of the discriminator/generator. Anyways, you could try and see if further adjustment is needed.

jethromoses commented 3 years ago

tf.assign() doesn't work.

How does the generator decided where to place the bezier control point? Do you fix some (x,y) locations of the control points?

wchen459 commented 3 years ago

tf.assign() doesn't work

Please provide more information (e.g., error message, code output, etc.).

How does the generator decided where to place the bezier control point? Do you fix some (x,y) locations of the control points?

The generator learns the position of the bezier control points from data. Please see our paper for more details.

jethromoses commented 3 years ago

With tf.assign(), this is the error I get,

ValueError: Tried to convert 'input' to a tensor and failed. Error: None values not supported.

Thanks for your help!

wchen459 commented 3 years ago

The following code should work instead:

cp_te = tf.tile(tf.constant([[[1., 0.]]]), [tf.shape(cp)[0], 1, 1])
cp = tf.concat([cp_te, cp[:,1:-1], cp_te], axis=1)
cp = tf.identity(cp, name='control_point')

Also, delete the "name" argument in line 77:

cp = tf.squeeze(cp, axis=-1)
jethromoses commented 3 years ago

Thanks, that worked!