autodistill-florence-2 icon indicating copy to clipboard operation
autodistill-florence-2 copied to clipboard

Bug in predict() method [incorrect prompt]

Open danigarciaoca opened this issue 4 months ago • 0 comments

Hi!

First of all, thanks a lot for this huge contribution.

I've been testing Florence-2 recently and believe I've found a significant bug, specifically in the predict() method:

ontology_classes = self.ontology.classes()  <--
result = run_example(
    "<CAPTION_TO_PHRASE_GROUNDING>",
    self.processor,
    self.model,
    image,
    "A photo of " + ", and ".join(ontology_classes) + ".",  <--
)

As it can be seen, when inferencing, the prompt is being composed from the ontology classes instead of from the actual prompts.

Btw, I've also noticed a huge improvement when removing the prefix "A photo of" and just leaving the prompts:

", ".join(ontology_classes) + ".",

Hope it's helpful!

KR,

danigarciaoca avatar Sep 27 '24 15:09 danigarciaoca