Spaces:
Runtime error
Runtime error
Update model.py
Browse files
model.py
CHANGED
@@ -23,7 +23,7 @@ class Model:
|
|
23 |
|
24 |
|
25 |
def _load_model(self, name: str) -> nn.Module:
|
26 |
-
return init_detector('configs/
|
27 |
|
28 |
def set_model(self, name: str) -> None:
|
29 |
if name == self.model_name:
|
@@ -36,9 +36,7 @@ class Model:
|
|
36 |
) -> tuple[list[np.ndarray] | tuple[list[np.ndarray],
|
37 |
list[list[np.ndarray]]]
|
38 |
| dict[str, np.ndarray], np.ndarray]:
|
39 |
-
print('Image1', image.shape)
|
40 |
out = self.detect(image)
|
41 |
-
print('Out1', out)
|
42 |
vis = self.visualize_detection_results(image, out, score_threshold)
|
43 |
return out, vis
|
44 |
|
@@ -46,9 +44,7 @@ class Model:
|
|
46 |
self, image: np.ndarray
|
47 |
) -> list[np.ndarray] | tuple[
|
48 |
list[np.ndarray], list[list[np.ndarray]]] | dict[str, np.ndarray]:
|
49 |
-
print('Image2', image.shape)
|
50 |
out = inference_detector(self.model, image)
|
51 |
-
print('Out2',out)
|
52 |
return out
|
53 |
|
54 |
def visualize_detection_results(
|
|
|
23 |
|
24 |
|
25 |
def _load_model(self, name: str) -> nn.Module:
|
26 |
+
return init_detector('configs/faster-rcnn_r50_organoid_orgaquant.py', 'models/orgaquant_pretrained.pth' , device=self.device)
|
27 |
|
28 |
def set_model(self, name: str) -> None:
|
29 |
if name == self.model_name:
|
|
|
36 |
) -> tuple[list[np.ndarray] | tuple[list[np.ndarray],
|
37 |
list[list[np.ndarray]]]
|
38 |
| dict[str, np.ndarray], np.ndarray]:
|
|
|
39 |
out = self.detect(image)
|
|
|
40 |
vis = self.visualize_detection_results(image, out, score_threshold)
|
41 |
return out, vis
|
42 |
|
|
|
44 |
self, image: np.ndarray
|
45 |
) -> list[np.ndarray] | tuple[
|
46 |
list[np.ndarray], list[list[np.ndarray]]] | dict[str, np.ndarray]:
|
|
|
47 |
out = inference_detector(self.model, image)
|
|
|
48 |
return out
|
49 |
|
50 |
def visualize_detection_results(
|