generated from dopt-python/py311
add anomaly threshold as constant
This commit is contained in:
parent
cc5d164ec2
commit
f80fbbc1f9
@ -9,6 +9,7 @@ THRESHOLD_BW: Final[int] = 63
|
||||
BACKBONE: Final[str] = "'wide_resnet50_2"
|
||||
LAYERS: Final[tuple[str, str]] = ("layer1", "layer2", "layer3")
|
||||
RATIO: Final[float] = 0.01
|
||||
ANOMALY_THRESHOLD: Final[float] = 0.2
|
||||
|
||||
NUM_VALID_ELECTRODES: Final[int] = 6
|
||||
HEATMAP_FILENAME_SUFFIX: Final[str] = "_Heatmap"
|
||||
|
||||
@ -176,7 +176,7 @@ def infer_image(
|
||||
output = model(input_tensor)
|
||||
|
||||
anomaly_score = output.pred_score.item()
|
||||
anomaly_label = bool(1 if anomaly_score >= 0.2 else 0)
|
||||
anomaly_label = bool(1 if anomaly_score >= const.ANOMALY_THRESHOLD else 0)
|
||||
anomaly_map = output.anomaly_map.squeeze().cpu().numpy()
|
||||
|
||||
img_np = np.array(pil_image)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user