Adaptive learning for spin-based quantum imaging