O Test
๐จ
ols test
Hey! really appreciate the reply, I've just raised this github issue like you said with more info - https://github.com/xenova/transformers.js/issues/585
// npm i @xenova/transformers
import { SamModel, AutoProcessor, RawImage } from '@xenova/transformers';
// Load model and processor
const model = await SamModel.from_pretrained('Xenova/slimsam-77-uniform');
const processor = await AutoProcessor.from_pretrained('Xenova/slimsam-77-uniform');
// Prepare image and input points
const img_url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/corgi.jpg';
const raw_image = await RawImage.read(img_url);
const input_points = [[[340, 250]]];
// Process inputs and perform mask generation
const inputs = await processor(raw_image, input_points);
const outputs = await model(inputs);
// Post-process masks
const masks = await processor.post_process_masks(outputs.pred_masks, inputs.original_sizes, inputs.reshaped_input_sizes);
console.log(masks);
// Visualize the mask
const image = RawImage.fromTensor(masks[0][0].mul(255));
image.save('mask.png');
Hey, quick question on this. I've been playing around with it and loving it. I wanted to know that if I wanted to take Metas approach and compute the image embeddings server side would I be able to use the normal sam-vit-base on the server alongside xenova\sam-vit-base on the frontend for decoding?