OneFormer icon indicating copy to clipboard operation
OneFormer copied to clipboard

Bad predictions from HuggingFace pretrained models

Open tldrafael opened this issue 1 year ago • 4 comments

Hi, thanks for sharing this great work.

I was trying to use your model based on the HF example here. But It turned out that it predicts badly, even trying many versions of models on the training ADE20k samples.

import torch
from PIL import Image
from transformers import OneFormerProcessor, OneFormerModel

image = Image.open('ADE_train_00002024.jpg')

processor = OneFormerProcessor.from_pretrained("shi-labs/oneformer_ade20k_swin_large")
model = OneFormerModel.from_pretrained("shi-labs/oneformer_ade20k_swin_large")
inputs = processor(image, ["semantic"], return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

mask_predictions = outputs.transformer_decoder_mask_predictions
pred = mask_predictions[0].argmax(0)

image

The results are very different from the Colab demo.

image

Is there a way to access the colab pretrained weights from the huggingface interface?

tldrafael avatar Jul 14 '23 22:07 tldrafael

Hi @tldrafael, the HF weights are the same as in our colab demo. However, the result does seem strange. Could you share the image with me so I can try it myself? Thanks.

praeclarumjj3 avatar Aug 07 '23 14:08 praeclarumjj3

Sure @praeclarumjj3 , that's the image. ADE_train_00002024

tldrafael avatar Aug 07 '23 18:08 tldrafael

I'm also interested in this issue, is there a solution for it?

davin-win-kyi avatar Oct 30 '23 19:10 davin-win-kyi

Also interested

th0mas-codes avatar Dec 17 '23 13:12 th0mas-codes