Skip to content

Commit c04df78

Browse files
committed
added datetime to logs
1 parent 3ffd39f commit c04df78

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

Pose2Sim/Pose2Sim.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import time
4747
from copy import deepcopy
4848
import logging, logging.handlers
49+
from datetime import datetime
4950

5051

5152
## AUTHORSHIP INFORMATION
@@ -193,11 +194,13 @@ def calibration(config=None):
193194

194195
# Set up logging
195196
setup_logging(session_dir)
197+
currentDateAndTime = datetime.now()
196198

197199
# Run calibration
198200
calib_dir = [os.path.join(session_dir, c) for c in os.listdir(session_dir) if ('Calib' or 'calib') in c][0]
199201
logging.info("\n\n---------------------------------------------------------------------")
200202
logging.info("Camera calibration")
203+
logging.info(f"On {currentDateAndTime.strftime('%A %d. %B %Y, %H:%M:%S')}")
201204
logging.info("---------------------------------------------------------------------")
202205
logging.info(f"\nCalibration directory: {calib_dir}")
203206
start = time.time()
@@ -231,18 +234,20 @@ def poseEstimation(config=None):
231234

232235
# # Set up logging
233236
# session_dir = os.path.realpath(os.path.join(config_dicts[0].get('project').get('project_dir'), '..', '..'))
234-
# setup_logging(session_dir)
237+
# setup_logging(session_dir)
235238

236239
# # Batch process all trials
237240
# for config_dict in config_dicts:
238241
# start = time.time()
242+
# currentDateAndTime = datetime.now()
239243
# project_dir = os.path.realpath(config_dict.get('project').get('project_dir'))
240244
# seq_name = os.path.basename(project_dir)
241245
# frame_range = config_dict.get('project').get('frame_range')
242246
# frames = ["all frames" if frame_range == [] else f"frames {frame_range[0]} to {frame_range[1]}"][0]
243247

244248
# logging.info("\n\n---------------------------------------------------------------------")
245-
# logging.info("Camera synchronization")
249+
# logging.info("Pose estimation")
250+
# logging.info(f"On {currentDateAndTime.strftime('%A %d. %B %Y, %H:%M:%S')}")
246251
# logging.info("---------------------------------------------------------------------")
247252
# logging.info(f"\nProject directory: {project_dir}")
248253

@@ -280,13 +285,15 @@ def synchronization(config=None):
280285
# # Batch process all trials
281286
# for config_dict in config_dicts:
282287
# start = time.time()
288+
# currentDateAndTime = datetime.now()
283289
# project_dir = os.path.realpath(config_dict.get('project').get('project_dir'))
284290
# seq_name = os.path.basename(project_dir)
285291
# frame_range = config_dict.get('project').get('frame_range')
286292
# frames = ["all frames" if frame_range == [] else f"frames {frame_range[0]} to {frame_range[1]}"][0]
287293

288294
# logging.info("\n\n---------------------------------------------------------------------")
289295
# logging.info("Camera synchronization")
296+
# logging.info(f"On {currentDateAndTime.strftime('%A %d. %B %Y, %H:%M:%S')}")
290297
# logging.info("---------------------------------------------------------------------")
291298
# logging.info(f"\nProject directory: {project_dir}")
292299

@@ -324,13 +331,15 @@ def personAssociation(config=None):
324331
# Batch process all trials
325332
for config_dict in config_dicts:
326333
start = time.time()
334+
currentDateAndTime = datetime.now()
327335
project_dir = os.path.realpath(config_dict.get('project').get('project_dir'))
328336
seq_name = os.path.basename(project_dir)
329337
frame_range = config_dict.get('project').get('frame_range')
330338
frames = ["all frames" if frame_range == [] else f"frames {frame_range[0]} to {frame_range[1]}"][0]
331339

332340
logging.info("\n\n---------------------------------------------------------------------")
333341
logging.info(f"Associating persons for {seq_name}, for {frames}.")
342+
logging.info(f"On {currentDateAndTime.strftime('%A %d. %B %Y, %H:%M:%S')}")
334343
logging.info("---------------------------------------------------------------------")
335344
logging.info(f"\nProject directory: {project_dir}")
336345

@@ -367,13 +376,15 @@ def triangulation(config=None):
367376
# Batch process all trials
368377
for config_dict in config_dicts:
369378
start = time.time()
379+
currentDateAndTime = datetime.now()
370380
project_dir = os.path.realpath(config_dict.get('project').get('project_dir'))
371381
seq_name = os.path.basename(project_dir)
372382
frame_range = config_dict.get('project').get('frame_range')
373383
frames = ["all frames" if frame_range == [] else f"frames {frame_range[0]} to {frame_range[1]}"][0]
374384

375385
logging.info("\n\n---------------------------------------------------------------------")
376386
logging.info(f"Triangulation of 2D points for {seq_name}, for {frames}.")
387+
logging.info(f"On {currentDateAndTime.strftime('%A %d. %B %Y, %H:%M:%S')}")
377388
logging.info("---------------------------------------------------------------------")
378389
logging.info(f"\nProject directory: {project_dir}")
379390

@@ -413,13 +424,15 @@ def filtering(config=None):
413424

414425
# Batch process all trials
415426
for config_dict in config_dicts:
427+
currentDateAndTime = datetime.now()
416428
project_dir = os.path.realpath(config_dict.get('project').get('project_dir'))
417429
seq_name = os.path.basename(project_dir)
418430
frame_range = config_dict.get('project').get('frame_range')
419431
frames = ["all frames" if frame_range == [] else f"frames {frame_range[0]} to {frame_range[1]}"][0]
420432

421433
logging.info("\n\n---------------------------------------------------------------------")
422434
logging.info(f"Filtering 3D coordinates for {seq_name}, for {frames}.")
435+
logging.info(f"On {currentDateAndTime.strftime('%A %d. %B %Y, %H:%M:%S')}")
423436
logging.info("---------------------------------------------------------------------")
424437
logging.info(f"\nProject directory: {project_dir}\n")
425438

@@ -450,13 +463,15 @@ def markerAugmentation(config=None):
450463

451464
for config_dict in config_dicts:
452465
start = time.time()
466+
currentDateAndTime = datetime.now()
453467
project_dir = os.path.realpath(config_dict.get('project').get('project_dir'))
454468
seq_name = os.path.basename(project_dir)
455469
frame_range = config_dict.get('project').get('frame_range')
456470
frames = ["all frames" if frame_range == [] else f"frames {frame_range[0]} to {frame_range[1]}"][0]
457471

458472
logging.info("\n\n---------------------------------------------------------------------")
459473
logging.info(f"Augmentation process for {seq_name}, for {frames}.")
474+
logging.info(f"On {currentDateAndTime.strftime('%A %d. %B %Y, %H:%M:%S')}")
460475
logging.info("---------------------------------------------------------------------")
461476
logging.info(f"\nProject directory: {project_dir}\n")
462477

@@ -466,7 +481,6 @@ def markerAugmentation(config=None):
466481
logging.info(f'\nAugmentation took {end - start:.2f} s.')
467482

468483

469-
470484
def opensimProcessing(config=None):
471485
'''
472486
Uses OpenSim to run scaling based on a static trc pose
@@ -497,6 +511,7 @@ def opensimProcessing(config=None):
497511

498512
# # Batch process all trials
499513
# for config_dict in config_dicts:
514+
# currentDateAndTime = datetime.now()
500515
# start = time.time()
501516
# project_dir = os.path.realpath(config_dict.get('project').get('project_dir'))
502517
# seq_name = os.path.basename(project_dir)
@@ -508,6 +523,7 @@ def opensimProcessing(config=None):
508523
# # logging.info(f"Scaling model with <STATIC TRC FILE>.")
509524
# # else:
510525
# # logging.info(f"Running inverse kinematics <MOTION TRC FILE>.")
526+
# logging.info(f"On {currentDateAndTime.strftime('%A %d. %B %Y, %H:%M:%S')}")
511527
# logging.info("---------------------------------------------------------------------")
512528
# logging.info(f"\nOpenSim output directory: {project_dir}")
513529

0 commit comments

Comments
 (0)