hylee commited on
Commit
fa92d59
1 Parent(s): e12fee9
Files changed (1) hide show
  1. modnet.py +2 -2
modnet.py CHANGED
@@ -15,7 +15,7 @@ class ModNet:
15
  self.session = onnxruntime.InferenceSession(model_path, None)
16
 
17
  # Get x_scale_factor & y_scale_factor to resize image
18
- def get_scale_factor(im_h, im_w, ref_size):
19
 
20
  if max(im_h, im_w) < ref_size or min(im_h, im_w) > ref_size:
21
  if im_w >= im_h:
@@ -58,7 +58,7 @@ class ModNet:
58
  im = (im - 127.5) / 127.5
59
 
60
  im_h, im_w, im_c = im.shape
61
- x, y = get_scale_factor(im_h, im_w, ref_size)
62
 
63
  # resize image
64
  im = cv2.resize(im, None, fx=x, fy=y, interpolation=cv2.INTER_AREA)
 
15
  self.session = onnxruntime.InferenceSession(model_path, None)
16
 
17
  # Get x_scale_factor & y_scale_factor to resize image
18
+ def get_scale_factor(self, im_h, im_w, ref_size):
19
 
20
  if max(im_h, im_w) < ref_size or min(im_h, im_w) > ref_size:
21
  if im_w >= im_h:
 
58
  im = (im - 127.5) / 127.5
59
 
60
  im_h, im_w, im_c = im.shape
61
+ x, y = self.get_scale_factor(im_h, im_w, ref_size)
62
 
63
  # resize image
64
  im = cv2.resize(im, None, fx=x, fy=y, interpolation=cv2.INTER_AREA)