yolo
Browse files
app.py
CHANGED
@@ -240,13 +240,12 @@ def infer(image: Image.Image, model_id: str, confidence_threshold: float = 0.75)
|
|
240 |
"Label": f"Error: {str(e)}"
|
241 |
}
|
242 |
|
243 |
-
def full_prediction(img, confidence_threshold,
|
244 |
"""Full prediction run, with a team of ensembles and agents.
|
245 |
|
246 |
Args:
|
247 |
img (url: str, Image.Image, np.ndarray): The input image to classify.
|
248 |
confidence_threshold (float, optional): The confidence threshold for classification. Defaults to 0.75.
|
249 |
-
augment_methods (list, optional): The augmentation methods to use.
|
250 |
rotate_degrees (int, optional): The degrees to rotate the image.
|
251 |
noise_level (int, optional): The noise level to use.
|
252 |
sharpen_strength (int, optional): The sharpen strength to use.
|
@@ -283,9 +282,8 @@ def full_prediction(img, confidence_threshold, augment_methods, rotate_degrees,
|
|
283 |
context_agent = ContextualIntelligenceAgent()
|
284 |
anomaly_agent = ForensicAnomalyDetectionAgent()
|
285 |
health_agent.monitor_system_health()
|
286 |
-
|
287 |
-
|
288 |
-
img_pil, _ = augment_image(img, augment_methods, rotate_degrees, noise_level, sharpen_strength)
|
289 |
else:
|
290 |
img_pil = img
|
291 |
img_np_og = np.array(img)
|
@@ -429,7 +427,6 @@ detection_model_eval_playground = gr.Interface(
|
|
429 |
inputs=[
|
430 |
gr.Image(label="Upload Image to Analyze", sources=['upload', 'webcam'], type='filepath'),
|
431 |
gr.Slider(0.0, 1.0, value=0.7, step=0.05, label="Confidence Threshold"),
|
432 |
-
gr.CheckboxGroup(["rotate", "add_noise", "sharpen"], label="Augmentation Methods"),
|
433 |
gr.Slider(0, 45, value=0, step=1, label="Rotate Degrees", visible=False),
|
434 |
gr.Slider(0, 50, value=0, step=1, label="Noise Level", visible=False),
|
435 |
gr.Slider(0, 50, value=0, step=1, label="Sharpen Strength", visible=False)
|
|
|
240 |
"Label": f"Error: {str(e)}"
|
241 |
}
|
242 |
|
243 |
+
def full_prediction(img, confidence_threshold, rotate_degrees, noise_level, sharpen_strength):
|
244 |
"""Full prediction run, with a team of ensembles and agents.
|
245 |
|
246 |
Args:
|
247 |
img (url: str, Image.Image, np.ndarray): The input image to classify.
|
248 |
confidence_threshold (float, optional): The confidence threshold for classification. Defaults to 0.75.
|
|
|
249 |
rotate_degrees (int, optional): The degrees to rotate the image.
|
250 |
noise_level (int, optional): The noise level to use.
|
251 |
sharpen_strength (int, optional): The sharpen strength to use.
|
|
|
282 |
context_agent = ContextualIntelligenceAgent()
|
283 |
anomaly_agent = ForensicAnomalyDetectionAgent()
|
284 |
health_agent.monitor_system_health()
|
285 |
+
if rotate_degrees or noise_level or sharpen_strength:
|
286 |
+
img_pil, _ = augment_image(img, ["rotate", "add_noise", "sharpen"], rotate_degrees, noise_level, sharpen_strength)
|
|
|
287 |
else:
|
288 |
img_pil = img
|
289 |
img_np_og = np.array(img)
|
|
|
427 |
inputs=[
|
428 |
gr.Image(label="Upload Image to Analyze", sources=['upload', 'webcam'], type='filepath'),
|
429 |
gr.Slider(0.0, 1.0, value=0.7, step=0.05, label="Confidence Threshold"),
|
|
|
430 |
gr.Slider(0, 45, value=0, step=1, label="Rotate Degrees", visible=False),
|
431 |
gr.Slider(0, 50, value=0, step=1, label="Noise Level", visible=False),
|
432 |
gr.Slider(0, 50, value=0, step=1, label="Sharpen Strength", visible=False)
|