File size: 1,368 Bytes
f375838 9a09293 f375838 2ce5d17 97d7046 f375838 9a09293 f375838 5f47025 f375838 2ce5d17 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# Gradio app for YOLOv3
import numpy as np
import gradio as gr
from pytorch_grad_cam import GradCAM
from pytorch_grad_cam.utils.image import show_cam_on_image
from pytorch_grad_cam.utils.model_targets import ClassifierOutputTarget
from display import inference, draw_predictions
gr.Interface(
inference,
inputs=[
gr.Image(label="Input Image"),
gr.Slider(0, 1, value=0.50, label="IOU Threshold"),
gr.Slider(0, 1, value=0.50, label="Threshold"),
gr.Checkbox(label="Show GradCam Image"),
gr.Slider(0, 1, value=0.5, label="Opacity of GradCAM"),
],
outputs=gr.Gallery(rows=2, columns=1),
title = "Object Detection : YoloV3 on PASCAL VOC Dataset From Scratch (with GradCAM)"
,examples=[
["Examples/000001.jpg", 0.75, 0.75, True, 0.5],
["Examples/000002.jpg", 0.75, 0.75, True, 0.5],
["Examples/000003.jpg", 0.75, 0.75, True, 0.5],
["Examples/000004.jpg", 0.75, 0.75, True, 0.5],
["Examples/000005.jpg", 0.75, 0.75, True, 0.5],
["Examples/000006.jpg", 0.75, 0.75, True, 0.5],
["Examples/000007.jpg", 0.75, 0.75, True, 0.5],
["Examples/000008.jpg", 0.75, 0.75, True, 0.5],
["Examples/000009.jpg", 0.75, 0.75, True, 0.5],
["Examples/000010.jpg", 0.75, 0.75, True, 0.5]
]
,
layout="horizontal"
).launch()
|