數據標注軟件labelme詳解


https://blog.csdn.net/u014061630/article/details/88756644

Labelme 版本:3.11.2

文章目錄
1. Labelme 是什么?
2. Labelme 能干啥?
3. Labelme 安裝要求
4. Labelme 安裝方法
5. Labelme 使用教程
5.1 分類標注
5.2 目標檢測標注
5.3 場景分割標注
5.4 實例分割標注
5.5 視頻標注
5.6 其它形式的標注
5.7 命令行工具
6. Labelme 常見問題
7. Testing
8. Developing
9. 將 labelme 打包成可執行文件
致謝
1. Labelme 是什么?
Labelme 是一個圖形界面的圖像標注軟件。其的設計靈感來自於 http://labelme.csail.mit.edu/ 。它是用 Python 語言編寫的,圖形界面使用的是 Qt(PyQt)。


實例分割樣例(VOC)


其它樣例(場景分割,目標檢測,分類)


各形狀標注樣例(多邊形,矩形,圓形,多段線,線段,點)

2. Labelme 能干啥?
對圖像進行多邊形,矩形,圓形,多段線,線段,點形式的標注(可用於目標檢測,圖像分割,等任務)。
對圖像進行進行 flag 形式的標注(可用於圖像分類 和 清理 任務)。
視頻標注
生成 VOC 格式的數據集(for semantic / instance segmentation)
生成 COCO 格式的數據集(for instance segmentation)
3. Labelme 安裝要求
Ubuntu / macOS / Windows
Python2 / Python3
PyQt4 / PyQt5 / PySide2
4. Labelme 安裝方法
Labelme 安裝方法大體可分為兩大類:

通用安裝方法(各平台都適用):Anaconda,Docker。
各平台上的安裝方法:Ubuntu,macOS,Windows。
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

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

1
2
3
4
5
6
7

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
1
2
3
4
5
6
7
8

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
1
2
3
4
5
6
7

4.5 Windows
首先按照4.1的操作安裝,然后進行如下操作:

# Windows 上的 Pillow5 會導致 dll 加載錯誤,所以請安裝 Pillow4。
# 詳情見:https://github.com/wkentaro/labelme/pull/174
conda install pillow=4.0.0
1
2
3
5. Labelme 使用教程
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
1
2
3
4
5
6
7
8
9
10
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 命令查看。

5.1 分類標注
使用 labelme 進行圖像分類標注的教程詳見:labelme_classification


5.2 目標檢測標注
使用 labelme 進行目標檢測標注的教程詳見:labelme_bbox_detection


5.3 場景分割標注
使用 labelme 進行場景分割標注的教程詳見:labelme_semantic_segmentation


5.4 實例分割標注
使用 labelme 進行實例分割標注的教程詳見:labelme_instance_segmentation


5.5 視頻標注
使用 labelme 進行視頻標注的教程詳見:labelme_video_annotation


5.6 其它形式的標注
Labelme 除了能進行上面形式的標注,還能進行下面形式的標注:

多邊形
矩形
圓形
多段線
線段

使用 labelme 進行其它形式的標注的教程詳見:labelme_primitives


5.7 命令行工具
1. labelme_draw_json:
使用該命令可以快速查看JSON格式的標注。
2. labelme_json_to_dataset:
使用該命令可以將JSON文件轉為一組圖像和標簽文本文件。
3. labelme_draw_label_png:
將label文本文件以圖例的形式繪制到PNG格式的標簽上,並顯示出來。

關於上面三個命令的詳細使用的方法見:命令行工具

6. Labelme 常見問題
如何將 JSON 文件轉換為 NumPy 數組?請查閱 examples/tutorial。
如何加載 PNG 標簽文件?請查閱 examples/tutorial。
如何獲取語義分割的標注?請查閱 examples/semantic_segmentation。
如何獲取實例分割的標注?請查閱 examples/instance_segmentation。
7. Testing
pip install hacking pytest pytest-qt
flake8 .
pytest -v tests
1
2
3
8. Developing
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 .
1
2
3
4
5
6
7
9. 將 labelme 打包成可執行文件
下面的代碼說明了如何構建獨立可執行文件(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
1
2
3
4
5
6
7
8
9
致謝
labelme 是在 mpitid/pylabelme 的基礎上開發而成,但后者已經停止開發了。


————————————————
版權聲明:本文為CSDN博主「黑暗星球」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/u014061630/article/details/88756644


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM