So I am making a project based on this paper:
In this paper, a U-Net is used to generate optimized mechanical structures. I am trying to recreate the model and use it on my own generated data.
Now I have two questions:
In 7.1 a pixelwise accuracy is mentioned. Right now I am using the default Keras metric "accuracy", which isn't reaching even close to the accuracy in the paper. (it starts at 0.3ish and goes to like 0.45). What I always do is to manually compare the generated structures to the ground truth in the training set. There are often models which have better accuracy, but the structures make less sense. What accuracy metric did they use in the paper?
In the paper under 4.2.1, the KL Divergence is mentioned. My problem was, that the KL Divergence turned negative after an epoch or two (an Indicator that I don't work with probability distributions?), so I switched to binary cross-entropy, which provides good results, but it is still bothering me , that I cant use the proposed loss method. Another point is the L2 Regularization: I get the best results using 1e-7 or lower as the l2 value, which is low compared to the normally used values. What does that indicate?
Another point I wanted to mention: the dimensions of my data is a little bit different from the ones used in the paper: I use 65x49 as my Input Dimension.
I would appreciate if someone can help me in fixing the problems.
I also tried the following code:
def kullback_leibler_divergence_test(y_true, y_pred): true_sum = K.sum(y_true) pred_sum = K.sum(y_pred) new_true = y_true/true_sum new_pred = y_pred/pred_sum y_true = K.clip(new_true, K.epsilon(), 1) y_pred = K.clip(new_pred, K.epsilon(), 1) return K.sum(y_true * K.log(y_true / y_pred), axis=-1)
and I got a non negative loss!! But the problem is it is very low.
Another approach was using:
def kullback_leibler_divergence_test_2(y_true, y_pred): y_true = K.clip(y_true, K.epsilon(), 1) y_pred = K.clip(y_pred, K.epsilon(), 1) return K.sum(y_true * abs(K.log(y_true / y_pred)), axis=-1)
But the loss was pretty high compared to the Binary Crossentropy and I have the feeling the loss is working not as intended.