Commit
·
1c7ceff
1
Parent(s):
f82a107
model movement
Browse files- tasks/image.py +4 -1
tasks/image.py
CHANGED
@@ -5,6 +5,7 @@ import numpy as np
|
|
5 |
from sklearn.metrics import accuracy_score, precision_score, recall_score
|
6 |
import random
|
7 |
import os
|
|
|
8 |
from ultralytics import YOLO
|
9 |
from .utils.evaluation import ImageEvaluationRequest
|
10 |
from .utils.emissions import tracker, clean_emissions_data, get_space_info
|
@@ -100,7 +101,9 @@ async def evaluate_image(request: ImageEvaluationRequest):
|
|
100 |
# Update the code below to replace the random baseline with your model inference
|
101 |
#--------------------------------------------------------------------------------------------
|
102 |
|
103 |
-
|
|
|
|
|
104 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
105 |
model = model.to(device)
|
106 |
predictions = []
|
|
|
5 |
from sklearn.metrics import accuracy_score, precision_score, recall_score
|
6 |
import random
|
7 |
import os
|
8 |
+
from pathlib import Path
|
9 |
from ultralytics import YOLO
|
10 |
from .utils.evaluation import ImageEvaluationRequest
|
11 |
from .utils.emissions import tracker, clean_emissions_data, get_space_info
|
|
|
101 |
# Update the code below to replace the random baseline with your model inference
|
102 |
#--------------------------------------------------------------------------------------------
|
103 |
|
104 |
+
model_path = Path("tasks", "models")
|
105 |
+
model_name = "best.pt"
|
106 |
+
model = YOLO(Path(model_path, model_name), task="detect")
|
107 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
108 |
model = model.to(device)
|
109 |
predictions = []
|