Aller au contenu
ModelPrésentéExterne
Télécharger

U 2 Net Human Seg

U-2-Net-Human-Seg is a specialised version of the U-2-Net model designed specifically for human segmentation tasks. This model excels in distinguishing human figures from the background in images, making it...

TypeOtherVersionRevision 4523316BClasse

Source du modèle

Type
Other
Taille du fichier
4,36 MB
Version
vRevision 4523316
Mis à jour
9 oct. 2026
Téléchargements
19
Source
Hugging Face

Description de la source

U-2-Net-Human-Seg

Model Description

U-2-Net-Human-Seg is a specialised version of the U-2-Net model designed specifically for human segmentation tasks. This model excels in distinguishing human figures from the background in images, making it particularly useful for applications such as background removal, virtual try-ons, and human-centric image editing. By leveraging a deep learning approach, U-2-Net-Human-Seg can accurately segment human subjects in various poses and environments, providing high-quality segmentation masks that can be utilized in different imaging tasks.

Usage

Perform mask generation with BritishWerewolf/U-2-Net-Human-Seg.

Example

import { AutoModel, AutoProcessor, RawImage } from '@huggingface/transformers';

const img_url = 'https://huggingface.co/ybelkada/segment-anything/resolve/main/assets/car.png';
const image = await RawImage.read(img_url);

const processor = await AutoProcessor.from_pretrained('BritishWerewolf/U-2-Net-Human-Seg');
const processed = await processor(image);

const model = await AutoModel.from_pretrained('BritishWerewolf/U-2-Net-Human-Seg', {
    dtype: 'fp32',
});

const output = await model({ input: processed.pixel_values });
// {
//   mask: Tensor {
//     dims: [ 1, 320, 320 ],
//     type: 'uint8',
//     data: Uint8Array(102400) [ ... ],
//     size: 102400
//   }
// }

Model Architecture

The U-2-Net-Human-Seg model is based on a simplified version of the original U-2-Net architecture, designed to be more lightweight while still achieving high performance in segmentation tasks. The model consists of several stages with down-sampling and up-sampling paths, using Residual U-blocks (RSU) for enhanced feature representation.

Inference

To use the model for inference, you can follow the example provided above. The AutoProcessor and AutoModel classes from the transformers library make it easy to load the model and processor.

Credits

Licence

This model is licensed under the Apache License 2.0 to match the original U-2-Net model.

Sources

1 source
Hugging FacePrincipalVersion 4523316b9d10bdf3b966804fa56c4f8d24958d40
huggingface.co/sunseeker001/U-2-Net-Human-Seg/tree/4523316b9d10bdf3b966804fa56c4f8d24958d40

Vérifié 9 oct.

Artefacts du modèle

1 artefact

onnx/model.onnx

onnx · 4,36 MB · SHA-256 309c8469258d…ddd8 · Hugging Face

Download file

Extraits de sources

3 extraits

--- library_name: transformers pipeline_tag: image-segmentation tags: - image-segmentation - mask-generation - transformers.js - vision - background-removal - portrait-matting license: apache-2.0 language: - en --- # U-2-Net-Human-Seg ## Model Description U-2-Net-Human-Seg is a specialised version of the U-2-Net model designed specifically for human segmentation tasks. This model excels in distinguishing human figures from the background in images, making it particularly useful for applications such as background removal, virtual try-ons, and human-centric image editing. By leveraging a deep learning approach, U-2-Net-Human-Seg can accurately segment human subjects in various poses and environments, providing high-quality segmentation masks that can be utilized in different imaging tasks. ## Usage Perform mask generation with `BritishWerewolf/U-2-Net-Human-Seg`. ### Example ```javascript import { AutoModel, AutoProcessor, RawImage } from '@huggingface/transformers'; const img_url = 'https://huggingface.co/ybelkada/segment-anything/resolve/main/assets/car.png'; const image = await RawImage.read(img_url); const processor = await AutoProcessor.from_pretrained('BritishWerewolf/U-2-Net-Human-Seg'); const processed = await processor(image); const model = await AutoModel.from_pretrained('BritishWerewolf/U-2-Net-Human-Seg', { dtype: 'fp32', }); const output = await model({ input: processed.pixel_values }); // { // mask: Tensor { // dims: [ 1, 320, 320 ], // type: 'uint8', // data: Uint8Array(102400) [ ... ], // size: 102400 // } // } ``` ## Model Architecture The U-2-Net-Human-Seg model is based on a simplified version of the original U-2-Net architecture, designed to be more lightweight while still achieving high performance in segmentation tasks. The model consists of several stages with down-sampling and up-sampling paths, using Residual U-blocks (RSU) for enhanced feature representation. ### Inference To use the model for inference, you can follow the example provided above. The `AutoProcessor` and `AutoModel` classes from the `transformers` library make it easy to load the model and processor. ## Credits * [`rembg`](https://github.com/danielgatis/rembg) for the ONNX model. * The authors of the original U-2-Net model can be credited at https://github.com/xuebinqin/U-2-Net. ## Licence This model is license...

Source context: 19 downloads · 1 likes · Pipeline image-segmentation · Library transformers · Repo sunseeker001/U-2-Net-Human-Seg

Source context: 9 downloads · 0 likes · Pipeline image-segmentation · Library transformers · Repo sunseeker001/U-2-Net-Human-Seg