Python get detectron ops lib

11 Python code examples are found related to " get detectron ops lib". You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
Example 1
Source File: c2.py    From video-long-term-feature-banks with Apache License 2.0 6 votes vote down vote up
def get_detectron_ops_lib():
    """Retrieve Detectron ops library."""
    # Candidate prefixes for detectron ops lib path.
    prefixes = [_CMAKE_INSTALL_PREFIX, sys.prefix, sys.exec_prefix] + sys.path

    # Candidate subdirs for detectron ops lib.
    subdirs = ['lib', 'torch/lib']

    # Try to find detectron ops lib.
    for prefix in prefixes:
        for subdir in subdirs:
            ops_path = os.path.join(prefix, subdir, _DETECTRON_OPS_LIB)
            if os.path.exists(ops_path):
                print('Found Detectron ops lib: {}'.format(ops_path))
                return ops_path
    raise Exception('Detectron ops lib not found') 
Example 2
Source File: env.py    From KL-Loss with Apache License 2.0 5 votes vote down vote up
def get_detectron_ops_lib():
    """Retrieve Detectron ops library."""
    # Candidate prefixes for detectron ops lib path
    prefixes = [_CMAKE_INSTALL_PREFIX, sys.prefix, sys.exec_prefix] + sys.path
    # Candidate subdirs for detectron ops lib
    subdirs = ['lib', 'torch/lib']
    # Try to find detectron ops lib
    for prefix in prefixes:
        for subdir in subdirs:
            ops_path = os.path.join(prefix, subdir, _DETECTRON_OPS_LIB)
            if os.path.exists(ops_path):
                print('Found Detectron ops lib: {}'.format(ops_path))
                return ops_path
    raise Exception('Detectron ops lib not found') 
Example 3
Source File: env.py    From Clustered-Object-Detection-in-Aerial-Image with Apache License 2.0 5 votes vote down vote up
def get_detectron_ops_lib():
    """Retrieve Detectron ops library."""
    # Candidate prefixes for the detectron ops lib path
    prefixes = [_CMAKE_INSTALL_PREFIX, sys.prefix, sys.exec_prefix] + sys.path
    # Search for detectron ops lib
    for prefix in prefixes:
        ops_path = os.path.join(prefix, 'lib/libcaffe2_detectron_ops_gpu.so')
        if os.path.exists(ops_path):
            # TODO(ilijar): Switch to using a logger
            print('Found Detectron ops lib: {}'.format(ops_path))
            break
    assert os.path.exists(ops_path), \
        ('Detectron ops lib not found; make sure that your Caffe2 '
         'version includes Detectron module')
    return ops_path 
Example 4
Source File: env.py    From masktextspotter.caffe2 with Apache License 2.0 5 votes vote down vote up
def get_detectron_ops_lib():
    """Retrieve Detectron ops library."""
    c2_dir = get_caffe2_dir()
    detectron_ops_lib = os.path.join(
        c2_dir, 'lib/libcaffe2_detectron_ops_gpu.so')
    assert os.path.exists(detectron_ops_lib), \
        ('Detectron ops lib not found at \'{}\'; make sure that your Caffe2 '
         'version includes Detectron module').format(detectron_ops_lib)
    return detectron_ops_lib