From 2ac669bcfd28de98d77c72839804fa49150abc99 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Tue, 20 Jul 2021 08:03:53 +0300 Subject: [PATCH] [~] Refactor --- d1/mlb_player_v4.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/d1/mlb_player_v4.py b/d1/mlb_player_v4.py index 93d815f..9233c55 100644 --- a/d1/mlb_player_v4.py +++ b/d1/mlb_player_v4.py @@ -478,7 +478,12 @@ if use_gpu: # In[8]: -def estimate_pose(img_ori): +def estimate_pose(img_ori, name=None): + if name is None: + name = tempfile.mktemp( + dir='/kaggle/working', + suffix='.png', + ) # People might be at different scales in the image, perform inference at multiple scales to boost results scale_param = [0.5, 1.0, 1.5, 2.0] @@ -499,7 +504,7 @@ def estimate_pose(img_ori): img_canvas = link_key_point(img_points, candidates, subsets) - plt.figure(figsize=(15, 10)) + f = plt.figure(figsize=(15, 10)) plt.subplot(1, 2, 1) plt.imshow(img_points[...,::-1]) @@ -507,6 +512,8 @@ def estimate_pose(img_ori): plt.subplot(1, 2, 2) plt.imshow(img_canvas[...,::-1]) + f.savefig(name) + # In[9]: