From 4bfcf1c57831c08bf82d3f87657fd71bc5369150 Mon Sep 17 00:00:00 2001 From: Alberto Casas Ortiz Date: Tue, 10 Dec 2024 14:27:50 -0800 Subject: [PATCH] Intercepting error of human detection pose not detected in hrnet. --- utilsDetector.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utilsDetector.py b/utilsDetector.py index 1e57ddef..31557464 100644 --- a/utilsDetector.py +++ b/utilsDetector.py @@ -319,9 +319,13 @@ def runMMposeVideo( # copy /data/output to pathOutputPkl os.system("cp /data/output_mmpose/* {pathOutputPkl}/".format(pathOutputPkl=pathOutputPkl)) - pkl_path_tmp = os.path.join(pathOutputPkl, 'human.pkl') - os.rename(pkl_path_tmp, pklPath) - + pkl_path_tmp = os.path.join(pathOutputPkl, 'human.pkl') + if os.path.exists(pkl_path_tmp): + os.rename(pkl_path_tmp, pklPath) + else: + raise FileNotFoundError( + "We could not detect any pose in your video. Please verify that the subject is correctly in front of the camera." + ) except Exception as e: if len(e.args) == 2: # specific exception raise Exception(e.args[0], e.args[1])