Differentiable model-based adaptive optics with transmitted and reflected light