Skip to main content

A package for clip-guided diffusion

Project description

SAM + CLIP + DIFFUSION

Stuff about this pipeline was a bit harder to run and follow, I wanted to write a simple package to allow people to use it with a higher level of abstraction. Based on the repos on the citation part.

Installation

pip install samclipdiffusion

Usage

!wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth
from samclipdiffusion import ImageSegmenter
segmenter_inp = ImageSegmenter()

image_path = 'image_path'
search_text = "target object"
prompt = "how to modify"

inpainted_image = segmenter_inp.inpaint_image(image_path, search_text, prompt)

Examples

Examples with and w/o installing the package.

Citation

This repository is based on the following repos, I just merged them together and made some changes to make it work.

https://github.com/IDEA-Research/Grounded-Segment-Anything/blob/main/grounded_sam.ipynb https://github.com/maxi-w/CLIP-SAM/blob/main/main.ipynb

TODO

  • Add more examples
  • Optimize, make it memory efficient, it's awful right now
  • Add better images to the examples :D

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

samclipdiffusion-0.0.1b2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

samclipdiffusion-0.0.1b2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file samclipdiffusion-0.0.1b2.tar.gz.

File metadata

  • Download URL: samclipdiffusion-0.0.1b2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.3

File hashes

Hashes for samclipdiffusion-0.0.1b2.tar.gz
Algorithm Hash digest
SHA256 e2647deabe04a4006dc061ab99a9cb47a6a32f39c9889fffe0a3d19b3b7a79a7
MD5 3bdb1102f2be2ec9a582a51ec66685de
BLAKE2b-256 8a8aeb5c0a49a4bd47b05e1164eefe0534ba316bda81f25fff1089b23e8646c0

See more details on using hashes here.

File details

Details for the file samclipdiffusion-0.0.1b2-py3-none-any.whl.

File metadata

File hashes

Hashes for samclipdiffusion-0.0.1b2-py3-none-any.whl
Algorithm Hash digest
SHA256 c10f0dff36f538aa7ef33c0e69ed3d94deb12f9cdcf093784b62776ddead9106
MD5 64a33dfd1c6f1939bf035881eb563a61
BLAKE2b-256 67128f9de53e8f4101484d1644709ff900d82277cace6f9f76bfe962c709dcd3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page