cvat 标图工具部署文档


ps: 由于此文档比较久了。官网的cvat更新多次,已经不太适用了。 还是查看官方文档进行构建. 需要注意的是,下面的nginx替换是因为使用了域名解析的方式,只要把default.conf配置文件修改了,不改域名也可以使用。这个就自己去查询nginx的配置文件的匹配方式,这里就不多解释了。欢迎加群一起交流

cvat 标图工具部署文档

地址: https://github.com/opencv/cvat/blob/develop/cvat/apps/documentation/installation.md

环境 CentOS7

部署基础环境

部署docker

wget -O /etc/yum.repos.d/docker-ce.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

# 查看docker-ce版本
yum --showduplicates list docker-ce

# 安装docker-ce
yum -y install docker-ce
# 启动服务
systemctl enable docker
systemctl start docker

# 参考文档 http://mirrors.ustc.edu.cn/help/dockerhub.html
mkdir -p /etc/docker
cat > /etc/docker/daemon.json << EOF
{
  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"]
}
EOF
systemctl restart docker

部署docker-compose

yum install epel-release -y
yum install -y python36 python36-devel  python36-setuptools python python-devel python-setuptools
easy_install-3.6 pip
mkdir -p /root/.pip 
echo [global] >> ~/.pip/pip.conf
echo index-url = https://mirrors.aliyun.com/pypi/simple/ >> ~/.pip/pip.conf
echo [install] >> ~/.pip/pip.conf
echo trusted-host=mirrors.aliyun.com >> ~/.pip/pip.conf
python3 -m pip install docker-compose

拉取代码

yum install -y git
git clone https://github.com/opencv/cvat
cd cvat
# 根据自己需要,切换分支
git branch -a 
git checkout release-1.0.0

构建镜像并且启动

因为镜像使用的国外源,需要修改部分内容

使用清华ubuntu源

Dockerfile文件

# 原本内容
FROM ubuntu:16.04
# 第二行直接替换
RUN echo deb http://mirrors.aliyun.com/ubuntu/ xenial main                    > /etc/apt/sources.list
RUN echo deb-src http://mirrors.aliyun.com/ubuntu/ xenial main                >> /etc/apt/sources.list
RUN echo                                                                      >> /etc/apt/sources.list
RUN echo deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main            >> /etc/apt/sources.list
RUN echo deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main        >> /etc/apt/sources.list
RUN echo                                                                      >> /etc/apt/sources.list
RUN echo deb http://mirrors.aliyun.com/ubuntu/ xenial universe                >> /etc/apt/sources.list
RUN echo deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe            >> /etc/apt/sources.list
RUN echo deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe        >> /etc/apt/sources.list
RUN echo deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe    >> /etc/apt/sources.list
RUN echo                                                                      >> /etc/apt/sources.list
RUN echo deb http://mirrors.aliyun.com/ubuntu/ xenial-security main           >> /etc/apt/sources.list
RUN echo deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main       >> /etc/apt/sources.list
RUN echo deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe       >> /etc/apt/sources.list
RUN echo deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe   >> /etc/apt/sources.list

Dockerfile

# 修改对应的内容,加上 -i 指定阿里云源
RUN python3 -m pip install --no-cache-dir -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt -i https://mirrors.aliyun.com/pypi/simple/
RUN python3 -m pip install --no-cache-dir -r ${HOME}/datumaro/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/

Dockerfile.ci

# 修改
RUN python3 -m pip install --no-cache-dir -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt -i https://mirrors.aliyun.com/pypi/simple/

vim Dockerfile.ui

添加一句,使用国内源

# 添加
RUN npm config set registry https://registry.npm.taobao.org

启动

docker-compose build

启动

docker-compose up -d

访问只能是chrome 谷歌浏览器
访问必报404错误,除了 http://localhost:8080 因为nginx的配置文件默认访问是404,而默认的 CVAT_HOST 是localhost

修改nginx配置文件

推荐不修改

./cvat_proxy/conf.d/cvat.conf.template

使用域名解析

docker-compose.override.yml

version: "2.3"
services:
  cvat_proxy:
    environment:
	  CVAT_HOST: test.example.com

然后在hosts配置

127.0.0.1 test.example.com

访问只能是chrome 谷歌浏览器
访问:http://test.example.com:8080

创建超级用户

使用的是django的admin系统,直接使用下面命令创建

docker exec -it cvat bash -ic 'python3 ~/manage.py createsuperuser'

使用超级用户进入管理后台

访问: http://test.example.com:8080/admin

然后使用管理管理后台 管理用户

如果需要安装插件,请注意查看文档,并且找到文档修改源

components/analytics/logstash/Dockerfile

ARG ELK_VERSION
FROM docker.elastic.co/logstash/logstash-oss:${ELK_VERSION}
# 新增加
RUN sed -i 's#source "https://rubygems.org"#source "https://mirrors.aliyun.com/rubygems/"#g' Gemfile
RUN logstash-plugin install logstash-input-http logstash-filter-aggregate \
    logstash-filter-prune logstash-output-email

COPY logstash.conf   /usr/share/logstash/pipeline/
EXPOSE 5000

下载openvino依赖包,请到官网查找 https://software.intel.com/zh-cn/openvino-toolkit

cd components/openvino/
#wget l_openvino_toolkit_p_2020.2.120.tgz

components/auto_segmentation/install.sh 这个文件的请到自己网速较快的服务器 clone 和curl到本地,然后修改

#!/bin/bash
#

set -e
# 修改此处,由于我使用的是企业的仓库,这里就不做暴露了
MASK_RCNN_URL=https://github.com/matterport/Mask_RCNN

cd ${HOME} && \
git clone ${MASK_RCNN_URL}.git 
#curl -L ${MASK_RCNN_URL}/releases/download/v2.0/mask_rcnn_coco.h5 -o Mask_RCNN/mask_rcnn_coco.h5

# TODO remove useless files
# tensorflow and Keras are installed globally

修改 components/tf_annotation/install.sh

curl 的命令
  • docker-compose.override.yml 自定义修改内容,修改访问域名
  • components/analytics/docker-compose.analytics.yml 分析
  • components/auto_segmentation/docker-compose.auto_segmentation.yml 自动标注
  • components/openvino/docker-compose.openvino.yml openfino安装
  • components/tf_annotation/docker-compose.tf_annotation.yml tf标图工具
  • components/cuda/docker-compose.cuda.yml 安装cuda,此处没有安装,即没测试,不做使用
    完整体命令
docker-compose -f docker-compose.yml -f docker-compose.override.yml -f components/analytics/docker-compose.analytics.yml -f components/auto_segmentation/docker-compose.auto_segmentation.yml -f components/openvino/docker-compose.openvino.yml -f components/tf_annotation/docker-compose.tf_annotation.yml up -d --build

广告时间:
推荐K8S学习网址 https://kubernetes.hankbook.cn


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM