alicevision / Meshroom

3D Reconstruction Software
http://alicevision.org
Other
11.23k stars 1.09k forks source link

[bug] Non-sense error in Depth Map Filter (when calling a custom node even it is passthrouh) #1656

Open juanjosse opened 2 years ago

juanjosse commented 2 years ago

Describe the bug DepthMapFilter node fails when adding a node (even if the node is empty) between CameraInit node and FeatureExtraction node.

To Reproduce Steps to reproduce the behavior:

  1. Add any node betweeen CameraInit node and FeatureExtraction node.
  2. Even pasthrough the signal, so the node would be in theory doing nothing.
  3. Run the pipeline, it fails in DepthMapFilter node.

Expected behavior I would expect it to work the same since I am not doing anything.

Screenshots image image

Desktop (please complete the following and other pertinent information):

Log

[08:45:11.280676][info] Found 1 image dimension(s): [08:45:11.281654][info] - [1080x1920] [08:45:11.284579][info] Overall maximum dimension: [1080x1920] [08:45:11.284579][info] Filter depth maps. [08:45:11.284579][info] Precomputing groups.

WARNING:root:Retrying to obtain clipboard.

juanjosse commented 2 years ago

It is really strange because without doing anything new (just a passthrough node), the depthMapFilter exit the computation without any error message:

[10:02:07.062795][info] Found 1 image dimension(s): [10:02:07.064612][info] - [1080x1920] [10:02:07.064612][info] Overall maximum dimension: [1080x1920] [10:02:07.064612][info] Filter depth maps. [10:02:07.064612][info] Precomputing groups.

natowi commented 2 years ago

I created my own passthrough node and it works without problems. What happens when you place it between Structurefrommotion and Preparedenscene for example? What code did you use prior the class?

juanjosse commented 2 years ago

If I put it between the DepthMap and DepthMapFilter it does not fail, in any other place it will fail. Could you send me the .py file to see if I am doing something wrong? My code is the following: image

natowi commented 2 years ago

I only removed the two lines for the CustomLibs and the comma following the closing bracket for desc.File() No problems so far. If you need some code samples, take a look at my (messy ;) ) Meshroom node playground: https://github.com/natowi/meshroom_external_plugins/wiki/2-DevDoc

__version__ = "1.1"

import json
import os

from meshroom.core import desc

import sys

class passthroughNode(desc.Node):

    inputs = [
        desc.File(
                name="input",
                label="Input",
                description="Input",
                value="",
                uid=[0],
        )
    ]

def processChunk(self, chunk):
    print ("Hi there")
juanjosse commented 2 years ago

I tested your exact code in a new file called the same as the function, but it continues happening... in Meshroom 2021, 2020 and 2019 (Windows). Have you tried it in Windows? Otherwise I can't see what could be the problem.

natowi commented 2 years ago

Maybe a conflict with your installed python environment?

juanjosse commented 2 years ago

But why it shows up in that condition and not in other? And how could I solve a conflict like this? (I tried deleting my Python environment variables for user and global and error continues happening).

This is something I also wanted to ask: If some node calls to a python which uses numpy, it gives me an error of not existing module. So how would I use external libraries? Can I install numpy in meshroom python? Or should I call a command line order to call my python.

natowi commented 2 years ago

This depends on how you run Meshroom. Do you run Meshroom from sources or from the binaries? In the first case it will run with your installed system libs, in the second case libs need to be added to a specific Meshroom folder.

juanjosse commented 2 years ago

I am running from the binaries, so some nodes don't have problem in calling python functions, but other (which uses numpy) does. So where and how should I include the Python numpy and other packages I want to use? Thank you.

natowi commented 2 years ago

Option 1 "patch" Meshroom

It is possible to add python packages to the binary installation by placing the needed libs in Meshroom-2021.1.0\lib Go to https://pypi.org/ and download the WHL (x64 and correct python version) Rename the whl to zip and extract it. Copy the extracted package folder (the one without the '.dist-info' at the end) into the 'lib' folder

Note on writing new nodes in this setup: For new python nodes, that are placed in Meshroom-2021.1.0\lib\meshroom\nodes\aliceVision Python will build .cpython-37.pyc files from the .py nodes It is not mendatory to use the same python in all nodes. You could use a custom python/virtualenv that you call from your node.

Option 2 Run Meshroom from Source

Download the Source Code here: https://github.com/alicevision/meshroom/archive/refs/tags/v2021.1.0.zip

Then add the aliceVision and qtPlugins folders with the binaries to the directory of the source code folder where the start.bat resides.

Install the dependencies: pip install -r requirements.txt -r dev_requirements.txt

Now you can start Meshroom from the start.bat


To build Meshroom binaries navigate to the Meshroom Source Folder and set the python path

set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%

Install dependencies:

pip install -r requirements.txt -r dev_requirements.txt --timeout 45

Build Meshroom UI

python setup.py build