add debug for vpdetection; refactor edge.py