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
| # Copyright (c) Facebook, Inc. and its affiliates. | |
| # pyre-unsafe | |
| from .base import RectangleVisualizer, TextVisualizer | |
| class BoundingBoxVisualizer: | |
| def __init__(self): | |
| self.rectangle_visualizer = RectangleVisualizer() | |
| def visualize(self, image_bgr, boxes_xywh): | |
| for bbox_xywh in boxes_xywh: | |
| image_bgr = self.rectangle_visualizer.visualize(image_bgr, bbox_xywh) | |
| return image_bgr | |
| class ScoredBoundingBoxVisualizer: | |
| def __init__(self, bbox_visualizer_params=None, score_visualizer_params=None, **kwargs): | |
| if bbox_visualizer_params is None: | |
| bbox_visualizer_params = {} | |
| if score_visualizer_params is None: | |
| score_visualizer_params = {} | |
| self.visualizer_bbox = RectangleVisualizer(**bbox_visualizer_params) | |
| self.visualizer_score = TextVisualizer(**score_visualizer_params) | |
| def visualize(self, image_bgr, scored_bboxes): | |
| boxes_xywh, box_scores = scored_bboxes | |
| assert len(boxes_xywh) == len( | |
| box_scores | |
| ), "Number of bounding boxes {} should be equal to the number of scores {}".format( | |
| len(boxes_xywh), len(box_scores) | |
| ) | |
| for i, box_xywh in enumerate(boxes_xywh): | |
| score_i = box_scores[i] | |
| image_bgr = self.visualizer_bbox.visualize(image_bgr, box_xywh) | |
| score_txt = "{0:6.4f}".format(score_i) | |
| topleft_xy = box_xywh[0], box_xywh[1] | |
| image_bgr = self.visualizer_score.visualize(image_bgr, score_txt, topleft_xy) | |
| return image_bgr | |