labelImg - installation

labelImg - installation

https://github.com/tzutalin/labelImg
LabelImg is a graphical image annotation tool and label object bounding boxes in images.

1. Installation

1.1 Download prebuilt binaries

  • Windows & Linux
  • macOS. Binaries for macOS are not yet available. Help would be appreciated. At present, it must be built from source.

https://tzutalin.github.io/labelImg/
https://github.com/tzutalin/labelImg#macos

1.2 Build from source

Linux/Ubuntu/Mac requires at least Python 2.6 and has been tested with PyQt 4.8.
https://www.python.org/getit/
https://www.riverbankcomputing.com/software/pyqt/intro

1.2.1 Ubuntu Linux

Python 2 + Qt4
sudo apt-get install pyqt4-dev-tools
sudo pip install lxml
make qt4py2
python labelImg.py
python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]

strong@foreverstrong:~$ sudo apt-get install pyqt4-dev-tools
[sudo] password for strong: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libqt4-designer libqt4-help libqt4-scripttools libqt4-svg libqt4-test libqtassistantclient4 python-qt4 python-sip
Suggested packages:
  python-qt4-dbg
The following NEW packages will be installed:
  libqt4-designer libqt4-help libqt4-scripttools libqt4-svg libqt4-test libqtassistantclient4 pyqt4-dev-tools python-qt4 python-sip
0 upgraded, 9 newly installed, 0 to remove and 241 not upgraded.
Need to get 6,763 kB of archives.
After this operation, 27.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://cn.archive.ubuntu.com/ubuntu xenial/main amd64 libqt4-designer amd64 4:4.8.7+dfsg-5ubuntu2 [3,631 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu xenial/main amd64 libqt4-help amd64 4:4.8.7+dfsg-5ubuntu2 [207 kB]                                                                                               
Get:3 http://cn.archive.ubuntu.com/ubuntu xenial/main amd64 libqt4-scripttools amd64 4:4.8.7+dfsg-5ubuntu2 [224 kB]                                                                                        
Get:4 http://cn.archive.ubuntu.com/ubuntu xenial/main amd64 libqt4-svg amd64 4:4.8.7+dfsg-5ubuntu2 [138 kB]                                                                                                
Get:5 http://cn.archive.ubuntu.com/ubuntu xenial/main amd64 libqt4-test amd64 4:4.8.7+dfsg-5ubuntu2 [61.1 kB]                                                                                              
Get:6 http://cn.archive.ubuntu.com/ubuntu xenial/universe amd64 libqtassistantclient4 amd64 4.6.3-7 [12.8 kB]                                                                                              
Get:7 http://cn.archive.ubuntu.com/ubuntu xenial/universe amd64 python-sip amd64 4.17+dfsg-1build1 [71.1 kB]                                                                                               
Get:8 http://cn.archive.ubuntu.com/ubuntu xenial/universe amd64 python-qt4 amd64 4.11.4+dfsg-1build4 [2,328 kB]                                                                                            
Get:9 http://cn.archive.ubuntu.com/ubuntu xenial/universe amd64 pyqt4-dev-tools amd64 4.11.4+dfsg-1build4 [88.5 kB]                                                                                        
Fetched 6,763 kB in 9s (686 kB/s)                                                                                                                                                                          
Selecting previously unselected package libqt4-designer:amd64.
(Reading database ... 276096 files and directories currently installed.)
Preparing to unpack .../libqt4-designer_4%3a4.8.7+dfsg-5ubuntu2_amd64.deb ...
Unpacking libqt4-designer:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Selecting previously unselected package libqt4-help:amd64.
Preparing to unpack .../libqt4-help_4%3a4.8.7+dfsg-5ubuntu2_amd64.deb ...
Unpacking libqt4-help:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Selecting previously unselected package libqt4-scripttools:amd64.
Preparing to unpack .../libqt4-scripttools_4%3a4.8.7+dfsg-5ubuntu2_amd64.deb ...
Unpacking libqt4-scripttools:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Selecting previously unselected package libqt4-svg:amd64.
Preparing to unpack .../libqt4-svg_4%3a4.8.7+dfsg-5ubuntu2_amd64.deb ...
Unpacking libqt4-svg:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Selecting previously unselected package libqt4-test:amd64.
Preparing to unpack .../libqt4-test_4%3a4.8.7+dfsg-5ubuntu2_amd64.deb ...
Unpacking libqt4-test:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Selecting previously unselected package libqtassistantclient4:amd64.
Preparing to unpack .../libqtassistantclient4_4.6.3-7_amd64.deb ...
Unpacking libqtassistantclient4:amd64 (4.6.3-7) ...
Selecting previously unselected package python-sip.
Preparing to unpack .../python-sip_4.17+dfsg-1build1_amd64.deb ...
Unpacking python-sip (4.17+dfsg-1build1) ...
Selecting previously unselected package python-qt4.
Preparing to unpack .../python-qt4_4.11.4+dfsg-1build4_amd64.deb ...
Unpacking python-qt4 (4.11.4+dfsg-1build4) ...
Selecting previously unselected package pyqt4-dev-tools.
Preparing to unpack .../pyqt4-dev-tools_4.11.4+dfsg-1build4_amd64.deb ...
Unpacking pyqt4-dev-tools (4.11.4+dfsg-1build4) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
/sbin/ldconfig.real: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.6 is not a symbolic link

/sbin/ldconfig.real: /usr/local/lib/libcudnn.so.6 is not a symbolic link

Processing triggers for man-db (2.7.5-1) ...
Setting up libqt4-designer:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Setting up libqt4-help:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Setting up libqt4-scripttools:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Setting up libqt4-svg:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Setting up libqt4-test:amd64 (4:4.8.7+dfsg-5ubuntu2) ...
Setting up libqtassistantclient4:amd64 (4.6.3-7) ...
Setting up python-sip (4.17+dfsg-1build1) ...
Setting up python-qt4 (4.11.4+dfsg-1build4) ...
Setting up pyqt4-dev-tools (4.11.4+dfsg-1build4) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
/sbin/ldconfig.real: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.6 is not a symbolic link

/sbin/ldconfig.real: /usr/local/lib/libcudnn.so.6 is not a symbolic link

strong@foreverstrong:~$ 
strong@foreverstrong:~$ sudo pip install lxml
The directory '/home/strong/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/strong/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting lxml
  Downloading https://files.pythonhosted.org/packages/af/09/cdb478d8b0392edd4047c5d1f7e6a1fb5e0e7a2f8f14fcf05c6e9ae9edff/lxml-4.2.3-cp27-cp27mu-manylinux1_x86_64.whl (5.8MB)
    100% |████████████████████████████████| 5.8MB 49kB/s 
Installing collected packages: lxml
Successfully installed lxml-4.2.3
strong@foreverstrong:~$ 

strong@foreverstrong:~/software_toolbox$ git clone https://github.com/tzutalin/labelImg.git

strong@foreverstrong:~/software_toolbox/labelImg-master$ make qt4py2
pyrcc4 -py2 -o resources.py resources.qrc
strong@foreverstrong:~/software_toolbox/labelImg-master$ python labelImg.py

Lock to Launcher
這裏寫圖片描述

Python 3 + Qt5
sudo apt-get install pyqt5-dev-tools
sudo pip3 install lxml
make qt5py3
python3 labelImg.py
python3 labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]

1.2.2 macOS

Python 2 + Qt4
brew install qt qt4
brew install libxml2
make qt4py2
python labelImg.py
python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]

Python 3 + Qt5 (Works on macOS High Sierra)
brew install qt # will install qt-5.x.x
brew install libxml2
make qt5py3
python labelImg.py
python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]

NEW Python 3 Virtualenv + Binary. This avoids a lot of the QT / Python version issues, and gives you a nice .app file with a new SVG Icon in your /Applications folder. You can consider this script: build-tools/build-for-macos.sh

brew install python3
pip install pipenv
pipenv –three
pipenv shell
pip install py2app
pip install PyQt5 lxml
make qt5py3
rm -rf build dist
python setup.py py2app -A
mv “dist/labelImg.app” /Applications

1.2.3 Windows

Download and setup Python 2.6 or later, PyQt4 and install lxml.
Open cmd and go to the labelImg directory
https://www.python.org/downloads/windows/
https://www.riverbankcomputing.com/software/pyqt/download
http://lxml.de/installation.html
https://github.com/tzutalin/labelImg#labelimg

pyrcc4 -o resources.py resources.qrc
python labelImg.py
python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]

1.2.4 Windows + Anaconda

Download and install Anaconda (Python 3+)
Open the Anaconda Prompt and go to the labelImg directory
https://www.anaconda.com/download/#download
https://github.com/tzutalin/labelImg#labelimg

conda install pyqt=5
pyrcc5 -o resources.py resources.qrc
python labelImg.py
python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]

1.3 Get from PyPI

pip install labelImg
labelImg
labelImg [IMAGE_PATH] [PRE-DEFINED CLASS FILE]

I tested pip on Ubuntu 14.04 and 16.04. However, I didn’t test pip on macOS and Windows

1.4 Use Docker

docker run -it \
--user $(id -u) \
-e DISPLAY=unix$DISPLAY \
--workdir=$(pwd) \
--volume="/home/$USER:/home/$USER" \
--volume="/etc/group:/etc/group:ro" \
--volume="/etc/passwd:/etc/passwd:ro" \
--volume="/etc/shadow:/etc/shadow:ro" \
--volume="/etc/sudoers.d:/etc/sudoers.d:ro" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
tzutalin/py2qt4

make qt4py2;./labelImg.py

You can pull the image which has all of the installed and required dependencies. Watch a demo video
https://www.youtube.com/watch?v=nw1GexJzbCI&feature=youtu.be

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章