This project is a replication of edge detection implemented using Segment Anything. It is reproduced as described in the Segment Anything paper and Segment Anything issues#226. Please advise us if there are any problems.
The code requires python>=3.8
, as well as pytorch>=1.7
and torchvision>=0.8
. Please follow the instructions here to install both PyTorch and TorchVision dependencies. Installing both PyTorch and TorchVision with CUDA support is strongly recommended.
Install Segment Anything:
pip install git+https://github.com/facebookresearch/segment-anything.git
Install opencv:
pip install opencv-python
-
download weight
please refer to segment anything that is a awesome work.
-
edge detect
python edge_detect.py --edge_dir EDGE_DIR --save_dir SAVE_DIR [--sam_checkpoint SAM_CHECKPOINT] [--model_type MODEL_TYPE] [--device DEVICE]