Dan Bochman commited on
Commit
9e09c4f
·
1 Parent(s): a92eba4

docs: improve usage examples and clarify output formats

Browse files

- Add output format comments to pipeline example
- Note that pipeline auto-manages GPU and returns original resolution
- Update production example with auto GPU detection
- Clarify preprocessing difference (cv2.INTER_AREA vs PIL LANCZOS)

Files changed (1) hide show
  1. README.md +11 -5
README.md CHANGED
@@ -34,10 +34,13 @@ This model segments human images into 18 semantic categories including body part
34
  ```python
35
  from transformers import pipeline
36
 
37
- parser = pipeline("image-segmentation", model="fashn-ai/fashn-human-parser")
38
- result = parser("path/to/image.jpg")
 
39
  ```
40
 
 
 
41
  ### Explicit Usage
42
 
43
  ```python
@@ -67,7 +70,7 @@ predictions = upsampled.argmax(dim=1).squeeze().numpy()
67
 
68
  ### Production Usage (Recommended)
69
 
70
- For production applications requiring maximum accuracy, we recommend using our Python package which implements the exact preprocessing used during training:
71
 
72
  ```bash
73
  pip install fashn-human-parser
@@ -76,10 +79,13 @@ pip install fashn-human-parser
76
  ```python
77
  from fashn_human_parser import FashnHumanParser
78
 
79
- parser = FashnHumanParser(device="cuda")
80
- segmentation = parser.predict(image)
 
81
  ```
82
 
 
 
83
  ## Label Definitions
84
 
85
  | ID | Label |
 
34
  ```python
35
  from transformers import pipeline
36
 
37
+ pipe = pipeline("image-segmentation", model="fashn-ai/fashn-human-parser")
38
+ result = pipe("image.jpg")
39
+ # result is a list of dicts with 'label', 'score', 'mask' for each detected class
40
  ```
41
 
42
+ The pipeline automatically manages GPU/CPU and returns per-class masks at the original image resolution.
43
+
44
  ### Explicit Usage
45
 
46
  ```python
 
70
 
71
  ### Production Usage (Recommended)
72
 
73
+ For maximum accuracy, use our Python package which implements the exact preprocessing used during training:
74
 
75
  ```bash
76
  pip install fashn-human-parser
 
79
  ```python
80
  from fashn_human_parser import FashnHumanParser
81
 
82
+ parser = FashnHumanParser() # auto-detects GPU
83
+ segmentation = parser.predict("image.jpg")
84
+ # segmentation is a numpy array of shape (H, W) with class IDs 0-17
85
  ```
86
 
87
+ The package uses `cv2.INTER_AREA` for resizing (matching training), while the HuggingFace pipeline uses PIL LANCZOS.
88
+
89
  ## Label Definitions
90
 
91
  | ID | Label |