Spaces:
Running
Running
Fix dimension order - PIL resize expects (width, height)
Browse files- PIL Image.resize() expects (width, height) order
- Model expects tensor shape [batch, height, width, channels] = [1, 448, 640, 3]
- Fixed resize to use (640, 448) for width=640, height=448
- Updated UI to clarify HxW format
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
app.py
CHANGED
|
@@ -44,8 +44,9 @@ def preprocess_image(image):
|
|
| 44 |
"""
|
| 45 |
Preprocess image for Person Classification INT8 quantized model.
|
| 46 |
"""
|
| 47 |
-
# Resize to
|
| 48 |
-
|
|
|
|
| 49 |
|
| 50 |
# Convert to numpy array
|
| 51 |
img_array = np.array(image, dtype=np.float32)
|
|
@@ -380,7 +381,7 @@ with gr.Blocks(
|
|
| 380 |
SRAM: ~1.5 MB<br>
|
| 381 |
Flash: ~1.5 MB<br>
|
| 382 |
Model: Person Classifier<br>
|
| 383 |
-
Input: 448×640×3
|
| 384 |
</div>
|
| 385 |
</div>
|
| 386 |
</div>
|
|
|
|
| 44 |
"""
|
| 45 |
Preprocess image for Person Classification INT8 quantized model.
|
| 46 |
"""
|
| 47 |
+
# Resize to 640x448 (width x height) as PIL expects (width, height)
|
| 48 |
+
# Model expects input shape [batch, 448, 640, 3] meaning height=448, width=640
|
| 49 |
+
image = image.resize((640, 448))
|
| 50 |
|
| 51 |
# Convert to numpy array
|
| 52 |
img_array = np.array(image, dtype=np.float32)
|
|
|
|
| 381 |
SRAM: ~1.5 MB<br>
|
| 382 |
Flash: ~1.5 MB<br>
|
| 383 |
Model: Person Classifier<br>
|
| 384 |
+
Input: 448×640×3 (HxW)
|
| 385 |
</div>
|
| 386 |
</div>
|
| 387 |
</div>
|