diff --git a/inference.py b/inference.py index 389d312..7e8f309 100644 --- a/inference.py +++ b/inference.py @@ -18,7 +18,7 @@ def inference(image_name): img, w, h, _, = preprocess('./voc2007/'+image_name) pred_confs, pred_locs = ssd.infer(images=[img]) locs, labels = ssd.ssd.detect_objects(pred_confs, pred_locs) - img = deprocess(img) + img = deprocess(img, w, h) if len(labels) and len(locs): for label, loc in zip(labels, locs): loc = center2corner(loc) diff --git a/util/util.py b/util/util.py index 96b8986..7bd5fbf 100644 --- a/util/util.py +++ b/util/util.py @@ -24,7 +24,7 @@ def preprocess(path): return img, w, h, c -def deprocess(x): +def deprocess(x, w, h): """ restore processed image @@ -34,4 +34,5 @@ def deprocess(x): # x = x[:, :, ::-1] x *= 255. x = np.clip(x, 0, 255).astype('uint8') + x = imresize(x, (h, w)) return x \ No newline at end of file