Labelme 版本:3.11.2
Labelme 是一个图形界面的图像标注软件。其的设计灵感来自于 http://labelme.csail.mit.edu/ 。它是用 Python 语言编写的,图形界面使用的是 Qt(PyQt)。
各形状标注样例(多边形,矩形,圆形,多段线,线段,点)
Labelme 安装方法大体可分为两大类:
4.1 Anaconda
首先安装 Anaconda,然后运行下列命令:
##################
## for Python 2 ##
##################
conda create --name=labelme python=2.7
source activate labelme
# conda install -c conda-forge pyside2
conda install pyqt
pip install labelme
# 如果想安装最新版本,请使用下列命令安装:
# pip install git+https://github.com/wkentaro/labelme.git
##################
## for Python 3 ##
##################
conda create --name=labelme python=3.6
source activate labelme
# conda install -c conda-forge pyside2
# conda install pyqt
pip install pyqt5 # pyqt5 can be installed via pip on python3
pip install labelme
4.2 Docker
首先安装 Docker,然后运行下列命令:
wget https://raw.githubusercontent.com/wkentaro/labelme/master/labelme/cli/on_docker.py -O labelme_on_docker
chmod u+x labelme_on_docker
# Maybe you need http://sourabhbajaj.com/blog/2017/02/07/gui-applications-docker-mac/ on macOS
./labelme_on_docker examples/tutorial/apc2016_obj3.jpg -O examples/tutorial/apc2016_obj3.json
./labelme_on_docker examples/semantic_segmentation/data_annotated
4.3 Ubuntu
# Ubuntu 14.04 / Ubuntu 16.04
# Python2
# sudo apt-get install python-qt4 # PyQt4
sudo apt-get install python-pyqt5 # PyQt5
sudo pip install labelme
# Python3
sudo apt-get install python3-pyqt5 # PyQt5
sudo pip3 install labelme
4.4 macOS
# macOS Sierra
brew install pyqt # maybe pyqt5
pip install labelme # both python2/3 should work
# or install standalone executable / app
brew install wkentaro/labelme/labelme
brew cask install wkentaro/labelme/labelme
4.5 Windows
首先按照4.1的操作安装,然后进行如下操作:
# Windows 上的 Pillow5 会导致 dll 加载错误,所以请安装 Pillow4。
# 详情见:https://github.com/wkentaro/labelme/pull/174
conda install pillow=4.0.0
Labelme 能够进行多种形式的图像数据标注。Labelme 以 JSON 文件存储标注信息。下面介绍一些 labelme 软件的基本操作。
labelme # 打开labelme软件
labelme apc2016_obj3.jpg # 指定图像文件
labelme apc2016_obj3.jpg -O apc2016_obj3.json # 保存后关闭labelme
labelme apc2016_obj3.jpg --nodata # JSON文件不包含图像数据,而包含图像的相对路径
labelme apc2016_obj3.jpg \
--labels highland_6539_self_stick_notes,mead_index_cards,kong_air_dog_squeakair_tennis_ball # 指定 label list
labelme data_annotated/ # 指定图像文件夹
labelme data_annotated/ --labels labels.txt # 使用文件指定 label list
labelme 常用的命令行参数:
--flags
: comma separated list of flags 或者 file containing flags--labels
:comma separated list of labels 或者 file containing labels--nodata
:stop storing image data to JSON file--nosortlabels
:stop sorting labels--output
:指定输出文件夹关于命令行参数的更多信息,可以使用 labelme --help
命令查看。
使用 labelme 进行图像分类标注的教程详见:labelme_classification
使用 labelme 进行目标检测标注的教程详见:labelme_bbox_detection
使用 labelme 进行场景分割标注的教程详见:labelme_semantic_segmentation
使用 labelme 进行实例分割标注的教程详见:labelme_instance_segmentation
使用 labelme 进行视频标注的教程详见:labelme_video_annotation
Labelme 除了能进行上面形式的标注,还能进行下面形式的标注:
使用 labelme 进行其它形式的标注的教程详见:labelme_primitives
1. labelme_draw_json
:
使用该命令可以快速查看JSON格式的标注。
2. labelme_json_to_dataset
:
使用该命令可以将JSON文件转为一组图像和标签文本文件。
3. labelme_draw_label_png
:
将label文本文件以图例的形式绘制到PNG格式的标签上,并显示出来。
关于上面三个命令的详细使用的方法见:命令行工具
pip install hacking pytest pytest-qt
flake8 .
pytest -v tests
git clone https://github.com/wkentaro/labelme.git
cd labelme
# Install anaconda3 and labelme
curl -L https://github.com/wkentaro/dotfiles/raw/master/local/bin/install_anaconda3.sh | bash -s .
source .anaconda3/bin/activate
pip install -e .
下面的代码说明了如何构建独立可执行文件(Linux,Windows,macOS)。当然,我们也发布了预编译版本。
# Setup conda
conda create --name labelme python==3.6.0
conda activate labelme
# Build the standalone executable
pip install .
pip install pyinstaller
pyinstaller labelme.spec
dist/labelme --version
labelme 是在 mpitid/pylabelme 的基础上开发而成,但后者已经停止开发了。
参考资料