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
Exadel CompreFace is a free and open-source face recognition GitHub project

Exadel CompreFace is a leading free and open-source face recognition system Exadel CompreFace is a free and open-source face recognition service that

Exadel 2.6k Jan 04, 2023
Anomaly Detection Based on Hierarchical Clustering of Mobile Robot Data

We proposed a new approach to detect anomalies of mobile robot data. We investigate each data seperately with two clustering method hierarchical and k-means. There are two sub-method that we used for

Zekeriyya Demirci 1 Jan 09, 2022
[CVPR 2022] Official code for the paper: "A Stitch in Time Saves Nine: A Train-Time Regularizing Loss for Improved Neural Network Calibration"

MDCA Calibration This is the official PyTorch implementation for the paper: "A Stitch in Time Saves Nine: A Train-Time Regularizing Loss for Improved

MDCA Calibration 21 Dec 22, 2022
Multi Agent Path Finding Algorithms

MATP-solver Simulator collision check path step random initial states or given states Traditional method Seperate A* algorithem Confict-based Search S

30 Dec 12, 2022
A Differentiable Recipe for Learning Visual Non-Prehensile Planar Manipulation

A Differentiable Recipe for Learning Visual Non-Prehensile Planar Manipulation This repository contains the source code of the paper A Differentiable

Bernardo Aceituno 2 May 05, 2022
Age and Gender prediction using Keras

cnn_age_gender Age and Gender prediction using Keras Dataset example : Description : UTKFace dataset is a large-scale face dataset with long age span

XN3UR0N 58 May 03, 2022
Pytorch implementation of Compressive Transformers, from Deepmind

Compressive Transformer in Pytorch Pytorch implementation of Compressive Transformers, a variant of Transformer-XL with compressed memory for long-ran

Phil Wang 118 Dec 01, 2022
ManimML is a project focused on providing animations and visualizations of common machine learning concepts with the Manim Community Library.

ManimML ManimML is a project focused on providing animations and visualizations of common machine learning concepts with the Manim Community Library.

259 Jan 04, 2023
automated systems to assist guarding corona Virus precautions for Closed Rooms (e.g. Halls, offices, etc..)

Automatic-precautionary-guard automated systems to assist guarding corona Virus precautions for Closed Rooms (e.g. Halls, offices, etc..) what is this

badra 0 Jan 06, 2022
A Deep Learning Based Knowledge Extraction Toolkit for Knowledge Base Population

DeepKE is a knowledge extraction toolkit supporting low-resource and document-level scenarios for entity, relation and attribute extraction. We provide comprehensive documents, Google Colab tutorials

ZJUNLP 1.6k Jan 05, 2023
Real-time LIDAR-based Urban Road and Sidewalk detection for Autonomous Vehicles 🚗

urban_road_filter: a real-time LIDAR-based urban road and sidewalk detection algorithm for autonomous vehicles Dependency ROS (tested with Kinetic and

JKK - Vehicle Industry Research Center 180 Dec 12, 2022
VoxHRNet - Whole Brain Segmentation with Full Volume Neural Network

VoxHRNet This is the official implementation of the following paper: Whole Brain Segmentation with Full Volume Neural Network Yeshu Li, Jonathan Cui,

Microsoft 12 Nov 24, 2022
Reference implementation for Structured Prediction with Deep Value Networks

Deep Value Network (DVN) This code is a python reference implementation of DVNs introduced in Deep Value Networks Learn to Evaluate and Iteratively Re

Michael Gygli 55 Feb 02, 2022
Accompanying code for the paper "A Kernel Test for Causal Association via Noise Contrastive Backdoor Adjustment".

#backdoor-HSIC (bd_HSIC) Accompanying code for the paper "A Kernel Test for Causal Association via Noise Contrastive Backdoor Adjustment". To generate

Robert Hu 0 Nov 25, 2021
A Framework for Encrypted Machine Learning in TensorFlow

TF Encrypted is a framework for encrypted machine learning in TensorFlow. It looks and feels like TensorFlow, taking advantage of the ease-of-use of t

TF Encrypted 0 Jul 06, 2022
This is the official github repository of the Met dataset

The Met dataset This is the official github repository of the Met dataset. The official webpage of the dataset can be found here. What is it? This cod

Nikolaos-Antonios Ypsilantis 35 Dec 17, 2022
PixelPyramids: Exact Inference Models from Lossless Image Pyramids (ICCV 2021)

PixelPyramids: Exact Inference Models from Lossless Image Pyramids This repository contains the PyTorch implementation of the paper PixelPyramids: Exa

Visual Inference Lab @TU Darmstadt 8 Dec 11, 2022
A Streamlit component to render ECharts.

Streamlit - ECharts A Streamlit component to display ECharts. Install pip install streamlit-echarts Usage This library provides 2 functions to display

Fanilo Andrianasolo 290 Dec 30, 2022
Optimized primitives for collective multi-GPU communication

NCCL Optimized primitives for inter-GPU communication. Introduction NCCL (pronounced "Nickel") is a stand-alone library of standard communication rout

NVIDIA Corporation 2k Jan 09, 2023
Opinionated code formatter, just like Python's black code formatter but for Beancount

beancount-black Opinionated code formatter, just like Python's black code formatter but for Beancount Try it out online here Features MIT licensed - b

Launch Platform 16 Oct 11, 2022