Running mediapipe on Jetson Nano
git clone https://github.com/google/mediapipe.git
sudo apt install -y python3-dev
sudo apt install -y cmake
sudo apt install -y protobuf-compiler
sudo apt install libprotobuf-dev
If you see a missing any.proto error later, which means the protoc might be too old, you can download the latest protoc-3.x.x-linux-aarch_64.zip from GitHub and copy the "bin" and "include/google" directories to the system libraries. Then, modify mediapipe/setup.py like the following:
replace following:
protoc_command = [self._protoc, '-I.', '--python_out=.', source]
with:
protoc_command = [self._protoc, '-I.', '-I/usr/local/include', '--python_out=.', source]
Modified 2 files
- ./mediapipe/calculators/tensor/image_to_tensor_converter_opencv.cc
- ./mediapipe/calculators/tensor/image_to_tensor_converter_gl_buffer.cc.
Code below:
return tensor;
replace with:
return absl::StatusOr<mediapipe::Tensor> ( mediapipe::Tensor(std::move(tensor)) );
cd mediapipe
sed -i -e "/\"imgcodecs\"/d;/\"calib3d\"/d;/\"features2d\"/d;/\"highgui\"/d;/\"video\"/d;/\"videoio\"/d" third_party/BUILD
sed -i -e "/-ljpeg/d;/-lpng/d;/-ltiff/d;/-lImath/d;/-lIlmImf/d;/-lHalf/d;/-lIex/d;/-lIlmThread/d;/-lrt/d;/-ldc1394/d;/-lavcodec/d;/-lavformat/d;/-lavutil/d;/-lswscale/d;/-lavresample/d" third_party/BUILD
modified mediapipe/third_party/BUILD:
"WITH_ITT": "OFF",
"WITH_JASPER": "OFF",
"WITH_WEBP": "OFF",
"ENABLE_NEON": "OFF", <--add this
"WITH_TENGINE": "OFF", <--add this
python3 mediapipe/setup.py gen_protos && python3 mediapipe/setup.py bdist_wheel
pip3 install mediapipe/dist/mediapipe-0.8-cp36-cp36m-linux_aarch64.whl
nano ~/.bashrc
add following to bottom:
export OPENBLAS_CORETYPE=ARMV8
reboot
python3 mediapipe_jetson_nano/facemesh_demo.py