Skip to content

Commit c30f3fb

Browse files
Update eval_detrac.py (#171)
Logging is never executed and always raises an error <Invalid log level> which is not correct. I made the changes in a way that the log level is checked with valid values and cast into integer. Please accept the change because debugging is very hard for now.
1 parent 008f45c commit c30f3fb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

motmetrics/apps/eval_detrac.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ def main():
8787
args = parse_args()
8888

8989
loglevel = getattr(logging, args.loglevel.upper(), None)
90-
if not isinstance(loglevel, int):
90+
91+
if loglevel not in ["0","10","20","30","40","50"]: # previous code was always raising error, this code is correct [Ardeshir Shon]
9192
raise ValueError('Invalid log level: {} '.format(args.loglevel))
93+
loglevel = int(loglevel) # This type casting is needed regarding the logging library documentation
9294
logging.basicConfig(level=loglevel, format='%(asctime)s %(levelname)s - %(message)s', datefmt='%I:%M:%S')
9395

9496
if args.solver:

0 commit comments

Comments
 (0)