grimoire / mmdetection-to-tensorrt

convert mmdetection model to tensorrt, support fp16, int8, batch input, dynamic shape etc.
Apache License 2.0
590 stars 85 forks source link

Python logging should be defined for the module name - not root logger. #95

Closed tehkillerbee closed 2 years ago

tehkillerbee commented 2 years ago

I have noticed that mmdet2trt uses python logging set to use the root logger in some source files. This messes up logging from the main python script. Instead, mmdet2trt should use logger = logging.getLogger('mmdet2trt') whenever the logger is instantiated.

I have noticed the issue in

apis/inference.py
builder.py
build.py

My simple fix was to replace logging with the logger instance instead:

import logging
...
logger = logging.getLogger('mmdet2trt')
...
logger.warning('Can not load dataset from config. Use default CLASSES instead.')

Ill try to make a PR asap.

tehkillerbee commented 2 years ago

Fixed in #96