xtudbxk / DSRG-tensorflow

a tensorflow version for DSRG (Weakly-Supervised Semantic Segmentation Network with Deep Seeded Region Growing)
75 stars 20 forks source link

Meet Runtime Warning lead to constrain_loss:0.000000 #11

Closed SkeletonOne closed 5 years ago

SkeletonOne commented 5 years ago

After training 250 iterations, I meet a problem of RuntimeWarning: divide by zero encountered in log

unary = -np.log(feat)

after that, constrain_loss=0.000000, how could I colve this problem?

xtudbxk commented 5 years ago

In general, you can add a small positive number to pretend the feat from zero. That's says unary = -np.log(feat+1e-5) may helps.

SkeletonOne commented 5 years ago

Yeah that's a great idea to solve my problem. thx a lot! :)