Spaces:
Sleeping
Sleeping
diegokauer
commited on
Commit
•
c7a6674
1
Parent(s):
1609b93
Update model.py
Browse files
model.py
CHANGED
@@ -81,9 +81,9 @@ class Model(LabelStudioMLBase):
|
|
81 |
image = image.crop((x.item(), y.item(), x2.item(), y2.item()))
|
82 |
inputs = self.seg_image_processor(images=image, return_tensors="pt")
|
83 |
logits = self.seg_model(**inputs).logits
|
84 |
-
logits = torch.exp(logits)
|
85 |
print(logits)
|
86 |
-
preds = logits > 0.
|
87 |
preds = [self.seg_id2label[i] for i, pred in enumerate(preds.squeeze().tolist()) if pred]
|
88 |
preds = ["No Reportado"] if "No Reportado" in preds else preds
|
89 |
result_list.append({
|
|
|
81 |
image = image.crop((x.item(), y.item(), x2.item(), y2.item()))
|
82 |
inputs = self.seg_image_processor(images=image, return_tensors="pt")
|
83 |
logits = self.seg_model(**inputs).logits
|
84 |
+
logits = 1 / (1 + torch.exp(-logits))
|
85 |
print(logits)
|
86 |
+
preds = logits > 0.25
|
87 |
preds = [self.seg_id2label[i] for i, pred in enumerate(preds.squeeze().tolist()) if pred]
|
88 |
preds = ["No Reportado"] if "No Reportado" in preds else preds
|
89 |
result_list.append({
|