Git Product home page Git Product logo

Comments (6)

SunzeY avatar SunzeY commented on June 8, 2024

Can you show more details of your case? Original CLIP can only input RGB 3 channel only...

from alphaclip.

DavidGetter1 avatar DavidGetter1 commented on June 8, 2024

Exactly, so I just disregard the alpha channel and have my background black which is not working good.

        image_array = np.array(image.image)
        image_array = image_array[:, :, :3] #Here I disregard the alpha channel
        image_pil = Image.fromarray(image_array)
        image_pil = image_pil.resize((224, 224), Image.LANCZOS)
        images_to_sprite_data.append(image_pil)
        image_tensor = preprocess_image(image_pil)
        with torch.no_grad():
            image_embedding = model.encode_image(image_tensor)
            embeddings.append(image_embedding.cpu().numpy()[0]) 

Could I use AlphaCLIP to encode Images with an alpha channel and have its attention only on the area of interest?
n02106550_10481 out
This is an example from my Dataset

from alphaclip.

SunzeY avatar SunzeY commented on June 8, 2024

We cannot assure 100% attention focus, but you can give it a try with our model, or a quick test of our demo!
image
image

from alphaclip.

DavidGetter1 avatar DavidGetter1 commented on June 8, 2024

I've just created an embedding by following the readme.

image_features = model.visual(image, alpha)

I believe the attention is now set by the mask?
I will need to create masks for my dataset and will see whether the results are what im searching for.

from alphaclip.

SunzeY avatar SunzeY commented on June 8, 2024

Yes, if you follow README, you can add region focus by mask, which original CLIP is not capable of. You can try this on your own task to see whether it fit your requirement.

from alphaclip.

DavidGetter1 avatar DavidGetter1 commented on June 8, 2024

Hey I just tried the Model on my use-case and it got me very interesting results. Thank you!

from alphaclip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.