Skip to content

Commit

Permalink
logs
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinefalisse committed Jun 17, 2024
1 parent b8916f4 commit 3a304cd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
16 changes: 14 additions & 2 deletions mmpose/loop_mmpose.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ def checkCudaPyTorch():
if os.path.isfile(video_path):
os.remove(video_path)

checkCudaPyTorch()
# checkCudaPyTorch()
if torch.cuda.is_available():
num_gpus = torch.cuda.device_count()
logging.info(f"Found {num_gpus} GPU(s).")
else:
logging.info("No GPU detected. Exiting.")
raise Exception("No GPU detected. Exiting.")
while True:
if not os.path.isfile(video_path):
time.sleep(0.1)
Expand All @@ -48,7 +54,13 @@ def checkCudaPyTorch():
os.makedirs(output_dir)

try:
checkCudaPyTorch()
# checkCudaPyTorch()
if torch.cuda.is_available():
num_gpus = torch.cuda.device_count()
logging.info(f"Found {num_gpus} GPU(s).")
else:
logging.info("No GPU detected. Exiting.")
raise Exception("No GPU detected. Exiting.")
# Run human detection.
pathModelCkptPerson = model_ckpt_person
bboxPath = os.path.join(output_dir, 'box.pkl')
Expand Down
22 changes: 20 additions & 2 deletions openpose/loop_openpose.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@ def getResolutionCommand(resolutionPoseDetection, horizontal):
#%%

logging.info("Waiting for data...")
check_cuda_device()
# check_cuda_device()
try:
# Run the nvidia-smi command and capture the output
_ = subprocess.check_output(["nvidia-smi"])
# If the command ran successfully, assume a CUDA device is present
logging.info("A CUDA-capable device is detected.")
except subprocess.CalledProcessError as e:
# If the command fails, it means no CUDA device is detected
logging.info("No CUDA-capable device is detected. Error:", e)
raise Exception("No CUDA-capable device is detected.")

video_path = "/openpose/data/video_openpose.mov"
output_dir = "/openpose/data/output_openpose"
Expand All @@ -102,7 +111,16 @@ def getResolutionCommand(resolutionPoseDetection, horizontal):
horizontal = getVideoOrientation(video_path)
cmd_hr = getResolutionCommand(resolutionPoseDetection, horizontal)

check_cuda_device()
# check_cuda_device()
try:
# Run the nvidia-smi command and capture the output
_ = subprocess.check_output(["nvidia-smi"])
# If the command ran successfully, assume a CUDA device is present
logging.info("A CUDA-capable device is detected.")
except subprocess.CalledProcessError as e:
# If the command fails, it means no CUDA device is detected
logging.info("No CUDA-capable device is detected. Error:", e)
raise Exception("No CUDA-capable device is detected.")
command = "/openpose/build/examples/openpose/openpose.bin\
--video {video_path}\
--display 0\
Expand Down

0 comments on commit 3a304cd

Please sign in to comment.