Refactory detector_proxy.py into cmd and img proxy