Reduced memory footprint of real_detector.py.