Labelme是一个图形图像标注工具,灵感来自http://labelme.csail.mit.edu
它是用Python编写的,并使用Qt作为其图形界面


各种图元(多边形、矩形、圆、直线和点)

功能

要求

安装

有以下选项:

python

您需要安装Anaconda,然后在下面运行:

# python2
conda create --name=labelme python=2.7
source activate labelme
# conda install -c conda-forge pyside2
conda install pyqt
pip install labelme
# if you'd like to use the latest version. run below: # pip install git+https://github.com/wkentaro/labelme.git # python3
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
# or you can install everything by conda command # conda install labelme -c conda-forge

码头工人

您需要安装docker,然后在下面运行:

# on macOS
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" &
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=docker.for.mac.host.internal:0 -v $(pwd):/root/workdir wkentaro/labelme

# on Linux
xhost +
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=:0 -v $(pwd):/root/workdir wkentaro/labelme

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

# or install standalone executable from: # https://github.com/wkentaro/labelme/releases

Ubuntu 19.10+/debian(Sid)

sudo apt-get install labelme

MacOS

# macOS Sierra
brew install pyqt  # maybe pyqt5
pip install labelme  # both python2/3 should work # or install standalone executable/app from: # https://github.com/wkentaro/labelme/releases

窗口

安装Anaconda,然后在python提示运行中:

# python3
conda create --name=labelme python=3.6
conda activate labelme
pip install labelme

用法

labelme --help有关详细信息,请参阅
批注另存为JSON文件

labelme  # just open gui # tutorial (single image example) cd examples/tutorial
labelme apc2016_obj3.jpg  # specify image file
labelme apc2016_obj3.jpg -O apc2016_obj3.json  # close window after the save
labelme apc2016_obj3.jpg --nodata  # not include image data but relative image path in JSON file
labelme apc2016_obj3.jpg \
  --labels highland_6539_self_stick_notes,mead_index_cards,kong_air_dog_squeakair_tennis_ball  # specify label list # semantic segmentation example cd examples/semantic_segmentation
labelme data_annotated/  # Open directory to annotate all images in it
labelme data_annotated/ --labels labels.txt  # specify label list with a file

有关更高级的用法,请参阅示例:

命令行参数

  • --output指定将写入批注的位置。如果位置以.json结尾,则此文件中将写入单个注释。如果使用.json指定位置,则只能注释一个图像。如果位置不是以.json结尾,程序将假定它是一个目录。批注将存储在此目录中,其名称与在其上进行批注的图像相对应
  • 第一次运行labelme时,它将在~/.labelmerc您可以编辑此文件,更改将在下次启动labelme时应用。如果您希望使用来自其他位置的配置文件,可以使用--config旗帜
  • 如果没有--nosortlabels标志时,程序将按字母顺序列出标签。当程序使用此标志运行时,它将按照标签提供的顺序显示标签
  • 将标志分配给整个图像。Example
  • 标签指定给单个多边形。Example

常见问题解答

测试

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 .

如何构建独立的可执行文件

下面显示了如何在MacOS、Linux和Windows上构建独立的可执行文件

# 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

如何做出贡献

确保以下测试在您的环境中通过
看见.github/workflows/ci.yml有关更多详细信息,请参阅

pip install black hacking pytest pytest-qt

flake8 .
black --line-length 79 --check labelme/
MPLBACKEND='agg' pytest tests/ -m 'not gpu'

确认

这项回购是mpitid/pylabelme,它的发育已经停止了

引用此项目

如果您在研究中使用此项目或希望参考自述文件中发布的基线结果,请使用以下BibTeX条目

@misc{labelme2016,
  author =       {Kentaro Wada},
  title =        {{labelme: Image Polygonal Annotation with Python}},
  howpublished = {\url{https://github.com/wkentaro/labelme}},
  year =         {2016}
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。