Commit a50f2952 authored by Yuxin Wu's avatar Yuxin Wu

fix dependencies

parent 760e0c54
...@@ -7,4 +7,3 @@ pyarrow>=0.9.0 ...@@ -7,4 +7,3 @@ pyarrow>=0.9.0
pyzmq>=16 pyzmq>=16
subprocess32; python_version < '3.0' subprocess32; python_version < '3.0'
functools32; python_version < '3.0' functools32; python_version < '3.0'
python-prctl; platform_system == 'Linux'
...@@ -3,6 +3,7 @@ version = int(setuptools.__version__.split('.')[0]) ...@@ -3,6 +3,7 @@ version = int(setuptools.__version__.split('.')[0])
assert version > 30, "tensorpack installation requires setuptools > 30" assert version > 30, "tensorpack installation requires setuptools > 30"
from setuptools import setup from setuptools import setup
import os import os
import platform
import shutil import shutil
import sys import sys
...@@ -33,10 +34,8 @@ setup( ...@@ -33,10 +34,8 @@ setup(
install_requires=req, install_requires=req,
tests_require=['flake8', 'scikit-image'], tests_require=['flake8', 'scikit-image'],
extras_require={ extras_require={
'all': ['pillow', 'scipy', 'h5py', 'lmdb>=0.92', 'matplotlib', 'scikit-learn'], 'all': ['pillow', 'scipy', 'h5py', 'lmdb>=0.92', 'matplotlib', 'scikit-learn'] + \
'all: python_version < "3.0"': ['tornado'] ['python-prctl'] if platform.system() == 'Linux' else [],
'all: python_version < "3.0"': ['tornado'],
}, },
#include_package_data=True,
#package_data={'tensorpack': []},
) )
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
# Some code taken from zxytim # Some code taken from zxytim
import os
import threading import threading
import platform
import multiprocessing import multiprocessing
import atexit import atexit
import bisect import bisect
...@@ -15,6 +15,7 @@ import six ...@@ -15,6 +15,7 @@ import six
from six.moves import queue from six.moves import queue
from . import logger from . import logger
from .argtools import log_once
if six.PY2: if six.PY2:
import subprocess32 as subprocess import subprocess32 as subprocess
...@@ -178,11 +179,12 @@ def enable_death_signal(): ...@@ -178,11 +179,12 @@ def enable_death_signal():
the current process will be cleaned with guarantee the current process will be cleaned with guarantee
in case the parent dies accidentally. in case the parent dies accidentally.
""" """
if os.name != 'posix': if platform.system() != 'Linux':
return return
try: try:
import prctl # pip install python-prctl import prctl # pip install python-prctl
except ImportError: except ImportError:
log_once('Install python-prctl so that processes can be cleaned with guarantee.', 'warn')
return return
else: else:
assert hasattr(prctl, 'set_pdeathsig'), \ assert hasattr(prctl, 'set_pdeathsig'), \
......
...@@ -34,6 +34,9 @@ class BoxBase(object): ...@@ -34,6 +34,9 @@ class BoxBase(object):
def is_box(self): def is_box(self):
return self.w > 0 and self.h > 0 return self.w > 0 and self.h > 0
def to_list(self):
return [self.x1, self.y1, self.x2, self.y2]
class IntBox(BoxBase): class IntBox(BoxBase):
def __init__(self, x1, y1, x2, y2): def __init__(self, x1, y1, x2, y2):
...@@ -105,15 +108,10 @@ class FloatBox(BoxBase): ...@@ -105,15 +108,10 @@ class FloatBox(BoxBase):
intbox.x2 + 1, intbox.y2 + 1) intbox.x2 + 1, intbox.y2 + 1)
def clip_by_shape(self, shape): def clip_by_shape(self, shape):
"""
Args:
shape: h, w
"""
self.x1 = np.clip(self.x1, 0, shape[1]) self.x1 = np.clip(self.x1, 0, shape[1])
self.x2 = np.clip(self.x2, 0, shape[1]) self.x2 = np.clip(self.x2, 0, shape[1])
self.y1 = np.clip(self.y1, 0, shape[0]) self.y1 = np.clip(self.y1, 0, shape[0])
self.y2 = np.clip(self.y2, 0, shape[0]) self.y2 = np.clip(self.y2, 0, shape[0])
return self
if __name__ == '__main__': if __name__ == '__main__':
......
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