I have a question about embedding python in a C ++ application. The setup is this: I have a large C ++ application that generates some data (renders images in real time) and displays them. I also trained a neural network in python using a tensor stream that will accept these images.
My idea was to embed python and send data as a numpy array, predict using a neural network, and return another processed numpy array for display (in C ++). I did some basic tests without the tensor flow on the python side to get an idea of ββembedding python in c, etc., and it seems to work.
However, as soon as I put "importorororflow" in any python script that I want to import, I will get NULL from PyImport_ImportModule in the C ++ part.
eg.
import numpy as np def foo(img): return np.clip(img * 2.0, 0, 255).astype(np.uint8)
works great. But the following:
import numpy as np import tensorflow as tf
In the second case, I still get a message in stdout from tensorflow that he found cuda etc., but then the import of the module failed.
My setup is on Windows 10 x64, Anaconda Python 3.5, tensorflow-0.12, and CUDA 8. Has anyone encountered a similar problem? The other modules I tested (numpy, pil, scipy) seem to be loaded.
If it looks like it cannot be resolved, I resort to some kind of IPC between the C ++ part and python.