This release is a pre-release and may not be stable for production use.
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
Release files for samclipdiffusion 0.0.3b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| samclipdiffusion-0.0.3b0.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| samclipdiffusion-0.0.3b0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.9 kB
Release files / samclipdiffusion-0.0.3b0.tar.gz
| Download URL | samclipdiffusion-0.0.3b0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb038e08382eaaa8d460c1f1edd0ff129744de5b6dd2abff4f156812bec555dc
|
|
BLAKE2b-256 checksum How to use checksums |
f62d3e5d6315b589a480e48c7536a664c6e6e10bd0aa21dfba19fb084a2964db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.3
|
Release files / samclipdiffusion-0.0.3b0-py3-none-any.whl
| Download URL | samclipdiffusion-0.0.3b0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
159fab398d3f38d7f825f91c0aaa692df3fa9b61755d5c163ff7b82b2e6d7a70
|
|
BLAKE2b-256 checksum How to use checksums |
074c940731f56398833af01028ee14c08c9dd382c6c0df076f67f63c59f2fc4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.3
|