Upload folder using huggingface_hub
Browse files- README.md +65 -0
- config.json +20 -0
- model_card.json +7 -0
- preprocessor_config.json +21 -0
- pytorch_model.bin +3 -0
README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- image-classification
|
| 5 |
+
- resnet
|
| 6 |
+
- roadwork-detection
|
| 7 |
+
- competitor-model
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# ResNet-18 Roadwork Detector
|
| 11 |
+
|
| 12 |
+
ResNet-18 model for eroadwork
|
| 13 |
+
|
| 14 |
+
## Model Details
|
| 15 |
+
- **Architecture**: ResNet-18
|
| 16 |
+
- **Task**: Binary image classification (Roadwork detection)
|
| 17 |
+
- **Framework**: PyTorch/torchvision
|
| 18 |
+
- **Input Size**: 224x224
|
| 19 |
+
- **Number of Parameters**: ~11M
|
| 20 |
+
- **Output Type**: sigmoid
|
| 21 |
+
|
| 22 |
+
## Usage
|
| 23 |
+
|
| 24 |
+
```python
|
| 25 |
+
import torch
|
| 26 |
+
from torchvision import models, transforms
|
| 27 |
+
from torch import nn
|
| 28 |
+
from PIL import Image
|
| 29 |
+
|
| 30 |
+
# Load model
|
| 31 |
+
model = models.resnet18(weights=None)
|
| 32 |
+
model.fc = nn.Linear(512, 2)
|
| 33 |
+
model.load_state_dict(torch.load('pytorch_model.bin'))
|
| 34 |
+
model.eval()
|
| 35 |
+
|
| 36 |
+
# Prepare image
|
| 37 |
+
transform = transforms.Compose([
|
| 38 |
+
transforms.Resize(256),
|
| 39 |
+
transforms.CenterCrop(224),
|
| 40 |
+
transforms.ToTensor(),
|
| 41 |
+
transforms.Normalize(mean=[0.485, 0.456, 0.406],
|
| 42 |
+
std=[0.229, 0.224, 0.225])
|
| 43 |
+
])
|
| 44 |
+
|
| 45 |
+
image = Image.open('your_image.jpg')
|
| 46 |
+
input_tensor = transform(image).unsqueeze(0)
|
| 47 |
+
|
| 48 |
+
# Inference
|
| 49 |
+
with torch.no_grad():
|
| 50 |
+
output = model(input_tensor)
|
| 51 |
+
prediction = torch.nn.functional.softmax(output, dim=1)
|
| 52 |
+
|
| 53 |
+
print(f"No Roadwork: {prediction[0][0]:.2%}")
|
| 54 |
+
print(f"Roadwork: {prediction[0][1]:.2%}")
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## Classes
|
| 58 |
+
- 0: No Roadwork
|
| 59 |
+
- 1: Roadwork
|
| 60 |
+
|
| 61 |
+
## Submitted By
|
| 62 |
+
5Fc8jh7Yu65v7K4hi9s6d3MkkGJ8g4
|
| 63 |
+
|
| 64 |
+
## Submission Time
|
| 65 |
+
2025-10-24 02:12:45
|
config.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "resnet18",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"ResNet"
|
| 5 |
+
],
|
| 6 |
+
"model_type": "resnet",
|
| 7 |
+
"num_classes": 1,
|
| 8 |
+
"num_labels": 1,
|
| 9 |
+
"id2label": {
|
| 10 |
+
"0": "No Roadwork",
|
| 11 |
+
"1": "Roadwork"
|
| 12 |
+
},
|
| 13 |
+
"label2id": {
|
| 14 |
+
"No Roadwork": 0,
|
| 15 |
+
"Roadwork": 1
|
| 16 |
+
},
|
| 17 |
+
"image_size": 224,
|
| 18 |
+
"num_channels": 3,
|
| 19 |
+
"output_type": "sigmoid"
|
| 20 |
+
}
|
model_card.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_name": "ResNet-18 Roadwork Detector",
|
| 3 |
+
"description": "ResNet-18 model for roadwork",
|
| 4 |
+
"version": "1.0.0",
|
| 5 |
+
"submitted_by": "5Fc8jh7YS4LSNj5Uu65v7K4hi9s6d3MYLDfdjdJgkGJ8E5g4",
|
| 6 |
+
"submission_time": 1761289965
|
| 7 |
+
}
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"do_normalize": true,
|
| 3 |
+
"do_resize": true,
|
| 4 |
+
"do_rescale": true,
|
| 5 |
+
"image_mean": [
|
| 6 |
+
0.485,
|
| 7 |
+
0.456,
|
| 8 |
+
0.406
|
| 9 |
+
],
|
| 10 |
+
"image_std": [
|
| 11 |
+
0.229,
|
| 12 |
+
0.224,
|
| 13 |
+
0.225
|
| 14 |
+
],
|
| 15 |
+
"resample": 3,
|
| 16 |
+
"size": {
|
| 17 |
+
"shortest_edge": 256,
|
| 18 |
+
"height": 224,
|
| 19 |
+
"width": 224
|
| 20 |
+
}
|
| 21 |
+
}
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7a6ab8a768389134d7cc50a1cefaf087892bea80aea583574a68a54827afad80
|
| 3 |
+
size 44785970
|