- python==3.7.5
- torch==1.13.1
- Torchvision==0.14.1
- Scikit_image==0.19.2
- Skimage==0.0
- timm==0.3.2
- tensorboard==2.11.2
- tensorboardX==2.5.1
- tqdm==4.64.1
- einops==0.4.1
- markdown==3.4.3
- markplotlib==3.5.2
- numpy==1.12.6
- opencv-python==4.7.0.72
- openpyxl==3.1.2
- pillow==9.5.0
- pysodmetrics==1.4.0
- PyYAML==6.0
- tabulate==0.9.0
Following the SAM to create an environment.
Put SAM's pretrained-model-weight in './segment-anything-main/sam_vit_h_4b8939.pth'.
Put image in './segment-anything-main/Images'.
- Box-prompt:
Put B-COD in './segment-anything-main/B-COD'.
python predictor_example_box.py
- Point-prompt:
Put P-COD in './segment-anything-main/P-COD'.
python predictor_muti_point.py
- Scribble-prompt:
Put the discrete point set generated by sampling the scribble using the adapter to './segment-anything-main/point-set'.
python predictor_muti_point.py
- Download scribble supervised dataset S-COD.
python prompt-adapter.py
- Train P_Mask
Train the encoder and decoder supervised by Point_cu, scribble, or Max(SAM(Box_prompt)), where Max(SAM(Box_prompt)) is part of the Segment Anything model.
Put P_mask and segment anything's mask in './xxx'
python Filter_and_Matcher.py
-
Just download the dataset and pretrained model.
-
Train:
The pretrained model weight can be found here: Pretrain_model . (put it in './SAM-guided-Unified-Framework-for-Weakly-Supervised-Camouflaged-Object-Detection/Pretrain_model.pth').
The masks for distillation are in the path './CodDataset/train/Scribble'.
Put the Prompt-kd-mask in './SAM-guided-Unified-Framework-for-Weakly-Supervised-Camouflaged-Object-Detection/CodDataset/train/S_GT'.
Point-kd-mask. Following P-COD:Hint-area-generator.
Box-kd-mask. Following the operations in the paper. Using P-Mask (in section of Filter-and-Mathcer. Foreground set to 1, background set to 2) to compare with the key regions, retain the original values in the key regions, and set the values outside the key regions to 0.
python train.py
- Test and Evaluate:
Put model-best.pth (save in './SAM-guided-Unified-Framework-for-Weakly-Supervised-Camouflaged-Object-Detection/out/trained') in './SAM-guided-Unified-Framework-for-Weakly-Supervised-Camouflaged-Object-Detection/best_model.pth'
python test.py
Weakly-Supervised Camouflaged Object Detection with Scribble Annotations