当前位置: 首页 > news >正文

网站建设玖金手指排名13搜索引擎优化排名品牌

网站建设玖金手指排名13,搜索引擎优化排名品牌,拿自己爱人做网站,福建省人民政府驻北京办事处Linux环境下服务部署 1.使用虚拟环境[810ms]1.1 环境部署1.2 服务启动 2.使用Docker[680ms] 1.使用虚拟环境[810ms] 1.1 环境部署 Anaconda的安装步骤这里不再介绍,直接开始使用。 # 1.创建虚拟环境 conda create -n deepface python3.9.18# 2.激活虚拟环境 cond…

Linux环境下服务部署

  • 1.使用虚拟环境[810ms]
    • 1.1 环境部署
    • 1.2 服务启动
  • 2.使用Docker[680ms]

1.使用虚拟环境[810ms]

1.1 环境部署

Anaconda的安装步骤这里不再介绍,直接开始使用。

# 1.创建虚拟环境
conda create -n deepface python=3.9.18# 2.激活虚拟环境
conda activate deepface# 3.安装deepface
pip install deepface -i https://pypi.tuna.tsinghua.edu.cn/simple

以下操作在虚拟环境deepface下执行:

# 1.安装mesa-libGL.x86_64
yum install mesa-libGL.x86_64
# 防止报错
ImportError: libGL.so.1: cannot open shared object file: No such file or directory# 2.安装deprecated
pip install deprecated==1.2.13
# 防止报错
ModuleNotFoundError: No module named 'deprecated'

使用yum install mesa-libGL.x86_64命令会在Linux系统中安装mesa-libGL包。这个包包含了Mesa 3D图形库的运行时库和DRI驱动。安装mesa-libGL包后,系统将能够支持OpenGL,这是一种用于渲染2D和3D矢量图形的跨语言、跨平台的应用程序编程接口(API)。

1.2 服务启动

DeepFace serves an API as well. You can clone [/api](https://github.com/serengil/deepface/tree/master/api) folder and run the api via gunicorn server. This will get a rest service up. In this way, you can call deepface from an external system such as mobile app or web.

cd scripts
./service.sh

Linux系统使用这个命令是前台启动,实际的启动用的是shell脚本,内容如下:

#!/bin/bash
nohup python -u ./api/api.py > ./deepfacelog.out 2>&1 &

Face recognition, facial attribute analysis and vector representation functions are covered in the API. You are expected to call these functions as http post methods. Default service endpoints will be http://localhost:5000/verify for face recognition, http://localhost:detector_backend for facial attribute analysis, and http://localhost:5000/represent for vector representation. You can pass input images as exact image paths on your environment, base64 encoded strings or images on web. Here, you can find a postman project to find out how these methods should be called.
这里仅贴出如何传递base64进行接口调用:

{"img_path": "data:image/,image_base64_str"
}

仅看一下base64相关源码:

def load_image(img):# The image is a base64 stringif img.startswith("data:image/"):return loadBase64Img(img)def loadBase64Img(uri):encoded_data = uri.split(",")[1]nparr = np.fromstring(base64.b64decode(encoded_data), np.uint8)img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)return img

2.使用Docker[680ms]

You can deploy the deepface api on a kubernetes cluster with docker. The following shell script will serve deepface on localhost:5000. You need to re-configure the Dockerfile if you want to change the port. Then, even if you do not have a development environment, you will be able to consume deepface services such as verify and analyze. You can also access the inside of the docker image to run deepface related commands. Please follow the instructions in the shell script.
修改Dockerfile,调整镜像库:

# base image
FROM python:3.8
LABEL org.opencontainers.image.source https://github.com/serengil/deepface
# -----------------------------------
# create required folder
RUN mkdir /app
RUN mkdir /app/deepface
# -----------------------------------
# Copy required files from repo into image
COPY ./deepface /app/deepface
COPY ./api/app.py /app/
COPY ./api/routes.py /app/
COPY ./api/service.py /app/
COPY ./requirements.txt /app/
COPY ./setup.py /app/
COPY ./README.md /app/
# -----------------------------------
# switch to application directory
WORKDIR /app
# -----------------------------------
# update image os
RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6 -y
# -----------------------------------
# if you will use gpu, then you should install tensorflow-gpu package
# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org tensorflow-gpu
# -----------------------------------
# install deepface from pypi release (might be out-of-the-date)
RUN pip install deepface -i https://pypi.tuna.tsinghua.edu.cn/simple
# -----------------------------------
# environment variables
ENV PYTHONUNBUFFERED=1
# -----------------------------------
# run the app (re-configure port if necessary)
EXPOSE 5000
CMD ["gunicorn", "--workers=1", "--timeout=3600", "--bind=0.0.0.0:5000", "app:create_app()"]

官网启动命令:

cd scripts
./dockerize.sh

报错:

unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/deepface/scripts/Dockerfile: no such file or directory
Unable to find image 'deepface:latest' locally
docker: Error response from daemon: pull access denied for deepface, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.

解决【不要 cd scripts】原因是执行脚本的文件夹要跟构建镜像使用的Dockerfile同级:

./scripts/dockerize.sh
# 这个过程一共有两个步骤:1是构建镜像;2是启动容器。构建镜像的速度取决于网速【时间可能会比较久】

分解步骤:

# 构建镜像
docker build -t deepface_image .# 创建模型文件夹【并将下载好的模型文件上传】
mkdir -p /root/.deepface/weights/# 启动容器
docker run --name deepface --privileged=true --restart=always --net="host" -v /root/.deepface/weights/:/root/.deepface/weights/ -d deepface_image
http://www.wangmingla.cn/news/158850.html

相关文章:

  • html5炫酷网站南通企业网站制作
  • wordpress 后台500山东公司网站推广优化
  • 整站排名优化教程刷网站软件
  • 海南住房和城乡建设网站seo是什么缩写
  • 工商注册官方网站长沙关键词快速排名
  • 网站欣赏网站欣赏手机卡顿优化软件
  • magento外贸网站开发2022搜索引擎
  • 做网站 使用权 所有权上海谷歌seo
  • 做儿童方面的网站优化大师下载安装免费
  • dj音乐网站建设西安seo服务外包
  • 专门做正品的网站有哪些深圳优化公司找高粱seo服务
  • 做网站找模板去哪好推广方案100个
  • wordpress文字编辑插件seo案例分析100例
  • 网站设计 手写谷歌推广和seo
  • 龙华响应式网站建设seo必备工具
  • saas做视频网站2023疫情最新消息今天
  • 如何做产品网站的推广重庆网站外包
  • 英语营销型网站建设唐老鸭微信营销软件
  • 旅游网站开发实训报告seo知识点
  • php订餐网站开发文献百度权重网站排名
  • 网站的图片滚动怎么做的百度推广网址
  • 网站跟网页有什么区别2022年新闻摘抄简短
  • 中国城乡与建设部网站获客渠道有哪些
  • 海南网站建设中心百度图片搜索入口
  • 建一个网站的费用浙江网络推广
  • 广州海珠做网站的公司seo教程网
  • 政府门户网站建设背景意义中国经济网人事
  • 纯英文网站建设百度排名竞价
  • 网络广告策划的流程顺序为嘉兴seo外包服务商
  • 网站建设外包工作谷歌seo公司