Image Segmentation
Transformers
PyTorch
English
garment-mask-generation
image-inpainting
fashion
garment-mask
densepose
human-parsing
Instructions to use Ekliipce/wearit-garment-mask with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ekliipce/wearit-garment-mask with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="Ekliipce/wearit-garment-mask")# Load model directly from transformers import GarmentMaskPipeline model = GarmentMaskPipeline.from_pretrained("Ekliipce/wearit-garment-mask", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,052 Bytes
436df5c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
import os
from typing import Dict, Optional
from detectron2.config import CfgNode
def is_relative_local_path(path: str) -> bool:
path_str = os.fsdecode(path)
return ("://" not in path_str) and not os.path.isabs(path)
def maybe_prepend_base_path(base_path: Optional[str], path: str):
"""
Prepends the provided path with a base path prefix if:
1) base path is not None;
2) path is a local path
"""
if base_path is None:
return path
if is_relative_local_path(path):
return os.path.join(base_path, path)
return path
def get_class_to_mesh_name_mapping(cfg: CfgNode) -> Dict[int, str]:
return {
int(class_id): mesh_name
for class_id, mesh_name in cfg.DATASETS.CLASS_TO_MESH_NAME_MAPPING.items()
}
def get_category_to_class_mapping(dataset_cfg: CfgNode) -> Dict[str, int]:
return {
category: int(class_id)
for category, class_id in dataset_cfg.CATEGORY_TO_CLASS_MAPPING.items()
}
|