NielsRogge / Transformers-Tutorials

This repository contains demos I made with the Transformers library by HuggingFace.
MIT License
8.42k stars 1.32k forks source link

Automatic-Mask-Generation use finetuning model on SAM. #443

Open unmo opened 5 days ago

unmo commented 5 days ago

I followed this notebook for finetuning the SAM on custom data, and save finetuning model to "./model_path".

The following code was executed using the resulting model.

from transformers import pipeline
generator = pipeline("mask-generation", model="./model_path", device=0, output_bboxes_mask=True)
outputs = generator(img, points_per_batch=1)

However, I got the same result as the following code.

from transformers import pipeline
generator = pipeline("mask-generation", model="facebook/sam-vit-large", device=0, output_bboxes_mask=True)
outputs = generator(img, points_per_batch=1)

Can you tell me why this happens?

NielsRogge commented 4 hours ago

Hi,

Perhaps you can check some weights using generator.model and see whether you're actually using your custom model.