File size: 3,485 Bytes
8ca7c64
 
 
 
 
 
 
 
b452cdf
8ca7c64
 
 
b452cdf
8ca7c64
b452cdf
8ca7c64
 
 
 
b452cdf
8ca7c64
b452cdf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8ca7c64
 
 
b452cdf
8ca7c64
 
 
 
 
 
 
 
b452cdf
8ca7c64
 
 
 
 
 
b452cdf
 
 
 
 
 
 
8ca7c64
 
 
 
 
 
 
 
b452cdf
8ca7c64
b452cdf
8ca7c64
 
 
 
 
 
 
 
b452cdf
8ca7c64
b452cdf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8ca7c64
 
b452cdf
 
 
 
 
 
 
 
 
8ca7c64
b452cdf
 
 
 
 
 
 
 
 
 
 
8ca7c64
 
 
 
b452cdf
 
 
 
 
 
 
 
 
 
 
 
 
 
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---
library_name: ultralytics
tags:
- yolov11
- object-detection
- instance-segmentation
- computer-vision
- deep-learning
- port-detection
license: agpl-3.0
---

# Port Model

This is a custom trained YOLOv11 segmentation model for port detection.

## Model Details

- **Model Type**: YOLOv11 Instance Segmentation
- **Framework**: Ultralytics YOLOv11
- **Task**: Instance Segmentation
- **Classes**: 2
- **Input Size**: 1408x1408
- **Dataset**: Custom Port Dataset

## Classes

- Class 0: Port-capped
- Class 1: Port-Empty

## Model Configuration

```json
{
  "model_type": "yolov11-seg",
  "task": "image-segmentation",
  "framework": "ultralytics",
  "num_classes": 2,
  "id2label": {
    "0": "Port-capped",
    "1": "Port-Empty"
  },
  "input_size": 1408,
  "confidence_threshold": 0.25,
  "iou_threshold": 0.45
}
```

### Training Configuration

- **Epochs**: 100
- **Batch Size**: 16
- **Optimizer**: AdamW
- **Dataset**: Custom Port Dataset


## Usage

### Using Ultralytics (Local Inference)

```python
from ultralytics import YOLO

# Load model
model = YOLO('model.pt')

# Run inference
results = model('image.jpg', conf=0.25, iou=0.45)

# Process results
for result in results:
    masks = result.masks  # Segmentation masks
    boxes = result.boxes  # Bounding boxes
    
    # Get class names
    for box in boxes:
        class_id = int(box.cls)
        class_name = {"0": "Port-capped", "1": "Port-Empty"}[str(class_id)]
        confidence = float(box.conf)
        print(f"Detected: {class_name} ({confidence:.2f})")
    
    # Visualize
    result.show()
```

### Using Hugging Face Inference API

```python
import requests
import json

API_URL = "https://router.huggingface.co/models/Sunix2026/Port-model"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}

def query(filename):
    with open(filename, "rb") as f:
        data = f.read()
    response = requests.post(API_URL, headers=headers, data=data)
    return response.json()

# Run inference
output = query("image.jpg")
print(json.dumps(output, indent=2))
```

### Using the Python Client

```python
from yolov11_hf_inference import YOLOv11HFInference

# Initialize client
client = YOLOv11HFInference(
    model_url="Sunix2026/Port-model",
    access_token="YOUR_HF_TOKEN"
)

# Run inference
result = client.predict_from_path("image.jpg")

if result["success"]:
    predictions = result["predictions"]
    
    # Map class IDs to names
    id2label = {"0": "Port-capped", "1": "Port-Empty"}
    
    for pred in predictions:
        class_name = id2label.get(str(pred.get('label', '')), 'Unknown')
        confidence = pred.get('score', 0)
        print(f"Found: {class_name} ({confidence:.2%})")
else:
    print(f"Error: {result['error']}")
```

## Performance Metrics

| Metric | Value |
|--------|-------|
| Confidence Threshold | 0.25 |
| IoU Threshold | 0.45 |
| Input Resolution | 1408x1408 |

## Applications

This model can be used for:
- Port detection and classification
- Automated quality control
- Manufacturing inspection
- Inventory management

## Limitations

- Model is trained specifically for port detection
- Performance may vary with different lighting conditions
- Best results with images similar to training data

## License

AGPL-3.0

## Citation

If you use this model, please cite:

```bibtex
@misc{Port-model,
  author = {Sunix2026},
  title = {Port Model},
  year = {2025},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/Sunix2026/Port-model}}
}
```