赞
踩
项目需要用到人脸识别,手势识别,供应商报价那么高,用media试一下。
目前window不支持安卓应用,所以使用了windows的Linux子系统。国内首先换源,推荐阿里或者清华的。
Ubuntu20.04:
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security multiverse
官方文档:https://docs.microsoft.com/en-us/windows/wsl/install
第一次用踩了一些坑。
启动时提示:WslRegisterDistribution failed with error
解决方法:安装更新包:https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
启动时提示:参考的对象类型不支持尝试的操作
解决方法:cmd执行 netsh winsock reset
windows所有的磁盘自动挂载在 /mnt/
下面,可以很方便的直接用cp
命令拷文件。
官方文档:https://docs.bazel.build/versions/main/install-ubuntu.html#install-on-ubuntu
选择二进制安装包安装,国内下载比较慢,推荐两个网站:
文件用: https://tool.mintimate.cn/gh/
仓库用:https://www.gitclone.com/
直接运行下载好的文件即可
# 安装必要的安装包
sudo apt-get update && sudo apt-get install -y build-essential git python zip adb openjdk-8-jdk
# 克隆仓库,贼慢,建议使用https://www.gitclone.com/
git clone https://github.com/google/mediapipe.git
有多个选择,推荐第一种:
sudo apt-get install libopencv-core-dev libopencv-highgui-dev \
libopencv-calib3d-dev libopencv-features2d-dev \
libopencv-imgproc-dev libopencv-video-dev
setup_opencv.sh
直接执行即可运行一下helloword:
export GLOG_logtostderr=1
bazel run --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hello_world:hello_world
# MEDIAPIPE_DISABLE_GPU=1 表示不支持gpu
ERROR: cannot load '@rules_foreign_cc//:workspace_definitions.bzl': no such file
修改WORKSPACE文件内容:
http_archive(
name = "rules_foreign_cc",
sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
strip_prefix = "rules_foreign_cc-0.9.0",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/0.9.0.tar.gz",
)
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
编译还是报错。应该是一些依赖的版本对不上了。
于是选择将mediaPipe仓库回退版本到v0.8.10
修改.bazelversion
文件内指定的bazel
版本,为系统安装的bazel
版本。重新执行命令,中间有些文件需要从git
下载,笔者网络不是很好,中断了多次!可以尝试科学或者多试几次。
还是报错了缺少python
环境,一个字:装!
sudo apt-get install python3-numpy
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。