Skip to content

Commit

Permalink
adding logs
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinefalisse committed Jun 11, 2024
1 parent 480bd5b commit e018b50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 0 additions & 5 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
import zipfile
import time

import logging
logging.basicConfig(level=logging.INFO)

import numpy as np
import pandas as pd
from scipy import signal
Expand Down Expand Up @@ -121,8 +118,6 @@ def getCreatedAt(trial):
return sessionJson

def getSubjectJson(subject_id):
logging.info('Getting subject json {}subjects/{}/'.format(API_URL, subject_id))
logging.info('API_TOKEN: {}'.format(API_TOKEN))
subjectJson = requests.get(API_URL + "subjects/{}/".format(subject_id),
headers = {"Authorization": "Token {}".format(API_TOKEN)}).json()
return subjectJson
Expand Down
9 changes: 8 additions & 1 deletion utilsDetector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import sys
import time

import logging
logging.basicConfig(level=logging.INFO)

from decouple import config

from utils import getOpenPoseMarkerNames, getMMposeMarkerNames, getVideoExtension
Expand Down Expand Up @@ -308,17 +311,21 @@ def runMMposeVideo(
try:
# wait until the video is processed (i.e. until the video is removed -- then json should be ready)
start = time.time()
logging.info("Processing mmpose. Before waiting for video to be processed.")
while True:
if not os.path.isfile(vid_path):
logging.info("Processing mmpose. Video not available. Break.")
break

if start + 60*60 < time.time():
raise Exception("Pose detection timed out. This is unlikely to be your fault, please report this issue on the forum. You can proceed with your data collection (videos are uploaded to the server) and later reprocess errored trials.", 'timeout - hrnet')

time.sleep(0.1)

logging.info("Processing mmpose. Before copying.")
# copy /data/output to pathOutputPkl
os.system("cp /data/output_mmpose/* {pathOutputPkl}/".format(pathOutputPkl=pathOutputPkl))
os.system("cp /data/output_mmpose/* {pathOutputPkl}/".format(pathOutputPkl=pathOutputPkl))
logging.info("Processing mmpose. After copying.")
pkl_path_tmp = os.path.join(pathOutputPkl, 'human.pkl')
os.rename(pkl_path_tmp, pklPath)

Expand Down

0 comments on commit e018b50

Please sign in to comment.