Git Product home page Git Product logo

Comments (3)

NielsRogge avatar NielsRogge commented on June 2, 2024

cc @EduardoPach

from transformers-tutorials.

EduardoPach avatar EduardoPach commented on June 2, 2024

I'm really excited to see grounding DINO integrated into transformers! I've followed the tutorial link below and tried it on my local machine, but how do I do detection for multiple classes?

(https://github.com/NielsRogge/Transformers-Tutorials/blob/master/Grounding%20DINO/Inference_with_Grounding_DINO_for_zero_shot_object_detection.ipynb)

I saw in the official documentation to do something like "a cat. a remote controller.", but when I tried it, it didn't detect for cat and remote controller individually, but combined them together.

Am I missing something?

TL;DR if you're using the pipeline pass the labels as a list of text (a tip is to add the . at the end as it is expected by the model) and if you're using the model+processor combo use the all in one text way

Hey! So if you're using the ZeroShotObjectDetectionPipeline you have to provide the labels through the candidate_labels argument which is expected to be a list of strings then you should use ["a cat.", "a remote control."] If you're using GroundingDinoForObjectDetection with GroundingDInoProcessor then yeah the way to go is with "a cat. a remote control.".

You may ask, why this weird difference? and the answer is:

  • ZeroShotObjectDetectionPipeline is older than GroundingDino and was probably designed to work with the zero shot models that came first.
  • ZeroShotObjectDetectionPipeline loop through the candidate_labels when doing the inference and post process with the image processor post_process_object_detection and the only reason why GroundingDino is compatible is because of the loop since the post_process_object_detection from GroundingDinoImageProcessor doesn't return the actual text label.
  • If you want to pass all the possible labels in one text and get the text labels you need to use GroundingDinoProcessor post_process_grounded_object_detection and format your text as "label1. label2. label3. ...." as GroundingDino work with sub-sentence level text input.

from transformers-tutorials.

Hangsiin avatar Hangsiin commented on June 2, 2024

@EduardoPach Thanks! I'll try them asap

from transformers-tutorials.

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.