PINTO0309 / tflite2tensorflow

Generate saved_model, tfjs, tf-trt, EdgeTPU, CoreML, quantized tflite, ONNX, OpenVINO, Myriad Inference Engine blob and .pb from .tflite. Support for building environments with Docker. It is possible to directly access the host PC GUI and the camera to verify the operation. NVIDIA GPU (dGPU) support. Intel iHD GPU (iGPU) support. Supports inverse quantization of INT8 quantization model.
https://qiita.com/PINTO
MIT License
262 stars 41 forks source link

MacOS environment installation error (xhost: command not found) #13

Closed peiwenhuang27 closed 3 years ago

peiwenhuang27 commented 3 years ago

OS you are using: MacOS 11.4

Hi, first of all, thank you so much for this tool kit! It is exactly what I've been looking for. However, I couldn't successfully use tflite2tensorflow to do conversion in my Docker environment. I was able to run

docker pull pinto0309/tflite2tensorflow

and downloaded the image, but I encountered an error upon the command

xhost +local: && \
  docker run -it --rm \
  -v `pwd`:/home/user/workdir \
  -v /tmp/.X11-unix/:/tmp/.X11-unix:rw \
  --device /dev/video0:/dev/video0:mwr \
  --net=host \
  -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \
  -e DISPLAY=$DISPLAY \
  --privileged \
  pinto0309/tflite2tensorflow:latest

the error reads:

-bash: xhost: command not found

I suppose this is a command specific to Linux environment, and I was wondering if there is an alternative equivalent command that is executable on MacOS?

Side note: after the error, I tried directly running

docker run -it --rm \
 pinto0309/tflite2tensorflow:latest

and it did open an TensorRT OpenVINO virtual environment, but I do not need my model to run on TensorRT for further inference. In addition, I couldn't access my model file stored in my host machine. My understanding is the command that I was unable to run should somehow mount my host machine file system to the virtual environment, so without the xhost command, perhaps I can use some other way such as ssh or ftp to upload my file onto the virtual envionrment?

PINTO0309 commented 3 years ago

First, let me explain why I am using the xhost command. Simply put, it is an additional command that is specified to access the GUI of the host PC from inside Docker. I was just envisioning an integrated environment to run and test the transformed model inside a container, so there is no need to force its use. By the way, If you need a GUI as your integrated verification environment, the following article may be helpful. I own a Mac, but I haven't tested it working yet. I'm sorry.

If you do not need a GUI, you can use the following command. The current folder will be mounted in the container /home/user/workdir.

docker run -it --rm \
-v `pwd`:/home/user/workdir \
pinto0309/tflite2tensorflow:latest

For example,

  1. My HostPC work folder -> docker run Screenshot 2021-07-14 12:46:25
  2. Immediately after starting the container Screenshot 2021-07-14 12:47:39
  3. After moving to /home/user/workdir Screenshot 2021-07-14 12:49:43 You will see that you can see the files on the host PC.
PINTO0309 commented 3 years ago

Add to README. 06eec0e43badd25e96bd25aa1c47fc4a39ff6b4c

peiwenhuang27 commented 3 years ago

Thank you so much for the quick reply and detailed explanation (please do pardon my previous misunderstanding 😅) As I don't need a GUI, I have successfully launched the run that mounted my current folder into the container using

docker run -it --rm \
-v `pwd`:/home/user/workdir \
pinto0309/tflite2tensorflow:latest

as you suggested.

I did run into another error though (The UNIDIRECTIONAL_SEQUENCE_LSTM layer is not yet implemented.) As it is not related to this issue, I will close this and report another one. Thanks again 🙏🏼

gaurav00700 commented 1 year ago

You can solve this by installating Xhost software. Then adding /opt/X11/bin in your terminal Path. I am able to solve this on my MacOS M1.