Spaces:
Sleeping
Sleeping
Commit
·
a857acc
1
Parent(s):
d342cfa
Update model.py
Browse files
model.py
CHANGED
|
@@ -71,6 +71,22 @@ class Model(LabelStudioMLBase):
|
|
| 71 |
for score, label, box in zip(results['scores'], results['labels'], results['boxes']):
|
| 72 |
label_id = str(uuid4())
|
| 73 |
x, y, x2, y2 = tuple(box)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
result_list.append({
|
| 75 |
'id': label_id,
|
| 76 |
'original_width': original_width,
|
|
|
|
| 71 |
for score, label, box in zip(results['scores'], results['labels'], results['boxes']):
|
| 72 |
label_id = str(uuid4())
|
| 73 |
x, y, x2, y2 = tuple(box)
|
| 74 |
+
result_list.append({
|
| 75 |
+
'id': label_id,
|
| 76 |
+
'original_width': original_width,
|
| 77 |
+
'original_height': original_height,
|
| 78 |
+
'from_name': "bbox",
|
| 79 |
+
'to_name': "image",
|
| 80 |
+
'type': 'rectangle',
|
| 81 |
+
'score': score.item(), # per-region score, visible in the editor
|
| 82 |
+
'value': {
|
| 83 |
+
'x': x.item(),
|
| 84 |
+
'y': y.item(),
|
| 85 |
+
'width': (x2-x).item(),
|
| 86 |
+
'height': (y2-y).item(),
|
| 87 |
+
'rotation': 0,
|
| 88 |
+
}
|
| 89 |
+
})
|
| 90 |
result_list.append({
|
| 91 |
'id': label_id,
|
| 92 |
'original_width': original_width,
|