I did as you suggested but the network is still not learning, loss is still constant. I am trying to make pred as close as possible to gt , by constraining them in 2D for that I need numpy and opencv, therefore I need a custom loss function. But my loss is not decreasing , its a constant throughout learning.