@fanisfun
2018-03-27T08:21:07.000000Z
字数 5011
阅读 4044
vatic docker ubuntu video labeling
在此输入正文
检查版本:docker只支持内核版本3.10以上的。
root$ uname -r4.4.0-31-generic # 满足要求
添加docker源
root$ echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.listroot$ apt-get update
搜索并安装docker-engine
root$ apt-cache search dockerdocker - System tray for KDE3/GNOME2 docklet applicationskdocker - lets you dock any application into the system traydocker.io - Linux container runtimegolang-docker-dev - Externally reusable Go packages included with Dockervim-syntax-docker - Docker container engine - Vim highlighting syntax filesroot$ apt-get install docker-engineSetting up docker-engine (17.05.0~ce-0~ubuntu-trusty) ...
检查docker版本
root$ docker versionClient:Version: 17.05.0-ceAPI version: 1.29Go version: go1.7.5Git commit: 89658beBuilt: Thu May 4 22:06:06 2017OS/Arch: linux/amd64Server:Version: 17.05.0-ceAPI version: 1.29 (minimum version 1.12)Go version: go1.7.5Git commit: 89658beBuilt: Thu May 4 22:06:06 2017OS/Arch: linux/amd64Experimental: false
检查docker是否正常安装
root$ docker run hello-worldHello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:https://cloud.docker.com/For more examples and ideas, visit:https://docs.docker.com/engine/userguide/
检查当前运行的镜像列表
root$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES6842f46ad9a4 hello-world "/hello" About a minute ago Exited (0) About a minute ago vigorous_elion
停止并删除指定的镜像
root$ docker stop 6842f46ad9a46842f46ad9a4root$ docker rm 6842f46ad9a46842f46ad9a4
拉取最新的镜像:共享视频数据目录
root$ DATA_DIR=/home/yf/Desktop/SOD-codes/vatic/data # 指定输出目录root$ docker run -it -p 8080:80 -v /path/to/data/in:/home/vagrant/vagrant_data jldowns/vatic-docker-contrib:latestUnable to find image 'jldowns/vatic-docker-contrib:latest' locallylatest: Pulling from jldowns/vatic-docker-contrib30d541b48fc0: Pull complete8ecd7f80d390: Pull complete46ec9927bb81: Pull complete2e67a4d67b44: Pull complete7d9dd9155488: Pull complete95614f897518: Pull completeDigest: sha256:93280172aedce3ed1a1975c8ce3424dc62adf63d48753ffc1daeb26622548e8cStatus: Downloaded newer image for jldowns/vatic-docker-contrib:latestroot@70ad25a4acd9$ pwd # 已经进入容器/home/vagrant
开启MySQL和Apache服务
root@70ad25a4acd9$ sh start_services.sh* Starting MySQL database server mysqld [ OK ]* Checking for tables which need an upgrade, are corrupt or werenot closed cleanly.* Restarting web server apache2 [ OK ]
提取视频帧:注意vatic默认将宽度resize到720。
root@70ad25a4acd9$ cd vatic && pwd/home/vagrant/vaticroot@70ad25a4acd9$ turkic extract ../vagrant_data/video.mp4 ../vagrant_data/frames/ --no-resizeavconv version 9.20-6:9.20-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developersbuilt on Dec 7 2016 21:22:31 with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../vagrant_data/uav2.mp4':Metadata:major_brand : mp42minor_version : 1compatible_brands: mp41mp42isomcreation_time : 2017-12-23 12:58:04Duration: 00:01:42.14, start: 0.000000, bitrate: 1200 kb/sStream #0.0(und): Video: h264 (High), yuv420p, 960x540, 1148 kb/s, 30 fps, 30 tbr, 600 tbnMetadata:creation_time : 2017-12-23 12:58:04Stream #0.1(und): Audio: aac, 44100 Hz, mono, fltp, 47 kb/sMetadata:creation_time : 2017-12-23 12:58:04Output #0, image2, to '/tmp/pyvision-ffmpeg-477657550/%d.jpg':Metadata:major_brand : mp42minor_version : 1compatible_brands: mp41mp42isomcreation_time : 2017-12-23 12:58:04encoder : Lavf54.20.4Stream #0.0(und): Video: mjpeg, yuvj420p, 960x540, q=2-31, 10000 kb/s, 90k tbn, 600 tbcMetadata:creation_time : 2017-12-23 12:58:04Decoding frames 0 to 100Decoding frames 100 to 200Decoding frames 200 to 300Decoding frames 300 to 400
加载视频帧并发布任务:
job_id:自己设定的任务唯一标识car skateboard airplane:需要标注的实体类别
root@70ad25a4acd9$ turkic load job_id /home/vagrant/vagrant_data/frames/ car skateboard airplane --offlineChecking integrity...Searching for last frame...Found 3062 frames.Binding labels and attributes...Creating symbolic link...Creating segments...Video loaded and ready for publication.root@70ad25a4acd9$ turkic publish --offlinehttp://localhost/?id=1&hitId=offlinehttp://localhost/?id=2&hitId=offlinehttp://localhost/?id=3&hitId=offlinehttp://localhost/?id=4&hitId=offlinehttp://localhost/?id=5&hitId=offlinehttp://localhost/?id=6&hitId=offlinehttp://localhost/?id=7&hitId=offlinehttp://localhost/?id=8&hitId=offlinehttp://localhost/?id=9&hitId=offlinehttp://localhost/?id=10&hitId=offlinehttp://localhost/?id=11&hitId=offline
开始标注:从浏览器打开链接,注意在链接中加入端口8080,如:http://localhost:8080/?id=1&hitId=offline
输出标注文件
root@70ad25a4acd9$ turkic dump job_id -o ../vagrant_data/anno.txt
可视化标注结果
root@70ad25a4acd9$ turkic visualize 0 ../vagrant_data/tmp --merge --no-augment --renumber --labelsroot@70ad25a4acd9$ ffmpeg -f image2 -i ../vagrant_data/tmp/%d.jpg -vcodec libx264 -r 30 ../vagrant_data/out.mp4
root$ docker ps -aroot$ docker start $job_idroot$ docker attach $job_id