The systems allows to create segmentation models without training based on:
An arbitrary text query
Or an image with a mask highlighting stuff or an object.
Quick Start
In the Quickstart.ipynb notebook we provide the code for using a pre-trained CLIPSeg model. If you run the notebook locally, make sure you downloaded the rd64-uni.pth weights, either manually or via git lfs extension.
It can also be used interactively using MyBinder
(please note that the VM does not use a GPU, thus inference takes a few seconds).
Dependencies
This code base depends on pytorch, torchvision and clip (pip install git+https://github.com/openai/CLIP.git).
Additional dependencies are hidden for double blind review.
Datasets
PhraseCut and PhraseCutPlus: Referring expression dataset
PFEPascalWrapper: Wrapper class for PFENet's Pascal-5i implementation
PascalZeroShot: Wrapper class for PascalZeroShot
COCOWrapper: Wrapper class for COCO.
Models
CLIPDensePredT: CLIPSeg model with transformer-based decoder.
ViTDensePredT: CLIPSeg model with transformer-based decoder.
Third Party Dependencies
For some of the datasets third party dependencies are required. Run the following commands in the third_party folder.
To train use the training.py script with experiment file and experiment id parameters. E.g. python training.py phrasecut.yaml 0 will train the first phrasecut experiment which is defined by the configuration and first individual_configurations parameters. Model weights will be written in logs/.
For evaluation use score.py. E.g. python score.py phrasecut.yaml 0 0 will train the first phrasecut experiment of test_configuration and the first configuration in individual_configurations.
Usage of PFENet Wrappers
In order to use the dataset and model wrappers for PFENet, the PFENet repository needs to be cloned to the root folder.
git clone https://github.com/Jia-Research-Lab/PFENet.git
License
The source code files in this repository (excluding model weights) are released under MIT license.
LICENSE
The model is licensed with a CreativeML Open RAIL-M license. The authors claim no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in this license. The license forbids you from sharing any content that violates any laws, produce any harm to a person, disseminate any personal information that would be meant for harm, spread misinformation and target vulnerable groups. For the full list of restrictions please read the license
Biases and content acknowledgment
Despite how impressive being able to turn text into image is, beware to the fact that this model may output content that reinforces or exacerbates societal biases, as well as realistic faces, pornography and violence. The model was trained on the LAION-5B dataset, which scraped non-curated image-text-pairs from the internet (the exception being the removal of illegal content) and is meant for research purposes. You can read more in the model card