Skip to content

Conversation

@ashwinvaidya17
Copy link
Contributor

@ashwinvaidya17 ashwinvaidya17 commented Jan 21, 2025

What does this PR do?

  • Add Anomaly Scene
image = Image.open("./data/coco128/images/train2017/000000000074.jpg")
image = image.resize((255, 255))  # Ideally this should be within visualization

heatmap = np.zeros(image.size, dtype=np.uint8)
heatmap[64:96, 64:96] = 255

mask = np.zeros(image.size, dtype=np.uint8)
mask[32:96, 32:96] = 255
mask[40:80, 0:128] = 255

anomaly_result = AnomalyResult(
    anomaly_map=heatmap,
    pred_boxes=np.array([[0, 0, 128, 128], [32, 32, 96, 96]]),
    pred_label="Anomaly",
    pred_mask=mask,
    pred_score=0.85,
)
visualizer = Visualizer()
visualizer.save(image, anomaly_result, "anomaly_result.jpg")

image

image = Image.open("./data/coco128/images/train2017/000000000074.jpg")
image_array = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)

padim = AnomalyDetection.create_model(
    "./data/otx_models/anomaly_stfpm_bottle_mvtec.xml"
)

predictions: AnomalyResult = padim(image_array)
visualizer = Visualizer()
visualizer.save(image, predictions, "visualizer_output.jpg")
image

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Signed-off-by: Ashwin Vaidya <[email protected]>
@github-actions github-actions bot added the tests Related to tests label Jan 21, 2025
@sovrasov
Copy link
Member

@ashwinvaidya17 given the real-word example it looks like we need to introduce confidence rounding parameter to avoid long labels representations.

Signed-off-by: Ashwin Vaidya <[email protected]>
@sovrasov sovrasov added this pull request to the merge queue Jan 22, 2025
Merged via the queue into open-edge-platform:master with commit d3b4084 Jan 22, 2025
16 checks passed
@sovrasov sovrasov added this to the 0.2.6 milestone Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants