The code looks basically alright.
One small side note: I’m wondering why you are using a sigmoid in your DenseNet implementation, but that’s unrelated to your problem.
Could you post the code where you initialize your model and feed the data?