We first explore different pre-trained features and their capability of part segmentation. We provide a demo to try out:
python part_segment_demo.py --input figs/input/cat_and_cola.jpg --output figs/output/cola.jpg --vocabulary custom --confidence-threshold 0.1 --custom_vocabulary cola --min-image-size 640 --k 4 --weight-name coco_instance_seg --dcrf
python part_segment_demo.py --input figs/input/cat_and_cola.jpg --output figs/output/cat.jpg --vocabulary custom --confidence-threshold 0.1 --custom_vocabulary cat --min-image-size 640 --k 4 --weight-name coco_instance_seg --dcrf
Above command reads cat.jpg
image as input, and use Detic to first segment instance of the prompted class (--custom_vocabulary
, "cat"
in this case). Then it uses the pre-trained features specified with --weight-name
to cluster the features to group pixels.
--k
is used for the number of clusters.--dcrf
is used for applying dense-CRF as post-processing.- See here to find the available
weight-name
options. Please download the weights from Mask2Former (here) and place them under./weights/...
(see here).
If setup correctly, the result should look like below:
Here we evaluate the pixel-grouping as part segments on PartImageNet dataset.
python pixel_grouping_test_net.py --config-file configs/PixelGrouping.yaml --num-gpus 8 --num-machines 1 --eval-only \
PIXEL_GROUPING.NUM_SUPERPIXEL_CLUSTERS 4 \
PIXEL_GROUPING.DISTANCE_METRIC "dot" \
PIXEL_GROUPING.BACKBONE_FEATURE_KEY_LIST '["res3","res4"]' \
PIXEL_GROUPING.FEATURE_NORMALIZE False
- Change settings to explore different configuration.
- If W&B is setup, set
WANDB.DISABLE_WANDB
toFalse
and useWANDB.VIS_PERIOD_TEST
to visualize the part segments.