Optical edge detection is a useful method for characterizing boundaries, which is also in the forefront of image processing for object detection. As the field of metamaterials and metasurface is growing fast in an effort to miniaturize optical devices at unprecedented scales, experimental realization of optical edge detection with metamaterials remains a challenge and lags behind theoretical proposals. Here, we propose a mechanism of edge detection based on a Pancharatnam-Berry-phase metasurface. We experimentally demonstrated broadband edge detection using designed dielectric metasurfaces with high optical efficiency. The metasurfaces were fabricated by scanning a focused laser beam inside glass substrate and can be easily integrated with traditional optical components. The proposed edge-detection mechanism may find important applications in image processing, high-contrast microscopy, and real-time object detection on compact optical platforms such as mobile phones and smart cameras.