Closed dyl0101 closed 4 years ago
Hello,Thank you for sharing your code.I want to know some detail about the loss function. In the function,what does
logits
andfactor_lambda
mean? Isboundary_target
the predicted result? Thanks. `def refine_loss(logits, labels, boundary_target): gamma1 = 0.5 gamma2 = 1-gamma1 factor_lambda= 1.5dy_logits, dx_logits = tf.image.image_gradients(logits) dy_labels, dx_labels = tf.image.image_gradients(labels) # magnitudes of logits and labels gradients Mpred = tf.sqrt(tf.square(dy_logits)+tf.square(dx_logits)) Mimg = tf.sqrt(tf.square(dy_labels)+tf.square(dx_labels)) # define cos loss and mag loss cosL = (1-tf.abs(dx_labels*dx_logits+dy_labels*dy_logits))*Mpred magL = tf.maximum(factor_lambda*Mimg-Mpred,0) # define mask M_bound = boundary_target/255. # define total refine loss refineLoss = (gamma1*cosL + gamma2*magL)*M_bound return tf.reduce_mean(refineLoss) # return tf.reduce_mean(refineLoss), Mpred, Mimg`
logits: model predicted result
factor_lambda: a coefficient mentioned in the paper, "λ is a factor that balances distributional differences between image and output confidence map. In our experiment, λ = 1.5"
boundary target: get from mask by using canny edge detection
By the way, I haven't fully achieved the result of their paper, so please be reminded that there might be errors in my code. I will add this in the readme.
Hello,Thank you for sharing your code.I want to know some detail about the loss function. In the function,what does
logits
andfactor_lambda
mean? Isboundary_target
the predicted result? Thanks. `def refine_loss(logits, labels, boundary_target): gamma1 = 0.5 gamma2 = 1-gamma1 factor_lambda= 1.5