Update model card with cleaner examples
Browse files
README.md
CHANGED
|
@@ -27,15 +27,15 @@ results = model.predict('image.jpg')
|
|
| 27 |
|
| 28 |
# Get the prediction
|
| 29 |
probs = results[0].probs
|
| 30 |
-
class_id = probs.top1 # 0=
|
| 31 |
confidence = probs.top1conf.item()
|
| 32 |
|
| 33 |
# Interpret results
|
| 34 |
-
if class_id ==
|
| 35 |
print(f"✋ Hand detected: {confidence:.1%}")
|
| 36 |
-
elif class_id ==
|
| 37 |
print(f"💪 Arm detected: {confidence:.1%}")
|
| 38 |
-
else:
|
| 39 |
print(f"❌ No hand/arm detected: {confidence:.1%}")
|
| 40 |
```
|
| 41 |
|
|
@@ -56,7 +56,8 @@ while True:
|
|
| 56 |
results = model(frame)
|
| 57 |
probs = results[0].probs
|
| 58 |
|
| 59 |
-
|
|
|
|
| 60 |
label = f"{classes[probs.top1]}: {probs.top1conf:.1%}"
|
| 61 |
|
| 62 |
cv2.putText(frame, label, (10, 30),
|
|
@@ -163,7 +164,7 @@ async def detect(file: UploadFile = File(...)):
|
|
| 163 |
probs = results[0].probs
|
| 164 |
|
| 165 |
return {
|
| 166 |
-
"class": ['
|
| 167 |
"confidence": float(probs.top1conf)
|
| 168 |
}
|
| 169 |
```
|
|
@@ -231,7 +232,7 @@ curl -X POST -F "file=@test.jpg" http://localhost:8000/detect
|
|
| 231 |
## Model Details
|
| 232 |
|
| 233 |
- **Architecture**: YOLOv8s-cls (5M parameters)
|
| 234 |
-
- **Classes**: 3 (
|
| 235 |
- **Input Size**: 224x224
|
| 236 |
- **Accuracy**: >96% on validation set
|
| 237 |
- **Size**: ~3MB
|
|
|
|
| 27 |
|
| 28 |
# Get the prediction
|
| 29 |
probs = results[0].probs
|
| 30 |
+
class_id = probs.top1 # 0=arm, 1=hand, 2=not_hand (alphabetical order!)
|
| 31 |
confidence = probs.top1conf.item()
|
| 32 |
|
| 33 |
# Interpret results
|
| 34 |
+
if class_id == 1: # hand is index 1
|
| 35 |
print(f"✋ Hand detected: {confidence:.1%}")
|
| 36 |
+
elif class_id == 0: # arm is index 0
|
| 37 |
print(f"💪 Arm detected: {confidence:.1%}")
|
| 38 |
+
else: # not_hand is index 2
|
| 39 |
print(f"❌ No hand/arm detected: {confidence:.1%}")
|
| 40 |
```
|
| 41 |
|
|
|
|
| 56 |
results = model(frame)
|
| 57 |
probs = results[0].probs
|
| 58 |
|
| 59 |
+
# YOLO uses alphabetical order!
|
| 60 |
+
classes = ['arm', 'hand', 'not_hand'] # 0=arm, 1=hand, 2=not_hand
|
| 61 |
label = f"{classes[probs.top1]}: {probs.top1conf:.1%}"
|
| 62 |
|
| 63 |
cv2.putText(frame, label, (10, 30),
|
|
|
|
| 164 |
probs = results[0].probs
|
| 165 |
|
| 166 |
return {
|
| 167 |
+
"class": ['arm', 'hand', 'not_hand'][probs.top1], # alphabetical order
|
| 168 |
"confidence": float(probs.top1conf)
|
| 169 |
}
|
| 170 |
```
|
|
|
|
| 232 |
## Model Details
|
| 233 |
|
| 234 |
- **Architecture**: YOLOv8s-cls (5M parameters)
|
| 235 |
+
- **Classes**: 3 (arm=0, hand=1, not_hand=2) - alphabetical order
|
| 236 |
- **Input Size**: 224x224
|
| 237 |
- **Accuracy**: >96% on validation set
|
| 238 |
- **Size**: ~3MB
|