@fanisfun
2018-03-27T08:21:07.000000Z
字数 5011
阅读 3865
vatic
docker
ubuntu
video
labeling
在此输入正文
检查版本:docker只支持内核版本3.10以上的。
root$ uname -r
4.4.0-31-generic # 满足要求
添加docker源
root$ echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list
root$ apt-get update
搜索并安装docker-engine
root$ apt-cache search docker
docker - System tray for KDE3/GNOME2 docklet applications
kdocker - lets you dock any application into the system tray
docker.io - Linux container runtime
golang-docker-dev - Externally reusable Go packages included with Docker
vim-syntax-docker - Docker container engine - Vim highlighting syntax files
root$ apt-get install docker-engine
Setting up docker-engine (17.05.0~ce-0~ubuntu-trusty) ...
检查docker版本
root$ docker version
Client:
Version: 17.05.0-ce
API version: 1.29
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:06:06 2017
OS/Arch: linux/amd64
Server:
Version: 17.05.0-ce
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:06:06 2017
OS/Arch: linux/amd64
Experimental: false
检查docker是否正常安装
root$ docker run hello-world
Hello 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 the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share 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 -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6842f46ad9a4 hello-world "/hello" About a minute ago Exited (0) About a minute ago vigorous_elion
停止并删除指定的镜像
root$ docker stop 6842f46ad9a4
6842f46ad9a4
root$ docker rm 6842f46ad9a4
6842f46ad9a4
拉取最新的镜像:共享视频数据目录
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:latest
Unable to find image 'jldowns/vatic-docker-contrib:latest' locally
latest: Pulling from jldowns/vatic-docker-contrib
30d541b48fc0: Pull complete
8ecd7f80d390: Pull complete
46ec9927bb81: Pull complete
2e67a4d67b44: Pull complete
7d9dd9155488: Pull complete
95614f897518: Pull complete
Digest: sha256:93280172aedce3ed1a1975c8ce3424dc62adf63d48753ffc1daeb26622548e8c
Status: Downloaded newer image for jldowns/vatic-docker-contrib:latest
root@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 were
not closed cleanly.
* Restarting web server apache2 [ OK ]
提取视频帧:注意vatic默认将宽度resize到720。
root@70ad25a4acd9$ cd vatic && pwd
/home/vagrant/vatic
root@70ad25a4acd9$ turkic extract ../vagrant_data/video.mp4 ../vagrant_data/frames/ --no-resize
avconv version 9.20-6:9.20-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
built 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 : mp42
minor_version : 1
compatible_brands: mp41mp42isom
creation_time : 2017-12-23 12:58:04
Duration: 00:01:42.14, start: 0.000000, bitrate: 1200 kb/s
Stream #0.0(und): Video: h264 (High), yuv420p, 960x540, 1148 kb/s, 30 fps, 30 tbr, 600 tbn
Metadata:
creation_time : 2017-12-23 12:58:04
Stream #0.1(und): Audio: aac, 44100 Hz, mono, fltp, 47 kb/s
Metadata:
creation_time : 2017-12-23 12:58:04
Output #0, image2, to '/tmp/pyvision-ffmpeg-477657550/%d.jpg':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
creation_time : 2017-12-23 12:58:04
encoder : Lavf54.20.4
Stream #0.0(und): Video: mjpeg, yuvj420p, 960x540, q=2-31, 10000 kb/s, 90k tbn, 600 tbc
Metadata:
creation_time : 2017-12-23 12:58:04
Decoding frames 0 to 100
Decoding frames 100 to 200
Decoding frames 200 to 300
Decoding frames 300 to 400
加载视频帧并发布任务:
job_id
:自己设定的任务唯一标识car skateboard airplane
:需要标注的实体类别
root@70ad25a4acd9$ turkic load job_id /home/vagrant/vagrant_data/frames/ car skateboard airplane --offline
Checking 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 --offline
http://localhost/?id=1&hitId=offline
http://localhost/?id=2&hitId=offline
http://localhost/?id=3&hitId=offline
http://localhost/?id=4&hitId=offline
http://localhost/?id=5&hitId=offline
http://localhost/?id=6&hitId=offline
http://localhost/?id=7&hitId=offline
http://localhost/?id=8&hitId=offline
http://localhost/?id=9&hitId=offline
http://localhost/?id=10&hitId=offline
http://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 --labels
root@70ad25a4acd9$ ffmpeg -f image2 -i ../vagrant_data/tmp/%d.jpg -vcodec libx264 -r 30 ../vagrant_data/out.mp4
root$ docker ps -a
root$ docker start $job_id
root$ docker attach $job_id