added doc string
Browse files
app.py
CHANGED
@@ -14,6 +14,18 @@ classes = ('plane', 'car', 'bird', 'cat', 'deer',
|
|
14 |
'dog', 'frog', 'horse', 'ship', 'truck')
|
15 |
|
16 |
def inference(input_img, transparency = 0.5, target_layer_number = -1, num_top_classes = 5):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
transform = transforms.ToTensor()
|
18 |
org_img = input_img
|
19 |
input_img = transform(input_img)
|
|
|
14 |
'dog', 'frog', 'horse', 'ship', 'truck')
|
15 |
|
16 |
def inference(input_img, transparency = 0.5, target_layer_number = -1, num_top_classes = 5):
|
17 |
+
"""This function take input as an image and generate Grad Cam image of it.
|
18 |
+
|
19 |
+
Args:
|
20 |
+
input_img (_type_): Input image provided by user.
|
21 |
+
transparency (float, optional): _description_. Defaults to 0.5.
|
22 |
+
target_layer_number (int, optional): Output of layer which will be given to Grad Cam. Defaults to -1.
|
23 |
+
num_top_classes (int, optional): To show number of classes to show in the output. Defaults to 5.
|
24 |
+
|
25 |
+
Returns:
|
26 |
+
top: Top Classes and Confidence level of the prediction
|
27 |
+
visualization: Grad Cam output
|
28 |
+
"""
|
29 |
transform = transforms.ToTensor()
|
30 |
org_img = input_img
|
31 |
input_img = transform(input_img)
|