Spaces:
Sleeping
Sleeping
Commit
·
d342cfa
1
Parent(s):
544ec84
Update model.py
Browse files
model.py
CHANGED
@@ -69,7 +69,7 @@ class Model(LabelStudioMLBase):
|
|
69 |
|
70 |
result_list = []
|
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,
|
@@ -80,17 +80,17 @@ class Model(LabelStudioMLBase):
|
|
80 |
'type': 'labels',
|
81 |
'score': score.item(), # per-region score, visible in the editor
|
82 |
'value': {
|
83 |
-
'x': x,
|
84 |
-
'y': y,
|
85 |
-
'width': x2-x,
|
86 |
-
'height': y2-y,
|
87 |
'rotation': 0,
|
88 |
'labels': [self.id2label[label.item()]]
|
89 |
}
|
90 |
})
|
91 |
|
92 |
predictions.append({
|
93 |
-
'score': results['scores'].mean(), # prediction overall score, visible in the data manager columns
|
94 |
'model_version': 'diegokauer/conditional-detr-coe-int', # all predictions will be differentiated by model version
|
95 |
'result': result_list
|
96 |
})
|
|
|
69 |
|
70 |
result_list = []
|
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,
|
|
|
80 |
'type': 'labels',
|
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 |
'labels': [self.id2label[label.item()]]
|
89 |
}
|
90 |
})
|
91 |
|
92 |
predictions.append({
|
93 |
+
'score': results['scores'].mean().item(), # prediction overall score, visible in the data manager columns
|
94 |
'model_version': 'diegokauer/conditional-detr-coe-int', # all predictions will be differentiated by model version
|
95 |
'result': result_list
|
96 |
})
|