提交 0e958957 编写于 作者: H haoyuying

revise model.eval()

上级 3473ae8c
......@@ -5,5 +5,4 @@ if __name__ == "__main__":
paddle.disable_static()
model = hub.Module(name='openpose_body_estimation')
model.eval()
out1, out2 = model.predict("demo.jpg")
......@@ -5,5 +5,4 @@ if __name__ == "__main__":
paddle.disable_static()
model = hub.Module(name='openpose_hands_estimation')
model.eval()
all_hand_peaks = model.predict("demo.jpg")
......@@ -180,6 +180,7 @@ class BodyPoseModel(nn.Layer):
return out6_1, out6_2
def predict(self, img_path: str, save_path: str = "result"):
self.eval()
orgImg = cv2.imread(img_path)
data, imageToTest_padded, pad = self.transform(orgImg)
Mconv7_stage6_L1, Mconv7_stage6_L2 = self.forward(paddle.to_tensor(data))
......
......@@ -170,6 +170,7 @@ class HandPoseModel(nn.Layer):
return np.array(all_peaks)
def predict(self, img_path: str, save_path: str = 'result', scale: list = [0.5, 1.0, 1.5, 2.0]):
self.eval()
self.body_model = hub.Module(name='openpose_body_estimation')
self.body_model.eval()
org_img = cv2.imread(img_path)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册