Commit
·
930548c
1
Parent(s):
8845e47
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,44 +1,66 @@
|
|
| 1 |
-
🚗 Car Damage
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
import numpy as np
|
| 24 |
from PIL import Image
|
| 25 |
from transformers import AutoImageProcessor, AutoModelForImageClassification
|
|
|
|
|
|
|
| 26 |
processor = AutoImageProcessor.from_pretrained("beingamit99/car_damage_detection")
|
| 27 |
model = AutoModelForImageClassification.from_pretrained("beingamit99/car_damage_detection")
|
|
|
|
|
|
|
| 28 |
image = Image.open(IMAGE)
|
| 29 |
inputs = processor(images=image, return_tensors="pt")
|
|
|
|
|
|
|
| 30 |
outputs = model(**inputs)
|
| 31 |
logits = outputs.logits.detach().cpu().numpy()
|
| 32 |
predicted_class_id = np.argmax(logits)
|
| 33 |
predicted_proba = np.max(logits)
|
| 34 |
label_map = model.config.id2label
|
| 35 |
predicted_class_name = label_map[predicted_class_id]
|
|
|
|
|
|
|
| 36 |
print(f"Predicted class: {predicted_class_name} (probability: {predicted_proba:.4f})")
|
| 37 |
-
</
|
| 38 |
|
| 39 |
-
|
| 40 |
-
<
|
| 41 |
from transformers import pipeline
|
| 42 |
|
|
|
|
| 43 |
pipe = pipeline("image-classification", model="beingamit99/car_damage_detection")
|
| 44 |
-
|
|
|
|
|
|
| 1 |
+
# 🚗 Car Damage Prediction Model 🛠️
|
| 2 |
+
|
| 3 |
+
Predict car damage with confidence using the **llm VIT bEIT** model! This model is trained to classify car damage into six distinct classes:
|
| 4 |
+
|
| 5 |
+
- **"0"**: *Crack*
|
| 6 |
+
- **"1"**: *Scratch*
|
| 7 |
+
- **"2"**: *Tire Flat*
|
| 8 |
+
- **"3"**: *Dent*
|
| 9 |
+
- **"4"**: *Glass Shatter*
|
| 10 |
+
- **"5"**: *Lamp Broken*
|
| 11 |
+
|
| 12 |
+
## Key Features 🔍
|
| 13 |
+
|
| 14 |
+
- Accurate classification into six car damage categories.
|
| 15 |
+
- Seamless integration into various applications.
|
| 16 |
+
- Streamlined image processing with transformer-based architecture.
|
| 17 |
+
|
| 18 |
+
## Applications 🌐
|
| 19 |
+
|
| 20 |
+
This powerful car damage prediction model can be seamlessly integrated into various applications, such as:
|
| 21 |
+
|
| 22 |
+
- **Auto Insurance Claim Processing:** Streamline the assessment of car damage for faster claim processing.
|
| 23 |
+
- **Vehicle Inspection Services:** Enhance efficiency in vehicle inspection services by automating damage detection.
|
| 24 |
+
- **Used Car Marketplaces:** Provide detailed insights into the condition of used cars through automated damage analysis.
|
| 25 |
+
|
| 26 |
+
Feel free to explore and integrate this model into your applications for accurate car damage predictions! 🌟
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
## How to Use This Model 🤖
|
| 30 |
+
|
| 31 |
+
### Approach
|
| 32 |
+
|
| 33 |
+
### First Approach
|
| 34 |
+
<code>
|
| 35 |
import numpy as np
|
| 36 |
from PIL import Image
|
| 37 |
from transformers import AutoImageProcessor, AutoModelForImageClassification
|
| 38 |
+
|
| 39 |
+
# Load the model and image processor
|
| 40 |
processor = AutoImageProcessor.from_pretrained("beingamit99/car_damage_detection")
|
| 41 |
model = AutoModelForImageClassification.from_pretrained("beingamit99/car_damage_detection")
|
| 42 |
+
|
| 43 |
+
# Load and process the image
|
| 44 |
image = Image.open(IMAGE)
|
| 45 |
inputs = processor(images=image, return_tensors="pt")
|
| 46 |
+
|
| 47 |
+
# Make predictions
|
| 48 |
outputs = model(**inputs)
|
| 49 |
logits = outputs.logits.detach().cpu().numpy()
|
| 50 |
predicted_class_id = np.argmax(logits)
|
| 51 |
predicted_proba = np.max(logits)
|
| 52 |
label_map = model.config.id2label
|
| 53 |
predicted_class_name = label_map[predicted_class_id]
|
| 54 |
+
|
| 55 |
+
# Print the results
|
| 56 |
print(f"Predicted class: {predicted_class_name} (probability: {predicted_proba:.4f})")
|
| 57 |
+
</code>
|
| 58 |
|
| 59 |
+
### Second Approach
|
| 60 |
+
<code>
|
| 61 |
from transformers import pipeline
|
| 62 |
|
| 63 |
+
# Create a classification pipeline
|
| 64 |
pipe = pipeline("image-classification", model="beingamit99/car_damage_detection")
|
| 65 |
+
pipe(IMAGE)
|
| 66 |
+
</code>
|