Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ state_dict = torch.load('fasterRCNNKangaroo.pth', map_location=torch.device('cpu
|
|
13 |
model.load_state_dict(state_dict)
|
14 |
size = 384
|
15 |
|
16 |
-
|
17 |
def predict(img):
|
18 |
img = PILImage.create(img)
|
19 |
pred_dict = models.torchvision.faster_rcnn.end2end_detect(img, infer_tfms, model.to("cpu"), class_map=class_map, detection_threshold=0.5)
|
|
|
13 |
model.load_state_dict(state_dict)
|
14 |
size = 384
|
15 |
|
16 |
+
infer_tfms = tfms.A.Adapter([*tfms.A.resize_and_pad(size),tfms.A.Normalize()])
|
17 |
def predict(img):
|
18 |
img = PILImage.create(img)
|
19 |
pred_dict = models.torchvision.faster_rcnn.end2end_detect(img, infer_tfms, model.to("cpu"), class_map=class_map, detection_threshold=0.5)
|