Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -6,24 +6,31 @@ tags:
|
|
| 6 |
- pytorch
|
| 7 |
datasets:
|
| 8 |
- wendys-llc/chkbx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
# Checkbox Classifier
|
| 12 |
|
| 13 |
-
Binary classifier for checkbox states (checked/unchecked).
|
| 14 |
|
| 15 |
-
## Usage
|
| 16 |
|
| 17 |
```python
|
| 18 |
from transformers import pipeline
|
|
|
|
| 19 |
|
| 20 |
# Load pipeline
|
| 21 |
classifier = pipeline("image-classification",
|
| 22 |
model="wendys-llc/checkbox-classifier",
|
| 23 |
trust_remote_code=True)
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
from PIL import Image
|
| 27 |
image = Image.open("checkbox.jpg")
|
| 28 |
result = classifier(image)
|
| 29 |
print(result)
|
|
@@ -31,30 +38,29 @@ print(result)
|
|
| 31 |
# {'label': 'checked', 'score': 0.99},
|
| 32 |
# {'label': 'unchecked', 'score': 0.01}
|
| 33 |
# ]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
```
|
| 35 |
|
| 36 |
-
##
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
-
"wendys-llc/checkbox-classifier",
|
| 45 |
-
trust_remote_code=True
|
| 46 |
-
)
|
| 47 |
-
processor = AutoImageProcessor.from_pretrained("wendys-llc/checkbox-classifier")
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
predicted_class = logits.argmax(-1).item()
|
| 56 |
-
|
| 57 |
-
print(model.config.id2label[predicted_class])
|
| 58 |
-
```
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
| 6 |
- pytorch
|
| 7 |
datasets:
|
| 8 |
- wendys-llc/chkbx
|
| 9 |
+
widget:
|
| 10 |
+
- src: https://i.imgur.com/ExampleChecked.jpg
|
| 11 |
+
candidate_labels: unchecked, checked
|
| 12 |
+
example_title: Checked Box
|
| 13 |
+
- src: https://i.imgur.com/ExampleUnchecked.jpg
|
| 14 |
+
candidate_labels: unchecked, checked
|
| 15 |
+
example_title: Unchecked Box
|
| 16 |
---
|
| 17 |
|
| 18 |
# Checkbox Classifier
|
| 19 |
|
| 20 |
+
Binary classifier for checkbox states (checked/unchecked). Trained on the [wendys-llc/chkbx](https://huggingface.co/datasets/wendys-llc/chkbx) dataset.
|
| 21 |
|
| 22 |
+
## Usage
|
| 23 |
|
| 24 |
```python
|
| 25 |
from transformers import pipeline
|
| 26 |
+
from PIL import Image
|
| 27 |
|
| 28 |
# Load pipeline
|
| 29 |
classifier = pipeline("image-classification",
|
| 30 |
model="wendys-llc/checkbox-classifier",
|
| 31 |
trust_remote_code=True)
|
| 32 |
|
| 33 |
+
# Classify an image
|
|
|
|
| 34 |
image = Image.open("checkbox.jpg")
|
| 35 |
result = classifier(image)
|
| 36 |
print(result)
|
|
|
|
| 38 |
# {'label': 'checked', 'score': 0.99},
|
| 39 |
# {'label': 'unchecked', 'score': 0.01}
|
| 40 |
# ]
|
| 41 |
+
|
| 42 |
+
# Get just the top prediction
|
| 43 |
+
top_result = classifier(image, top_k=1)
|
| 44 |
+
print(f"State: {top_result[0]['label']}")
|
| 45 |
```
|
| 46 |
|
| 47 |
+
## Model Details
|
| 48 |
|
| 49 |
+
- **Architecture**: EfficientNetV2-S
|
| 50 |
+
- **Input Size**: 128x128 RGB images
|
| 51 |
+
- **Training**: Mixed precision on A100 GPU
|
| 52 |
+
- **Validation Accuracy**: 97.1%
|
| 53 |
+
- **License**: Apache 2.0
|
| 54 |
|
| 55 |
+
## Intended Use
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
+
This model is designed to classify UI checkboxes in screenshots or interface images. It works best on:
|
| 58 |
+
- Clear, high-contrast checkbox images
|
| 59 |
+
- Standard UI checkboxes (not hand-drawn)
|
| 60 |
+
- Images where the checkbox is the main focus
|
| 61 |
+
|
| 62 |
+
## Limitations
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
+
- May not work well on hand-drawn checkmarks
|
| 65 |
+
- Trained on UI checkboxes, not paper forms
|
| 66 |
+
- Best performance when checkbox is clearly visible and not too small
|