File size: 1,341 Bytes
95c2ca1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
license: mit
tags:
- image-classification
- resnet
- roadwork-detection
- competitor-model
---

# ResNet-18 Roadwork Detector

ResNet-18 model for eroadwork

## Model Details
- **Architecture**: ResNet-18
- **Task**: Binary image classification (Roadwork detection)
- **Framework**: PyTorch/torchvision
- **Input Size**: 224x224
- **Number of Parameters**: ~11M
- **Output Type**: sigmoid

## Usage

```python
import torch
from torchvision import models, transforms
from torch import nn
from PIL import Image

# Load model
model = models.resnet18(weights=None)
model.fc = nn.Linear(512, 2)
model.load_state_dict(torch.load('pytorch_model.bin'))
model.eval()

# Prepare image
transform = transforms.Compose([
    transforms.Resize(256),
    transforms.CenterCrop(224),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406],
                       std=[0.229, 0.224, 0.225])
])

image = Image.open('your_image.jpg')
input_tensor = transform(image).unsqueeze(0)

# Inference
with torch.no_grad():
    output = model(input_tensor)
    prediction = torch.nn.functional.softmax(output, dim=1)

print(f"No Roadwork: {prediction[0][0]:.2%}")
print(f"Roadwork: {prediction[0][1]:.2%}")
```

## Classes
- 0: No Roadwork
- 1: Roadwork

## Submitted By
5Fc8jh7Yu65v7K4hi9s6d3MkkGJ8g4

## Submission Time
2025-10-24 02:12:45