pax_global_header 0000666 0000000 0000000 00000000064 14145511017 0014511 g ustar 00root root 0000000 0000000 52 comment=ed8169c85b2735444bf2371b84e3dc45a04f06de
labelme-4.6.0/ 0000775 0000000 0000000 00000000000 14145511017 0013121 5 ustar 00root root 0000000 0000000 labelme-4.6.0/.flake8 0000664 0000000 0000000 00000000100 14145511017 0014263 0 ustar 00root root 0000000 0000000 [flake8]
exclude = .anaconda3/*
ignore = E203, E741, W503, W504
labelme-4.6.0/.github/ 0000775 0000000 0000000 00000000000 14145511017 0014461 5 ustar 00root root 0000000 0000000 labelme-4.6.0/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14145511017 0016644 5 ustar 00root root 0000000 0000000 labelme-4.6.0/.github/ISSUE_TEMPLATE/bug_report.md 0000664 0000000 0000000 00000001223 14145511017 0021334 0 ustar 00root root 0000000 0000000 ---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug?
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. Ubuntu 18.04]
- Labelme Version [e.g. 4.2.9]
**Additional context**
Add any other context about the problem here.
labelme-4.6.0/.github/ISSUE_TEMPLATE/feature_request.md 0000664 0000000 0000000 00000001141 14145511017 0022366 0 ustar 00root root 0000000 0000000 ---
name: Feature request
about: Suggest an idea for this project
title: "[Feature]"
labels: feature
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
labelme-4.6.0/.github/ISSUE_TEMPLATE/question.md 0000664 0000000 0000000 00000000674 14145511017 0021044 0 ustar 00root root 0000000 0000000 ---
name: Question
about: Ask a question about this project
title: "[Question]"
labels: question
assignees: ''
---
**What is your question? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe what you have tried so far**
A clear and concise description of what you have tried.
**Additional context**
Add any other context or screenshots about the feature request here.
labelme-4.6.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14145511017 0016516 5 ustar 00root root 0000000 0000000 labelme-4.6.0/.github/workflows/ci.yml 0000664 0000000 0000000 00000011636 14145511017 0017643 0 ustar 00root root 0000000 0000000 name: ci
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ['3.7', '2.7']
PYTEST_QT_API: [pyqt5, pyqt4v2]
exclude:
- os: macos-latest
PYTEST_QT_API: pyqt4v2
- os: windows-latest
PYTEST_QT_API: pyqt4v2
- python-version: '3.7'
PYTEST_QT_API: pyqt4v2
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
shell: bash -l {0}
run: |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
sudo apt-get install -y coreutils
sudo apt-get install -y xvfb herbstluftwm
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
brew install coreutils
brew install --cask xquartz
fi
- name: Set up Python
shell: bash -l {0}
run: |
conda install -q -y python=${{ matrix.python-version }}
which python
python --version
pip --version
- name: Install dependencies
shell: bash -l {0}
run: |
if [ "${{ matrix.PYTEST_QT_API }}" = "pyside2" ]; then
if [ "${{ matrix.python-version }}" = "2.7" ]; then
conda install -q -y 'pyside2!=5.12.4' -c conda-forge
else
conda install -q -y pyside2 -c conda-forge
fi
elif [ "${{ matrix.PYTEST_QT_API }}" = "pyqt4v2" ]; then
conda install -q -y pyqt=4 -c conda-forge
else # pyqt5
if [ "${{ matrix.os }}" = "macos-latest" -a "${{ matrix.python-version }}" = "3.7" ]; then
pip install pyqt5
else
conda install -q -y pyqt=5
fi
fi
if [ "${{ matrix.os }}" != "windows-latest" ]; then
conda install -q -y help2man
fi
pip install hacking pytest 'pytest-qt<4'
- name: Install main
shell: bash -l {0}
run: |
pip install .
- name: Lint with flake8
shell: bash -l {0}
if: matrix.os != 'windows-latest'
run: |
flake8 .
- name: Black
shell: bash -l {0}
if: matrix.os != 'windows-latest' && matrix.python-version != '2.7'
run: |
pip install black
black --line-length 79 --check --diff labelme
- name: Test with pytest
shell: bash -l {0}
if: matrix.os != 'windows-latest'
env:
PYTEST_QT_API: ${{ matrix.PYTEST_QT_API }}
run: |
# open virtual display
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
export DISPLAY=:99.0
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX +render -noreset
(herbstluftwm )&
else
(sudo Xvfb :99 -ac -screen 0 1024x768x8 )&
fi
# run test
MPLBACKEND='agg' pytest tests -m 'not gpu'
- name: Run examples
shell: bash -l {0}
if: matrix.os != 'windows-latest'
env:
MPLBACKEND: agg
run: |
labelme --help
labelme --version
(cd examples/primitives && labelme_json_to_dataset primitives.json && rm -rf primitives_json)
(cd examples/tutorial && rm -rf apc2016_obj3_json && labelme_json_to_dataset apc2016_obj3.json && python load_label_png.py && git checkout -- .)
(cd examples/semantic_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
(cd examples/instance_segmentation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
(cd examples/video_annotation && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
pip install lxml # for bbox_detection/labelme2voc.py
(cd examples/bbox_detection && rm -rf data_dataset_voc && ./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt && git checkout -- .)
pip install cython && pip install pycocotools # for instance_segmentation/labelme2coco.py
(cd examples/instance_segmentation && rm -rf data_dataset_coco && ./labelme2coco.py data_annotated data_dataset_coco --labels labels.txt && git checkout -- .)
- name: Run pyinstaller
shell: bash -l {0}
if: matrix.PYTEST_QT_API == 'pyqt5' && matrix.python-version == '3.7'
run: |
# Build the standalone executable
pip install PyQt5 -I --use-feature=2020-resolver # https://stackoverflow.com/a/68784578
pip install pyinstaller
pyinstaller labelme.spec
dist/labelme --version
labelme-4.6.0/.github/workflows/release.yml 0000664 0000000 0000000 00000006006 14145511017 0020663 0 ustar 00root root 0000000 0000000 name: release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Create release url file
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
- name: Save release url file for publish
uses: actions/upload-artifact@v1
with:
name: release_url
path: release_url.txt
publish:
needs: [release]
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: '3.7'
- name: Install main
shell: bash -l {0}
run: |
pip install .
- name: Run pyinstaller
shell: bash -l {0}
run: |
pip install pyinstaller
pyinstaller labelme.spec
- name: Load release url file from release job
uses: actions/download-artifact@v1
with:
name: release_url
- name: Get release file name & upload url
id: get_release_info
run: |
echo "::set-output name=upload_url::$(cat release_url/release_url.txt)"
- name: Upload release executable on macOS & Linux
id: upload_release_executable_macos_linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./dist/labelme
asset_name: labelme-${{ runner.os }}
asset_content_type: application/octet-stream
if: runner.os != 'Windows'
- name: Upload release executable on Windows
id: upload_release_executable_windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./dist/labelme.exe
asset_name: Labelme.exe
asset_content_type: application/octet-stream
if: runner.os == 'Windows'
- name: Create dmg for macOS
run: |
npm install -g create-dmg
cd dist
create-dmg Labelme.app || test -f Labelme\ 0.0.0.dmg
mv Labelme\ 0.0.0.dmg Labelme.dmg
if: runner.os == 'macOS'
- name: Upload release app on macOS
id: upload_release_app_macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./dist/Labelme.dmg
asset_name: Labelme.dmg
asset_content_type: application/octet-stream
if: runner.os == 'macOS'
labelme-4.6.0/.gitignore 0000664 0000000 0000000 00000000123 14145511017 0015105 0 ustar 00root root 0000000 0000000 /.cache/
/.pytest_cache/
/build/
/dist/
/*.egg-info/
*.py[cdo]
.DS_Store
.idea/
labelme-4.6.0/.gitmodules 0000664 0000000 0000000 00000000141 14145511017 0015272 0 ustar 00root root 0000000 0000000 [submodule "github2pypi"]
path = github2pypi
url = https://github.com/wkentaro/github2pypi.git
labelme-4.6.0/LICENSE 0000664 0000000 0000000 00000001264 14145511017 0014131 0 ustar 00root root 0000000 0000000 Copyright (C) 2016-2018 Kentaro Wada.
Copyright (C) 2011 Michael Pitidis, Hussein Abdulwahid.
Labelme is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Labelme is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Labelme. If not, see
VOC dataset example of instance segmentation.
Other examples (semantic segmentation, bbox detection, and classification).
Various primitives (polygon, rectangle, circle, line, and point).
## Features
- [x] Image annotation for polygon, rectangle, circle, line and point. ([tutorial](examples/tutorial))
- [x] Image flag annotation for classification and cleaning. ([#166](https://github.com/wkentaro/labelme/pull/166))
- [x] Video annotation. ([video annotation](examples/video_annotation))
- [x] GUI customization (predefined labels / flags, auto-saving, label validation, etc). ([#144](https://github.com/wkentaro/labelme/pull/144))
- [x] Exporting VOC-format dataset for semantic/instance segmentation. ([semantic segmentation](examples/semantic_segmentation), [instance segmentation](examples/instance_segmentation))
- [x] Exporting COCO-format dataset for instance segmentation. ([instance segmentation](examples/instance_segmentation))
## Requirements
- Ubuntu / macOS / Windows
- Python2 / Python3
- [PyQt4 / PyQt5](http://www.riverbankcomputing.co.uk/software/pyqt/intro)
## Installation
There are options:
- Platform agnostic installation: [Anaconda](#anaconda), [Docker](#docker)
- Platform specific installation: [Ubuntu](#ubuntu), [macOS](#macos), [Windows](#windows)
- Pre-build binaries from [the release section](https://github.com/wkentaro/labelme/releases)
### Anaconda
You need install [Anaconda](https://www.continuum.io/downloads), then run below:
```bash
# 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
You need install [docker](https://www.docker.com), then run below:
```bash
# 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
```bash
# 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)
```bash
sudo apt-get install labelme
```
### macOS
```bash
brew install pyqt # maybe pyqt5
pip install labelme # both python2/3 should work
brew install wkentaro/labelme/labelme # command line interface
# brew install --cask wkentaro/labelme/labelme # app
# or install standalone executable/app from:
# https://github.com/wkentaro/labelme/releases
```
### Windows
Install [Anaconda](https://www.continuum.io/downloads), then in an Anaconda Prompt run:
```bash
# python3
conda create --name=labelme python=3.6
conda activate labelme
pip install labelme
```
## Usage
Run `labelme --help` for detail.
The annotations are saved as a [JSON](http://www.json.org/) file.
```bash
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
```
For more advanced usage, please refer to the examples:
* [Tutorial (Single Image Example)](examples/tutorial)
* [Semantic Segmentation Example](examples/semantic_segmentation)
* [Instance Segmentation Example](examples/instance_segmentation)
* [Video Annotation Example](examples/video_annotation)
### Command Line Arguments
- `--output` specifies the location that annotations will be written to. If the location ends with .json, a single annotation will be written to this file. Only one image can be annotated if a location is specified with .json. If the location does not end with .json, the program will assume it is a directory. Annotations will be stored in this directory with a name that corresponds to the image that the annotation was made on.
- The first time you run labelme, it will create a config file in `~/.labelmerc`. You can edit this file and the changes will be applied the next time that you launch labelme. If you would prefer to use a config file from another location, you can specify this file with the `--config` flag.
- Without the `--nosortlabels` flag, the program will list labels in alphabetical order. When the program is run with this flag, it will display labels in the order that they are provided.
- Flags are assigned to an entire image. [Example](examples/classification)
- Labels are assigned to a single polygon. [Example](examples/bbox_detection)
## FAQ
- **How to convert JSON file to numpy array?** See [examples/tutorial](examples/tutorial#convert-to-dataset).
- **How to load label PNG file?** See [examples/tutorial](examples/tutorial#how-to-load-label-png-file).
- **How to get annotations for semantic segmentation?** See [examples/semantic_segmentation](examples/semantic_segmentation).
- **How to get annotations for instance segmentation?** See [examples/instance_segmentation](examples/instance_segmentation).
## Testing
```bash
pip install hacking pytest pytest-qt
flake8 .
pytest -v tests
```
## Developing
```bash
git clone https://github.com/wkentaro/labelme.git
cd labelme
# Install anaconda3 and labelme
curl -L https://github.com/wkentaro/dotfiles/raw/main/local/bin/install_anaconda3.sh | bash -s .
source .anaconda3/bin/activate
pip install -e .
```
## How to build standalone executable
Below shows how to build the standalone executable on macOS, Linux and Windows.
```bash
# 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
```
## How to contribute
Make sure below test passes on your environment.
See `.github/workflows/ci.yml` for more detail.
```bash
pip install black hacking pytest pytest-qt
flake8 .
black --line-length 79 --check labelme/
MPLBACKEND='agg' pytest tests/ -m 'not gpu'
```
## Acknowledgement
This repo is the fork of [mpitid/pylabelme](https://github.com/mpitid/pylabelme),
whose development has already stopped.
## Cite This Project
If you use this project in your research or wish to refer to the baseline results published in the README, please use the following BibTeX entry.
```bash
@misc{labelme2016,
author = {Kentaro Wada},
title = {{labelme: Image Polygonal Annotation with Python}},
howpublished = {\url{https://github.com/wkentaro/labelme}},
year = {2016}
}
```
labelme-4.6.0/docker/ 0000775 0000000 0000000 00000000000 14145511017 0014370 5 ustar 00root root 0000000 0000000 labelme-4.6.0/docker/Dockerfile 0000664 0000000 0000000 00000001002 14145511017 0016353 0 ustar 00root root 0000000 0000000 FROM ubuntu:bionic
LABEL maintainer "Kentaro Wada