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
OpenMMLab Pose Estimation Toolbox and Benchmark.

Introduction English | 简体中文 MMPose is an open-source toolbox for pose estimation based on PyTorch. It is a part of the OpenMMLab project. The master b

OpenMMLab 2.8k Dec 31, 2022
A rough implementation of the paper "A Steering Algorithm for Redirected Walking Using Reinforcement Learning"

A rough implementation of the paper "A Steering Algorithm for Redirected Walking Using Reinforcement Learning"

Somnus `Chen 2 Jun 09, 2022
End-to-end machine learning project for rices detection

Basmatinet Welcome to this project folks ! Whether you like it or not this project is all about riiiiice or riz in french. It is also about Deep Learn

Béranger 47 Jun 18, 2022
This repository contains the code for "Self-Diagnosis and Self-Debiasing: A Proposal for Reducing Corpus-Based Bias in NLP".

Self-Diagnosis and Self-Debiasing This repository contains the source code for Self-Diagnosis and Self-Debiasing: A Proposal for Reducing Corpus-Based

Timo Schick 62 Dec 12, 2022
A python code to convert Keras pre-trained weights to Pytorch version

Weights_Keras_2_Pytorch 最近想在Pytorch项目里使用一下谷歌的NIMA,但是发现没有预训练好的pytorch权重,于是整理了一下将Keras预训练权重转为Pytorch的代码,目前是支持Keras的Conv2D, Dense, DepthwiseConv2D, Batch

Liu Hengyu 2 Dec 16, 2021
Neural style transfer as a class in PyTorch

pt-styletransfer Neural style transfer as a class in PyTorch Based on: https://github.com/alexis-jacq/Pytorch-Tutorials Adds: StyleTransferNet as a cl

Tyler Kvochick 31 Jun 27, 2022
Experiments on continual learning from a stream of pretrained models.

Ex-model CL Ex-model continual learning is a setting where a stream of experts (i.e. model's parameters) is available and a CL model learns from them

Antonio Carta 6 Dec 04, 2022
Imposter-detector-2022 - HackED 2022 Team 3IQ - 2022 Imposter Detector

HackED 2022 Team 3IQ - 2022 Imposter Detector By Aneeljyot Alagh, Curtis Kan, Jo

Joshua Ji 3 Aug 20, 2022
implementation for paper "ShelfNet for fast semantic segmentation"

ShelfNet-lightweight for paper (ShelfNet for fast semantic segmentation) This repo contains implementation of ShelfNet-lightweight models for real-tim

Juntang Zhuang 252 Sep 16, 2022
Regression Metrics Calculation Made easy for tensorflow2 and scikit-learn

Regression Metrics Installation To install the package from the PyPi repository you can execute the following command: pip install regressionmetrics I

Ashish Patel 11 Dec 16, 2022
The official codes of "Semi-supervised Models are Strong Unsupervised Domain Adaptation Learners".

SSL models are Strong UDA learners Introduction This is the official code of paper "Semi-supervised Models are Strong Unsupervised Domain Adaptation L

Yabin Zhang 26 Dec 26, 2022
Codes for [NeurIPS'21] You are caught stealing my winning lottery ticket! Making a lottery ticket claim its ownership.

You are caught stealing my winning lottery ticket! Making a lottery ticket claim its ownership Codes for [NeurIPS'21] You are caught stealing my winni

VITA 8 Nov 01, 2022
Homepage of paper: Paint Transformer: Feed Forward Neural Painting with Stroke Prediction, ICCV 2021.

Paint Transformer: Feed Forward Neural Painting with Stroke Prediction [Paper] [Official Paddle Implementation] [Huggingface Gradio Demo] [Unofficial

442 Dec 16, 2022
[ICCV21] Code for RetrievalFuse: Neural 3D Scene Reconstruction with a Database

RetrievalFuse Paper | Project Page | Video RetrievalFuse: Neural 3D Scene Reconstruction with a Database Yawar Siddiqui, Justus Thies, Fangchang Ma, Q

Yawar Nihal Siddiqui 75 Dec 22, 2022
Create Data & AI apps in 20 lines of code with Shimoku

Install with: pip install shimoku-api-python Start with: from os import getenv import shimoku_api_python.client as Shimoku

Shimoku 5 Nov 07, 2022
Implementing a simplified copy of Shazam application from scratch using MinHashing and LSH.

Building Shazam from scratch In this repository we tried to implement a simplified copy of the Shazam application able to tell you the name of a song

Arturo Ghinassi 0 Nov 17, 2022
Find-Lane-Line - Use openCV library and Python to detect the road-lane-line

Find-Lane-Line This project is to use openCV library and Python to detect the road-lane-line. Data Pipeline Step one : Color Selection Step two : Cann

Kenny Cheng 3 Aug 17, 2022
Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

CoProtector Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

Zhensu Sun 1 Oct 26, 2021
Code for the SIGIR 2022 paper "Hybrid Transformer with Multi-level Fusion for Multimodal Knowledge Graph Completion"

MKGFormer Code for the SIGIR 2022 paper "Hybrid Transformer with Multi-level Fusion for Multimodal Knowledge Graph Completion" Model Architecture Illu

ZJUNLP 68 Dec 28, 2022
working repo for my xumx-sliCQ submissions to the ISMIR 2021 MDX

Music Demixing Challenge - xumx-sliCQ This repository is the GitHub mirror of my working submission repository for the AICrowd ISMIR 2021 Music Demixi

4 Aug 25, 2021