NielsRogge / Transformers-Tutorials

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

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

Open unmo opened 5 months ago

unmo commented 5 months 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 months ago

Hi,

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