Update app.py
Browse files
app.py
CHANGED
|
@@ -27,24 +27,9 @@ optimizer = optim.Adam(model.parameters(), lr=config.LEARNING_RATE, weight_decay
|
|
| 27 |
|
| 28 |
utils.load_checkpoint("checkpoint.pth[1].tar", model, optimizer, config.LEARNING_RATE)
|
| 29 |
|
| 30 |
-
test_transforms_exp = A.Compose(
|
| 31 |
-
[
|
| 32 |
-
A.LongestMaxSize(max_size=config.IMAGE_SIZE),
|
| 33 |
-
A.PadIfNeeded(
|
| 34 |
-
min_height=config.IMAGE_SIZE, min_width=config.IMAGE_SIZE
|
| 35 |
-
),
|
| 36 |
-
A.Normalize(mean=[0, 0, 0], std=[1, 1, 1], max_pixel_value=255,),
|
| 37 |
-
ToTensorV2(),
|
| 38 |
-
]
|
| 39 |
-
)
|
| 40 |
|
| 41 |
def inference(input_img,show_gradcam="yes", transparency = 0.5, target_layer_number = -1):
|
| 42 |
|
| 43 |
-
transform = transforms.ToTensor()
|
| 44 |
-
org_img = input_img
|
| 45 |
-
input_img = transform(input_img)
|
| 46 |
-
input_img = input_img
|
| 47 |
-
input_img = input_img.unsqueeze(0)
|
| 48 |
out_fig = utils.plot_single_image(model, input_img, 0.6, 0.5,scaled_anchors)
|
| 49 |
return out_fig
|
| 50 |
|
|
|
|
| 27 |
|
| 28 |
utils.load_checkpoint("checkpoint.pth[1].tar", model, optimizer, config.LEARNING_RATE)
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
def inference(input_img,show_gradcam="yes", transparency = 0.5, target_layer_number = -1):
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
out_fig = utils.plot_single_image(model, input_img, 0.6, 0.5,scaled_anchors)
|
| 34 |
return out_fig
|
| 35 |
|