Merge pull request #223 from roboflow/fix/confusion_matrix_plot_bug
🛠️ #212 bug fix
This commit is contained in:
commit
d3da6afa07
|
|
@ -58,7 +58,10 @@ def _with_mask(lines: List[str]) -> bool:
|
|||
|
||||
def _extract_class_names(file_path: str) -> List[str]:
|
||||
data = read_yaml_file(file_path=file_path)
|
||||
return data["names"]
|
||||
names = data["names"]
|
||||
if isinstance(names, dict):
|
||||
names = [names[key] for key in sorted(names.keys())]
|
||||
return names
|
||||
|
||||
|
||||
def _image_name_to_annotation_name(image_name: str) -> str:
|
||||
|
|
|
|||
|
|
@ -85,10 +85,10 @@ class ConfusionMatrix:
|
|||
target_tensors = []
|
||||
for prediction, target in zip(predictions, targets):
|
||||
prediction_tensors.append(
|
||||
cls.detections_to_tensor(prediction, with_confidence=True)
|
||||
ConfusionMatrix.detections_to_tensor(prediction, with_confidence=True)
|
||||
)
|
||||
target_tensors.append(
|
||||
cls.detections_to_tensor(target, with_confidence=False)
|
||||
ConfusionMatrix.detections_to_tensor(target, with_confidence=False)
|
||||
)
|
||||
return cls.from_tensors(
|
||||
predictions=prediction_tensors,
|
||||
|
|
@ -98,9 +98,9 @@ class ConfusionMatrix:
|
|||
iou_threshold=iou_threshold,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@staticmethod
|
||||
def detections_to_tensor(
|
||||
cls, detections: Detections, with_confidence: bool = False
|
||||
detections: Detections, with_confidence: bool = False
|
||||
) -> np.ndarray:
|
||||
if detections.class_id is None:
|
||||
raise ValueError(
|
||||
|
|
|
|||
Loading…
Reference in New Issue