Instructions to use chanc031965/Tesla_Detection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chanc031965/Tesla_Detection with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="chanc031965/Tesla_Detection") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("chanc031965/Tesla_Detection") model = AutoModelForImageClassification.from_pretrained("chanc031965/Tesla_Detection", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -46,27 +46,4 @@ optimising for **Tesla Recall** to minimise missed detections.
|
|
| 46 |
| Precision (Tesla) | 93.3% |
|
| 47 |
| Recall (Tesla) | 97.0% |
|
| 48 |
| F1 Score (Tesla) | 95.1% |
|
| 49 |
-
| F1 Score (Not Tesla)| 94.9% |
|
| 50 |
-
|
| 51 |
-
## Usage
|
| 52 |
-
|
| 53 |
-
```python
|
| 54 |
-
from transformers import AutoImageProcessor, AutoModelForImageClassification
|
| 55 |
-
from PIL import Image
|
| 56 |
-
import torch
|
| 57 |
-
|
| 58 |
-
model = AutoModelForImageClassification.from_pretrained("YOUR_USERNAME/YOUR_MODEL_NAME")
|
| 59 |
-
processor = AutoImageProcessor.from_pretrained("YOUR_USERNAME/YOUR_MODEL_NAME")
|
| 60 |
-
|
| 61 |
-
image = Image.open("car.jpg").convert("RGB")
|
| 62 |
-
inputs = processor(images=image, return_tensors="pt")
|
| 63 |
-
|
| 64 |
-
with torch.no_grad():
|
| 65 |
-
outputs = model(**inputs)
|
| 66 |
-
|
| 67 |
-
probs = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
| 68 |
-
tesla_prob = probs.item() # index 1 = tesla[1]
|
| 69 |
-
|
| 70 |
-
THRESHOLD = 0.6
|
| 71 |
-
print("Is Tesla?", "YES ✅" if tesla_prob >= THRESHOLD else "NO ❌")
|
| 72 |
-
print(f"Tesla probability: {tesla_prob:.3f}")
|
|
|
|
| 46 |
| Precision (Tesla) | 93.3% |
|
| 47 |
| Recall (Tesla) | 97.0% |
|
| 48 |
| F1 Score (Tesla) | 95.1% |
|
| 49 |
+
| F1 Score (Not Tesla)| 94.9% |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|