Python Wrapper for Embree

Related tags

Deep Learningpyembree
Overview

pyembree

Python Wrapper for Embree

Installation

You can install pyembree (and embree) via the conda-forge package.

$ conda install -c conda-forge pyembree

Suppressing errors

Creating multiple scenes produces some harmless error messages:

ERROR CAUGHT IN EMBREE
ERROR: Invalid operation
ERROR MESSAGE: b'already initialized'

These can be suppressed with:

import logging
logging.getLogger('pyembree').disabled = True
Comments
  • Enhancement PR

    Enhancement PR

    This PR does the following things

    • Performed typo refactoring in pyx files
    • Updated to newer Embree API (2.) . Embree 3.0 is being developed...
    • Added the possibility to export all embree results when performing request
    • Added 12 new tests run from nosetests, activated them in travis
    • Run examples in travis

    One can discuss each point...

    opened by Gjacquenot 10
  • install info

    install info

    Hi,

    Thanks for making this git. Could you give some more details on how to install Pyembree?

    In Ubuntu command line, I insert sudo python setup.py install

    But there is some missing folder embree2 appartently... Or do I first have to install and compile embree itself?

    Best regards, Arne

    opened by avlonder 4
  • Fixed an attribute in trianges.pyx that prevents compilation

    Fixed an attribute in trianges.pyx that prevents compilation

    I have updated a trianges.pyx since it is using a missing attribute.

    I guess one wants RTC_GEOMETRY_STATIC instead of RTCGEOMETRY_STATIC.

    https://github.com/embree/embree/blob/90e49f243703877c7714814d6eaa5aa3422a5839/include/embree2/rtcore_geometry.h#L72

    The original error log is presented here

    D:\Embree\pyembree>python setup.py build
    Please put "# distutils: language=c++" in your .pyx or .pxd file(s)
    Compiling pyembree\trianges.pyx because it changed.
    [1/1] Cythonizing pyembree\trianges.pyx
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    def run_triangles():
        pass
    
    cdef unsigned int addCube(rtcs.RTCScene scene_i):
        cdef unsigned int mesh = rtcg.rtcNewTriangleMesh(scene_i,
                    rtcg.RTCGEOMETRY_STATIC, 12, 8, 1)
                       ^
    ------------------------------------------------------------
    
    pyembree\trianges.pyx:19:20: cimported module has no attribute 'RTCGEOMETRY_STATIC'
    Traceback (most recent call last):
      File "setup.py", line 11, in <module>
        include_path=include_path)
      File "C:\Program Files\Python36\lib\site-packages\Cython\Build\Dependencies.py", line 1039, in cythonize
        cythonize_one(*args)
      File "C:\Program Files\Python36\lib\site-packages\Cython\Build\Dependencies.py", line 1161, in cythonize_one
        raise CompileError(None, pyx_file)
    Cython.Compiler.Errors.CompileError: pyembree\trianges.pyx
    
    opened by Gjacquenot 3
  • Building Pyembree for use in AWS Lambda

    Building Pyembree for use in AWS Lambda

    I'd like to run Pyembree in an AWS Lambda function (via a Lambda 'Layer'), which means Embree will be located in /opt/python/embree. I'm having a bit of trouble configuring Pyembree to expect Embree in this location.

    This is what I've tried so far (cobbled together from this script and this comment) to build the environment:

    sudo amazon-linux-extras install python3.8
    sudo yum install python38-devel gcc gcc-c++
    wget https://github.com/embree/embree/releases/download/v2.17.7/embree-2.17.7.x86_64.linux.tar.gz -O /tmp/embree.tar.gz -nv
    sudo mkdir /opt/python/embree
    sudo tar -xzf /tmp/embree.tar.gz --strip-components=1 -C /opt/python/embree
    sudo pip3.8 install --no-cache-dir numpy cython
    wget https://github.com/scopatz/pyembree/releases/download/0.1.6/pyembree-0.1.6.tar.gz
    tar xf pyembree-0.1.6.tar.gz
    sed -i -e 's/embree2/\/opt\/python\/embree\/include\/embree2/g' pyembree-0.1.6/pyembree/*
    tar czf pyembree-0.1.6.tar.gz pyembree-0.1.6
    sudo pip3.8 install --global-option=build_ext --global-option="-I/opt/python/embree/include" --global-option="-L/opt/python/embree/lib" --target=/opt/python pyembree-0.1.6.tar.gz
    

    This seems to build without problem and puts Embree and Pyembree in /opt/python. If I cd into /opt/python and run Python, I can import Pyembree, but the build can't find libembree.so.2:

    Python 3.8.5 (default, Feb 18 2021, 01:24:20)
    [GCC 7.3.1 20180712 (Red Hat 7.3.1-12)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pyembree
    >>> from pyembree import rtcore_scene as rtcs
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: libembree.so.2: cannot open shared object file: No such file or directory
    

    Any idea what else I should try? I'm not sure if I should be replacing embree2 with opt/python/embree/include/embree2 before building the pxd/pyx files, for example. I've also tried altering setup.py to: include_path = [np.get_include(), "/opt/python/embree/include", "/opt/python/embree/lib"].

    Any pointers very welcome!

    opened by dt99jay 1
  • segfault in destructor

    segfault in destructor

    Thanks for the great package! In a trimesh issue someone posted a backtrace that looked like it was occurring in the pyembree destructor, I was wondering if you'd ever seen anything similar?

    Thread 1 "python" received signal SIGSEGV, Segmentation fault.
    0x0000000000000000 in ?? ()
    (gdb) py-bt
    Traceback (most recent call first):
    (gdb) bt
    #0  0x0000000000000000 in ?? ()
    #1  0x00007fffd8ab7c30 in embree::avx::TriangleMeshISA::~TriangleMeshISA() ()
       from /usr/local/lib/libembree.so.2
    #2  0x00007fffd850002f in embree::Scene::~Scene() ()
       from /usr/local/lib/libembree.so.2
    #3  0x00007fffd8500179 in embree::Scene::~Scene() ()
       from /usr/local/lib/libembree.so.2
    #4  0x00007fffd84c3cc5 in rtcDeleteScene () from /usr/local/lib/libembree.so.2
    #5  0x00007fffd992474c in __pyx_pf_8pyembree_12rtcore_scene_11EmbreeScene_4__dealloc__ (__pyx_v_self=0x7fffd3166490) at pyembree/rtcore_scene.cpp:3434
    #6  __pyx_pw_8pyembree_12rtcore_scene_11EmbreeScene_5__dealloc__ (
        __pyx_v_self=<pyembree.rtcore_scene.EmbreeScene at remote 0x7fffd3166490>)
        at pyembree/rtcore_scene.cpp:3419
    #7  __pyx_tp_dealloc_8pyembree_12rtcore_scene_EmbreeScene (
        o=<pyembree.rtcore_scene.EmbreeScene at remote 0x7fffd3166490>)
        at pyembree/rtcore_scene.cpp:6042
    #8  0x00000000004fc70f in PyDict_Clear () at ../Objects/dictobject.c:946
    #9  0x00000000005419b9 in dict_tp_clear.lto_priv.332 (op=<optimized out>)
        at ../Objects/dictobject.c:2152
    #10 0x000000000049ca0f in delete_garbage (
        old=0x8fa280 <generations.lto_priv+96>, collectable=0x7fffffffdb40)
        at ../Modules/gcmodule.c:820
    #11 collect.lto_priv () at ../Modules/gcmodule.c:984
    ---Type <return> to continue, or q <return> to quit---
    #12 0x00000000004f9ade in PyGC_Collect () at ../Modules/gcmodule.c:1440
    #13 0x00000000004f8d7f in Py_Finalize () at ../Python/pythonrun.c:448
    #14 0x00000000004936f2 in Py_Main () at ../Modules/main.c:665
    #15 0x00007ffff7810830 in __libc_start_main (main=0x4932b0 <main>, argc=2, 
        argv=0x7fffffffddd8, init=<optimized out>, fini=<optimized out>, 
        rtld_fini=<optimized out>, stack_end=0x7fffffffddc8)
        at ../csu/libc-start.c:291
    #16 0x00000000004931d9 in _start ()
    
    opened by mikedh 1
  • Add distance query type

    Add distance query type

    Using the output dict to get the distance to the intersection is very slow. So I added a new query type, distance, which returns just the distance to the hit.

    opened by dwastberg 1
  • multiple scenes

    multiple scenes

    Hi, thanks for the great library!

    Someone opened an issue on trimesh about the errors that get printed when you allocate multiple scenes. It's not really a functional problem as pyembree still returns the correct result, I was wondering if there was a procedure or destructor I could call to suppress these warnings?

    import numpy as np
    
    from pyembree import rtcore_scene
    from pyembree.mesh_construction import TriangleMesh
    
    if __name__ == '__main__':
         triangles_a = np.random.random((10,3,3))
         scene_a = rtcore_scene.EmbreeScene()
         mesh_a = TriangleMesh(scene_a, triangles_a)
    
         # do something to deallocate here?
    
         triangles_b = np.random.random((10,3,3))
         scene_b = rtcore_scene.EmbreeScene()
         mesh_b = TriangleMesh(scene_b, triangles_b)
    

    produces this warning:

    ERROR CAUGHT IN EMBREE
    ERROR: Invalid operation
    ERROR MESSAGE: b'/home/benthin/Projects/embree_v251/kernels/common/rtcore.cpp (157): already initialized'
    

    Best, Mike

    opened by mikedh 1
  • These ctypedefs should define function pointers

    These ctypedefs should define function pointers

    in the same way as RTCFilterFunc in rtcore_geometry.pyx. This allows me to set custom intersection functions from cython code, in the same way that you already can with filter feedback functions:

        from mesh_intersection cimport patchIntersectFunc
        cimport pyembree.rtcore_geometry_user as rtcgu
        .
        .
        .
        rtcgu.rtcSetIntersectFunction(scene, geomID, <rtcgu.RTCIntersectFunc> patchIntersectFunc)
    
    opened by atmyers 1
  • Implementing additional mesh types in mesh_construction.pyx

    Implementing additional mesh types in mesh_construction.pyx

    This pull request adds support for creating hexahedral and tetrahedral meshes. It also implements creating triangular meshes using an indices array as well as a vertices array.

    enhancement 
    opened by atmyers 1
  • Apple Silicion Support

    Apple Silicion Support

    Since Embree 3.13.0 (https://github.com/embree/embree/releases/tag/v3.13.0) Apple Silicon is supported with Embree. pyembree should be updated to support it. Also see: https://github.com/scopatz/pyembree/issues/28

    opened by trologat 0
  • Conflict found when installing pyembree in Python3.9

    Conflict found when installing pyembree in Python3.9

    Hi, when attempting to install pyembree in a Python3.9 environment I get an error due to incompatible packages (see code below). This was tested on a MacBook Pro (2017) running macOS 10.14.6. Is there any way to resolve this?

    $ conda create --name python3.9 -c conda-forge python=3.9 pyembree
    Collecting package metadata (current_repodata.json): done
    Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
    Collecting package metadata (repodata.json): done
    Solving environment: |
    Found conflicts! Looking for incompatible packages.
    This can take several minutes.  Press CTRL-C to abort.
    failed
    
    UnsatisfiableError: The following specifications were found to be incompatible with each other:
    
    Output in format: Requested package -> Available versions
    
    Package python conflicts for:
    python=3.9
    pyembree -> numpy[version='>=1.18.1,<2.0a0'] -> python[version='3.7.*|3.8.*|>=3.9,<3.10.0a0']
    pyembree -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0|3.4.*']
    
    opened by ReinderVosDeWael 0
  • Dead link in the docstring of ElementMesh

    Dead link in the docstring of ElementMesh

    https://github.com/scopatz/pyembree/blob/master/pyembree/mesh_construction.pyx#L158 This link seems to be dead. I suppose that the node ordering is something like [[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 1], [1, 0, 1], [1, 1, 1], [0, 1, 1]] for a unit cube, right?

    [edit] same here: https://github.com/scopatz/pyembree/blob/master/pyembree/mesh_construction.h#L4

    opened by nai62 0
Releases(0.1.6)
Owner
Anthony Scopatz
Anthony Scopatz
The code for our paper "NSP-BERT: A Prompt-based Zero-Shot Learner Through an Original Pre-training Task —— Next Sentence Prediction"

The code for our paper "NSP-BERT: A Prompt-based Zero-Shot Learner Through an Original Pre-training Task —— Next Sentence Prediction"

Sun Yi 201 Nov 21, 2022
Exposure Time Calculator (ETC) and radial velocity precision estimator for the Near InfraRed Planet Searcher (NIRPS) spectrograph

NIRPS-ETC Exposure Time Calculator (ETC) and radial velocity precision estimator for the Near InfraRed Planet Searcher (NIRPS) spectrograph February 2

Nolan Grieves 2 Sep 15, 2022
Source-to-Source Debuggable Derivatives in Pure Python

Tangent Tangent is a new, free, and open-source Python library for automatic differentiation. Existing libraries implement automatic differentiation b

Google 2.2k Jan 01, 2023
A FAIR dataset of TCV experimental results for validating edge/divertor turbulence models.

TCV-X21 validation for divertor turbulence simulations Quick links Intro Welcome to TCV-X21. We're glad you've found us! This repository is designed t

0 Dec 18, 2021
End-to-End Dense Video Captioning with Parallel Decoding (ICCV 2021)

PDVC Official implementation for End-to-End Dense Video Captioning with Parallel Decoding (ICCV 2021) [paper] [valse论文速递(Chinese)] This repo supports:

Teng Wang 118 Dec 16, 2022
An atmospheric growth and evolution model based on the EVo degassing model and FastChem 2.0

EVolve Linking planetary mantles to atmospheric chemistry through volcanism using EVo and FastChem. Overview EVolve is a linked mantle degassing and a

Pip Liggins 2 Jan 17, 2022
Extreme Lightwegith Portrait Segmentation

Extreme Lightwegith Portrait Segmentation Please go to this link to download code Requirements python 3 pytorch = 0.4.1 torchvision==0.2.1 opencv-pyt

HYOJINPARK 59 Dec 16, 2022
Unofficial PyTorch implementation of Masked Autoencoders Are Scalable Vision Learners

Unofficial PyTorch implementation of Masked Autoencoders Are Scalable Vision Learners This repository is built upon BEiT, thanks very much! Now, we on

Zhiliang Peng 2.3k Jan 04, 2023
pytorch implementation for Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network arXiv:1609.04802

PyTorch SRResNet Implementation of Paper: "Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network"(https://arxiv.org/abs

Jiu XU 436 Jan 09, 2023
Code and results accompanying our paper titled Mixture Proportion Estimation and PU Learning: A Modern Approach at Neurips 2021 (Spotlight)

Mixture Proportion Estimation and PU Learning: A Modern Approach This repository is the official implementation of Mixture Proportion Estimation and P

Approximately Correct Machine Intelligence (ACMI) Lab 23 Dec 28, 2022
Config files for my GitHub profile.

Canalyst Candas Data Science Library Name Canalyst Candas Description Built by a former PM / analyst to give anyone with a little bit of Python knowle

Canalyst Candas 13 Jun 24, 2022
LRBoost is a scikit-learn compatible approach to performing linear residual based stacking/boosting.

LRBoost is a sckit-learn compatible package for linear residual boosting. LRBoost combines a linear estimator and a non-linear estimator to leverage t

Andrew Patton 5 Nov 23, 2022
Custom implementation of Corrleation Module

Pytorch Correlation module this is a custom C++/Cuda implementation of Correlation module, used e.g. in FlowNetC This tutorial was used as a basis for

Clément Pinard 361 Dec 12, 2022
Data & Code for ACCENTOR Adding Chit-Chat to Enhance Task-Oriented Dialogues

ACCENTOR: Adding Chit-Chat to Enhance Task-Oriented Dialogues Overview ACCENTOR consists of the human-annotated chit-chat additions to the 23.8K dialo

Facebook Research 69 Dec 29, 2022
A PyTorch Image-Classification With AlexNet And ResNet50.

PyTorch 图像分类 依赖库的下载与安装 在终端中执行 pip install -r -requirements.txt 完成项目依赖库的安装 使用方式 数据集的准备 STL10 数据集 下载:STL-10 Dataset 存储位置:将下载后的数据集中 train_X.bin,train_y.b

FYH 4 Feb 22, 2022
Unsupervised Representation Learning by Invariance Propagation

Unsupervised Learning by Invariance Propagation This repository is the official implementation of Unsupervised Learning by Invariance Propagation. Pre

FengWang 15 Jul 06, 2022
A lane detection integrated Real-time Instance Segmentation based on YOLACT (You Only Look At CoefficienTs)

Real-time Instance Segmentation and Lane Detection This is a lane detection integrated Real-time Instance Segmentation based on YOLACT (You Only Look

Jin 4 Dec 30, 2022
NVIDIA container runtime

nvidia-container-runtime A modified version of runc adding a custom pre-start hook to all containers. If environment variable NVIDIA_VISIBLE_DEVICES i

NVIDIA Corporation 938 Jan 06, 2023
NEO: Non Equilibrium Sampling on the orbit of a deterministic transform

NEO: Non Equilibrium Sampling on the orbit of a deterministic transform Description of the code This repo describes the NEO estimator described in the

0 Dec 01, 2021
Combinatorially Hard Games where the levels are procedurally generated

puzzlegen Implementation of two procedurally simulated environments with gym interfaces. IceSlider: the agent needs to reach and stop on the pink squa

Autonomous Learning Group 3 Jun 26, 2022