Update README.md and setup.py

This commit is contained in:
tzutalin 2019-05-25 20:58:20 -07:00
parent 3ecc86029b
commit a1a32f6230
5 changed files with 93 additions and 51 deletions

View File

@ -1,7 +1,12 @@
=======
History History
======= =======
1.8.2 (2018-12-02)
------------------
* Fix pip depolyment issue
1.8.1 (2018-12-02) 1.8.1 (2018-12-02)
------------------ ------------------

View File

@ -1,6 +1,6 @@
# ex: set ts=8 noet: # ex: set ts=8 noet:
all: qt5 all: qt5 test
test: testpy3 test: testpy3
@ -24,6 +24,12 @@ qt5py3:
pyrcc5 -o libs/resources.py resources.qrc pyrcc5 -o libs/resources.py resources.qrc
clean: clean:
rm -f ~/.labelImgSettings.pkl resources.pyc rm -rf ~/.labelImgSettings.pkl *.pyc dist labelImg.egg-info __pycache__ build
.PHONY: test pip_upload:
python3 setup.py upload
long_description:
restview --long-description
.PHONY: all

View File

@ -16,7 +16,7 @@ LabelImg is a graphical image annotation tool.
It is written in Python and uses Qt for its graphical interface. It is written in Python and uses Qt for its graphical interface.
Annotations are saved as XML files in PASCAL VOC format, the format used Annotations are saved as XML files in PASCAL VOC format, the format used
by `ImageNet <http://www.image-net.org/>`__. Besdies, it also supports YOLO format by `ImageNet <http://www.image-net.org/>`__. Besides, it also supports YOLO format
.. image:: https://raw.githubusercontent.com/tzutalin/labelImg/master/demo/demo3.jpg .. image:: https://raw.githubusercontent.com/tzutalin/labelImg/master/demo/demo3.jpg
:alt: Demo Image :alt: Demo Image
@ -29,19 +29,14 @@ by `ImageNet <http://www.image-net.org/>`__. Besdies, it also supports YOLO for
Installation Installation
------------------ ------------------
Download prebuilt binaries
~~~~~~~~~~~~~~~~~~~~~~~~~~
- `Windows <https://github.com/tzutalin/labelImg/releases>`__
- macOS. Binaries for macOS are not yet available. Help would be appreciated. At present, it must be `built from source <#macos>`__.
Build from source Build from source
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
Linux/Ubuntu/Mac requires at least `Python Linux/Ubuntu/Mac requires at least `Python
2.6 <https://www.python.org/getit/>`__ and has been tested with `PyQt 2.6 <https://www.python.org/getit/>`__ and has been tested with `PyQt
4.8 <https://www.riverbankcomputing.com/software/pyqt/intro>`__. 4.8 <https://www.riverbankcomputing.com/software/pyqt/intro>`__. However, `Python
3 or above <https://www.python.org/getit/>`__ and `PyQt5 <https://pypi.org/project/PyQt5/>`__ are strongly recommended.
Ubuntu Linux Ubuntu Linux
@ -56,7 +51,7 @@ Python 2 + Qt4
python labelImg.py python labelImg.py
python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]
Python 3 + Qt5 (Recommanded) Python 3 + Qt5 (Recommended)
.. code:: shell .. code:: shell
@ -78,14 +73,14 @@ Python 2 + Qt4
python labelImg.py python labelImg.py
python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]
Python 3 + Qt5 (Recommanded) Python 3 + Qt5 (Recommended)
.. code:: shell .. code:: shell
brew install qt # Install qt-5.x.x by Homebrew brew install qt # Install qt-5.x.x by Homebrew
brew install libxml2 brew install libxml2
or or using pip
pip3 install pyqt5 lxml # Install qt and lxml by pip pip3 install pyqt5 lxml # Install qt and lxml by pip
@ -94,23 +89,21 @@ Python 3 + Qt5 (Recommanded)
python3 labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] python3 labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]
**NEW** Python 3 Virtualenv + Binary Python 3 Virtualenv (Recommended)
This can avoid a lot of the QT / Python version issues, and gives you a nice .app file with a new SVG Icon Virtualenv can avoid a lot of the QT / Python version issues
in your /Applications folder. You can consider this script: build-tools/build-for-macos.sh
.. code:: shell .. code:: shell
brew install python3 brew install python3
pip install pipenv pip3 install pipenv
pipenv --three pipenv --three # or pipenv install pyqt5 lxml
pipenv shell pipenv run pip install pyqt5 lxml
pip install py2app pipenv run make qt5py3
pip install PyQt5 lxml python3 labelImg.py
make qt5py3 [Optional] rm -rf build dist; python setup.py py2app -A;mv "dist/labelImg.app" /Applications
rm -rf build dist
python setup.py py2app -A Note: The Last command gives you a nice .app file with a new SVG Icon in your /Applications folder. You can consider using the script: build-tools/build-for-macos.sh
mv "dist/labelImg.app" /Applications
Windows Windows
@ -142,15 +135,14 @@ Open the Anaconda Prompt and go to the `labelImg <#labelimg>`__ directory
python labelImg.py python labelImg.py
python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]
Get from PyPI Get from PyPI but only python3.0 or above
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: shell .. code:: shell
pip install labelImg pip3 install labelImg
labelImg labelImg
labelImg [IMAGE_PATH] [PRE-DEFINED CLASS FILE] 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
Use Docker Use Docker
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
@ -198,15 +190,15 @@ Steps (YOLO)
2. Build and launch using the instructions above. 2. Build and launch using the instructions above.
3. Right below "Save" button in toolbar, click "PascalVOC" button to switch to YOLO format. 3. Right below "Save" button in the toolbar, click "PascalVOC" button to switch to YOLO format.
4. You may use Open/OpenDIR to process single or multiple images. When finished with single image, click save. 4. You may use Open/OpenDIR to process single or multiple images. When finished with a single image, click save.
A txt file of yolo format will be saved in the same folder as your image with same name. A file named "classes.txt" is saved to that folder too. "classes.txt" defines the list of class names that your yolo label refers to. A txt file of YOLO format will be saved in the same folder as your image with same name. A file named "classes.txt" is saved to that folder too. "classes.txt" defines the list of class names that your YOLO label refers to.
Note: Note:
- Your label list shall not change in the middle of processing a list of images. When you save a image, classes.txt will also get updated, while previous annotations will not be updated. - Your label list shall not change in the middle of processing a list of images. When you save an image, classes.txt will also get updated, while previous annotations will not be updated.
- You shouldn't use "default class" function when saving to YOLO format, it will not be referred. - You shouldn't use "default class" function when saving to YOLO format, it will not be referred.
@ -255,7 +247,7 @@ This is used when creating a dataset automatically, the user can then through al
**Difficult:** **Difficult:**
The difficult field being set to 1 indicates that the object has been annotated as "difficult", for example an object which is clearly visible but difficult to recognize without substantial use of context. The difficult field is set to 1 indicates that the object has been annotated as "difficult", for example, an object which is clearly visible but difficult to recognize without substantial use of context.
According to your deep neural network implementation, you can include or exclude difficult objects during training. According to your deep neural network implementation, you can include or exclude difficult objects during training.
How to contribute How to contribute
@ -276,6 +268,7 @@ Related
download image, create a label text for machine learning, etc download image, create a label text for machine learning, etc
2. `Use Docker to run labelImg <https://hub.docker.com/r/tzutalin/py2qt4>`__ 2. `Use Docker to run labelImg <https://hub.docker.com/r/tzutalin/py2qt4>`__
3. `Generating the PASCAL VOC TFRecord files <https://github.com/tensorflow/models/blob/4f32535fe7040bb1e429ad0e3c948a492a89482d/research/object_detection/g3doc/preparing_inputs.md#generating-the-pascal-voc-tfrecord-files>`__ 3. `Generating the PASCAL VOC TFRecord files <https://github.com/tensorflow/models/blob/4f32535fe7040bb1e429ad0e3c948a492a89482d/research/object_detection/g3doc/preparing_inputs.md#generating-the-pascal-voc-tfrecord-files>`__
4. `App Icon based on Icon by Nick Roach (GPL)` <https://www.elegantthemes.com/> <https://www.iconfinder.com/icons/1054978/shop_tag_icon> __ 4. `App Icon based on Icon by Nick Roach (GPL) <https://www.elegantthemes.com/>`__
5. `Setup python development in vscode <https://tzutalin.blogspot.com/2019/04/set-up-visual-studio-code-for-python-in.html>`__

View File

@ -1,2 +1,2 @@
__version_info__ = ('1', '8', '1') __version_info__ = ('1', '8', '2')
__version__ = '.'.join(__version_info__) __version__ = '.'.join(__version_info__)

View File

@ -9,6 +9,8 @@ import os
here = os.path.abspath(os.path.dirname(__file__)) here = os.path.abspath(os.path.dirname(__file__))
NAME = 'labelImg' NAME = 'labelImg'
REQUIRES_PYTHON = '>=3.0.0'
REQUIRED_DEP = ['pyqt5', 'lxml']
about = {} about = {}
with open(os.path.join(here, 'libs', '__init__.py')) as f: with open(os.path.join(here, 'libs', '__init__.py')) as f:
@ -21,14 +23,6 @@ with open('HISTORY.rst') as history_file:
history = history_file.read() history = history_file.read()
REQUIRED = []
if (sys.version_info > (3, 0)):
REQUIRED = ['pyqt5', 'lxml']
else:
print('\033[93m For py2, you are unable to installl pyqt4 by pip \033[0m')
REQUIRED = ['lxml']
# OS specific settings # OS specific settings
SET_REQUIRES = [] SET_REQUIRES = []
if _platform == "linux" or _platform == "linux2": if _platform == "linux" or _platform == "linux2":
@ -47,6 +41,47 @@ OPTIONS = {
'iconfile': 'resources/icons/app.icns' 'iconfile': 'resources/icons/app.icns'
} }
class UploadCommand(Command):
"""Support setup.py upload."""
description=readme + '\n\n' + history,
user_options = []
@staticmethod
def status(s):
"""Prints things in bold."""
print('\033[1m{0}\033[0m'.format(s))
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
try:
self.status('Removing previous builds…')
rmtree(os.path.join(here, 'dist'))
except OSError:
self.status('Fail to remove previous builds..')
pass
self.status('Building Source and Wheel (universal) distribution…')
os.system(
'{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
self.status('Uploading the package to PyPI via Twine…')
os.system('twine upload dist/*')
self.status('Pushing git tags…')
os.system('git tag -d v{0}'.format(about['__version__']))
os.system('git tag v{0}'.format(about['__version__']))
# os.system('git push --tags')
sys.exit()
setup( setup(
app=APP, app=APP,
name=NAME, name=NAME,
@ -56,6 +91,7 @@ setup(
author="TzuTa Lin", author="TzuTa Lin",
author_email='tzu.ta.lin@gmail.com', author_email='tzu.ta.lin@gmail.com',
url='https://github.com/tzutalin/labelImg', url='https://github.com/tzutalin/labelImg',
python_requires=REQUIRES_PYTHON,
package_dir={'labelImg': '.'}, package_dir={'labelImg': '.'},
packages=required_packages, packages=required_packages,
entry_points={ entry_points={
@ -64,7 +100,7 @@ setup(
] ]
}, },
include_package_data=True, include_package_data=True,
install_requires=REQUIRED, install_requires=REQUIRED_DEP,
license="MIT license", license="MIT license",
zip_safe=False, zip_safe=False,
keywords='labelImg labelTool development annotation deeplearning', keywords='labelImg labelTool development annotation deeplearning',
@ -73,16 +109,18 @@ setup(
'Intended Audience :: Developers', 'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License', 'License :: OSI Approved :: MIT License',
'Natural Language :: English', 'Natural Language :: English',
"Programming Language :: Python :: 2",
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
], ],
package_data={'data/predefined_classes.txt': ['data/predefined_classes.txt']}, package_data={'data/predefined_classes.txt': ['data/predefined_classes.txt']},
options={'py2app': OPTIONS}, options={'py2app': OPTIONS},
setup_requires= SET_REQUIRES setup_requires=SET_REQUIRES,
# $ setup.py publish support.
cmdclass={
'upload': UploadCommand,
}
) )