diff options
| author | Pseudozoid <sarathmadhavr@gmail.com> | 2024-04-21 13:45:27 +0530 |
|---|---|---|
| committer | Pseudozoid <sarathmadhavr@gmail.com> | 2024-04-21 13:45:27 +0530 |
| commit | 7bfe5069163fc0475f9f9a51ddbc16143f064d3d (patch) | |
| tree | c828133ddd8644115f18344d92a68d4a0e5672e8 | |
| parent | b08f804766e9bf6689424fec56633f5e81d96218 (diff) | |
verbose detection message
| -rw-r--r-- | main.py | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -7,12 +7,14 @@ model = project.version(3).model # infer on a local image json_response = model.predict("./syringe.jpg", confidence=40, overlap=30).json() +threshold = 0.8 +for prediction in json_response["predictions"]: + if prediction["confidence"] > threshold: + # Do something specific + print("Syringe detected!") + break; + # save the JSON response to a file with open('output.json', 'w') as f: json.dump(json_response, f) -# visualize your prediction -# model.predict("your_image.jpg", confidence=40, overlap=30).save("prediction.jpg") - -# infer on an image hosted elsewhere -# print(model.predict("URL_OF_YOUR_IMAGE", hosted=True, confidence=40, overlap=30).json())
\ No newline at end of file |
