Commit 658ad9ea authored by Yuxin Wu's avatar Yuxin Wu

"UTF-8"->utf-8; humanize_time_delta print warning when negative (fix #741)

parent 0c519bdc
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: load-alexnet.py # File: load-alexnet.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com> # Author: Yuxin Wu <ppwwyyxxc@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: load-cpm.py # File: load-cpm.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com> # Author: Yuxin Wu <ppwwyyxxc@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: load-vgg16.py # File: load-vgg16.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com> # Author: Yuxin Wu <ppwwyyxxc@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: load-vgg19.py # File: load-vgg19.py
from __future__ import print_function from __future__ import print_function
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: svhn-disturb.py # File: svhn-disturb.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com> # Author: Yuxin Wu <ppwwyyxxc@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: alexnet-dorefa.py # File: alexnet-dorefa.py
# Author: Yuxin Wu, Yuheng Zou ({wyx,zyh}@megvii.com) # Author: Yuxin Wu, Yuheng Zou ({wyx,zyh}@megvii.com)
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: resnet-dorefa.py # File: resnet-dorefa.py
import cv2 import cv2
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: svhn-digit-dorefa.py # File: svhn-digit-dorefa.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com> # Author: Yuxin Wu <ppwwyyxxc@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: hed.py # File: hed.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com> # Author: Yuxin Wu <ppwwyyxxc@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: inception-bn.py # File: inception-bn.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com> # Author: Yuxin Wu <ppwwyyxxc@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: shufflenet.py # File: shufflenet.py
import argparse import argparse
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: vgg16.py # File: vgg16.py
import argparse import argparse
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: cifar10-preact18-mixup.py # File: cifar10-preact18-mixup.py
# Author: Tao Hu <taohu620@gmail.com>, Yauheni Selivonchyk <y.selivonchyk@gmail.com> # Author: Tao Hu <taohu620@gmail.com>, Yauheni Selivonchyk <y.selivonchyk@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: cifar10-resnet.py # File: cifar10-resnet.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com> # Author: Yuxin Wu <ppwwyyxxc@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: load-resnet.py # File: load-resnet.py
# Author: Eric Yujia Huang <yujiah1@andrew.cmu.edu> # Author: Eric Yujia Huang <yujiah1@andrew.cmu.edu>
# Yuxin Wu <ppwwyyxx@gmail.com> # Yuxin Wu <ppwwyyxx@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: CAM-resnet.py # File: CAM-resnet.py
import cv2 import cv2
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: cifar-convnet.py # File: cifar-convnet.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com> # Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import tensorflow as tf import tensorflow as tf
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: svhn-digit-convnet.py # File: svhn-digit-convnet.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com> # Author: Yuxin Wu <ppwwyyxxc@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: dump-model-params.py # File: dump-model-params.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com> # Author: Yuxin Wu <ppwwyyxx@gmail.com>
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: base.py # File: base.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: group.py # File: group.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: inference.py # File: inference.py
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: param.py # File: param.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: saver.py # File: saver.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
# https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36 # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: base.py # File: base.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
# https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36 # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: cifar.py # File: cifar.py
# Yukun Chen <cykustc@gmail.com> # Yukun Chen <cykustc@gmail.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: mnist.py # File: mnist.py
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: svhn.py # File: svhn.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: dftools.py # File: dftools.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: image.py # File: image.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
# https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36 # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: _test.py # File: _test.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: base.py # File: base.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: crop.py # File: crop.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: deform.py # File: deform.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: imgproc.py # File: imgproc.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: misc.py # File: misc.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: parallel.py # File: parallel.py
import sys import sys
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
# https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36 # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: model_desc.py # File: model_desc.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
# https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36 # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
# https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36 # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: _test.py # File: _test.py
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: batch_norm.py # File: batch_norm.py
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: conv2d.py # File: conv2d.py
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: fc.py # File: fc.py
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: image_sample.py # File: image_sample.py
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: nonlin.py # File: nonlin.py
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: pool.py # File: pool.py
import tensorflow as tf import tensorflow as tf
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: registry.py # File: registry.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: regularize.py # File: regularize.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
# https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36 # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: common.py # File: common.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: export.py # File: export.py
# Author: Patrick Wieschollek <mail@patwie.com> # Author: Patrick Wieschollek <mail@patwie.com>
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: gradproc.py # File: gradproc.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: model_utils.py # File: model_utils.py
# Author: tensorpack contributors # Author: tensorpack contributors
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: sessinit.py # File: sessinit.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: summary.py # File: summary.py
...@@ -70,7 +70,7 @@ def create_image_summary(name, val): ...@@ -70,7 +70,7 @@ def create_image_summary(name, val):
s = tf.Summary() s = tf.Summary()
for k in range(n): for k in range(n):
arr = val[k] arr = val[k]
#CV2 will only write correctly in BGR chanel order # CV2 will only write correctly in BGR chanel order
if c == 3: if c == 3:
arr = cv2.cvtColor(arr, cv2.COLOR_RGB2BGR) arr = cv2.cvtColor(arr, cv2.COLOR_RGB2BGR)
elif c == 4: elif c == 4:
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: symbolic_functions.py # File: symbolic_functions.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
# https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36 # https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: simple.py # File: simple.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: __init__.py # File: __init__.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: concurrency.py # File: concurrency.py
# Credit belongs to Xinyu Zhou # Credit belongs to Xinyu Zhou
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: logger.py # File: logger.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: naming.py # File: naming.py
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: stats.py # File: stats.py
import numpy as np import numpy as np
......
# -*- coding: UTF-8 -*- # -*- coding: utf-8 -*-
# File: utils.py # File: utils.py
...@@ -10,6 +10,8 @@ from datetime import datetime, timedelta ...@@ -10,6 +10,8 @@ from datetime import datetime, timedelta
from tqdm import tqdm from tqdm import tqdm
import numpy as np import numpy as np
from . import logger
__all__ = ['change_env', __all__ = ['change_env',
'get_rng', 'get_rng',
...@@ -41,7 +43,9 @@ def humanize_time_delta(sec): ...@@ -41,7 +43,9 @@ def humanize_time_delta(sec):
print(humanize_time_delta(60 * 60 * 24 + 1)) # 1 day 1 second print(humanize_time_delta(60 * 60 * 24 + 1)) # 1 day 1 second
print(humanize_time_delta(60 * 60 * 24 + 60 * 2 + 60*60*9 + 3)) # 1 day 9 hours 2 minutes 3 seconds print(humanize_time_delta(60 * 60 * 24 + 60 * 2 + 60*60*9 + 3)) # 1 day 9 hours 2 minutes 3 seconds
""" """
assert sec >= 0, sec if sec < 0:
logger.warn("humanize_time_delta() obtains negative seconds!")
return "{:.3g} seconds".format(sec)
if sec == 0: if sec == 0:
return "0 second" return "0 second"
time = datetime(2000, 1, 1) + timedelta(seconds=int(sec)) time = datetime(2000, 1, 1) + timedelta(seconds=int(sec))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment