-
To install SAM3 the instructions are provided here[https://github.com/facebookresearch/sam3/tree/main]. This should be cloned into the image processor subfolder.
-
To download the checkpoints access on huggingface is required to the repo[https://huggingface.co/facebook/sam3.1].
-
Create a hf access token.
-
Create a .env file in the image processor subfolder, and set the HF_TOKEN environment variable to be the access token made
Note If using SAM3 without a CUDA environment, some modifications to the SAM3 source code is required.
To build the images from scratch you will have to make sure that you have Grounded-SAM-2[https://github.com/IDEA-Research/Grounded-SAM-2/tree/main] downloaded, and inside of the image-processor subfolder as this is where the image stores the model. You don't need to run any of the scripts to install it this is all handled in the Dockerfiles. Building may take a little while, as the models and all their dependenices are quite large.
Set the USE_SAM3 environment variable to 0.
-
Make sure docker and either SAM3 or groundedSAM2 are installed correctly.
-
run
docker compose up
These images are built for arm (Mac) architecture, it may require building, tagging and using docker hub if using on alternative formats.
Otherwise if you have the extra power, to run with Kubernetes:
-
If Using SAM3, set the
HF_TOKENin the congigmap.yml to be your token and setUSE_SAM3to '1'. -
Install Minikube[https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Farm64%2Fstable%2Fbinary+download] for local cluster management.
-
Install Helm[https://helm.sh/docs/intro/install/] (Used for KEDA)
-
run
minukube start -
Install KEDA[https://keda.sh/docs/2.19/deploy/]
-
run
kubectl apply -f k8s
SAM2 Does work on any images and any prompts, although here if you are looking to recreate my results here is the full dataset[]. Although as each image is huge it will be very time consuming to run and wait for the full dataset. Instead use these detailed images for looking at prompt performance on a few sample images of your choosing.
Here is a compressed version of the same datset in which if looking to use this dataset along with COLMAP[] will achieve must faster inference.
-
Navigate to the Input section of the application.
-
Drag and drop one or more image or archive files into the designated upload area.
-
Go to the View Files page.
-
Look at the 'Uploads' section.
-
Click either select all or select each file you wish to process.
-
Click the Process Files button.
-
Upon the Modal, enter your prompt if you wish to use one or leave it empty for full segmentation.
-
Select the given editing action you wish to carry out before clicking process.
-
This step prepares the images for editing, generating the masks. Files will move in groups of 50 from uploads to processing, and then to processed. To see this happen use the "Refresh Files" button located at the top of the page.
-
From the Processed file list, click the Edit button next to the file you wish to modify.
-
This will open the Edit File view where you can perform detailed object segmentation and modification.
-
The touchup tool, available through the context menu allows for additional manual removal. through a brush like UI, left click and hold to remove pixels from the image and is adjustable through a scale under the image. To exit this right click and normal editing will resume.
-
To save the current state of the object click the Save button and select the file type.
-
In the File View Page navigate to the Saved section.
-
Select the files you wish to download.
-
Select the archive file name. (This will have no effect when only one file is selected as it only downloads that).