Views
No views yet
npm i @huggingface/transformersXenova/segformer_b0_clothes.1import { pipeline } from '@huggingface/transformers';
2
3const segmenter = await pipeline('image-segmentation', 'Xenova/segformer_b0_clothes');
4
5const url = 'https://freerangestock.com/sample/139043/young-man-standing-and-leaning-on-car.jpg';
6const output = await segmenter(url);
7console.log(output)
8// [
9// {
10// score: null,
11// label: 'Background',
12// mask: RawImage { ... }
13// },
14// {
15// score: null,
16// label: 'Hair',
17// mask: RawImage { ... }
18// },
19// ...
20// }
21// ]1for (const l of output) {
2 l.mask.save(`${l.label}.png`);
3}
onnx).