diff --git a/build-tools/.gitignore b/build-tools/.gitignore index 03e82312..479a17c6 100644 --- a/build-tools/.gitignore +++ b/build-tools/.gitignore @@ -6,3 +6,4 @@ python-2.* pywin32* virtual-wine venv_wine +PyQt4-* diff --git a/build-tools/envsetup.sh b/build-tools/envsetup.sh index d12f2278..ca432d7c 100755 --- a/build-tools/envsetup.sh +++ b/build-tools/envsetup.sh @@ -1,9 +1,14 @@ #!/bin/sh +THIS_SCRIPT_PATH=`readlink -f $0` +THIS_SCRIPT_DIR=`dirname ${THIS_SCRIPT_PATH}` #OS Ubuntu 14.04 ### Common packages for linux/windows if [ ! -e "pyinstaller" ]; then git clone https://github.com/pyinstaller/pyinstaller + cd pyinstaller + git checkout v2.1 -b v2.1 + cd ${THIS_SCRIPT_DIR} fi echo "Going to clone and download packages for building windows" @@ -38,5 +43,10 @@ if [ ! -e "pywin32-218.win32-py2.7.exe" ]; then wget "http://nchc.dl.sourceforge.net/project/pywin32/pywin32/Build%20218/pywin32-218.win32-py2.7.exe" fi +if [ ! -e "PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe" ]; then + wget "http://nchc.dl.sourceforge.net/project/pyqt/PyQt4/PyQt-4.11.4/PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe" +fi + wine msiexec -i python-2.7.8.msi wine pywin32-218.win32-py2.7.exe +wine PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe diff --git a/libs/labelFile.py b/libs/labelFile.py index 3bc5af10..2b3b57fc 100644 --- a/libs/labelFile.py +++ b/libs/labelFile.py @@ -4,8 +4,6 @@ from PyQt4.QtGui import QImage from base64 import b64encode, b64decode from pascal_voc_io import PascalVocWriter -import json -import numpy import os.path import sys @@ -23,38 +21,6 @@ class LabelFile(object): if filename is not None: self.load(filename) - def load(self, filename): - try: - with open(filename, 'rb') as f: - data = json.load(f) - imagePath = data['imagePath'] - imageData = b64decode(data['imageData']) - lineColor = data['lineColor'] - fillColor = data['fillColor'] - shapes = ((s['label'], s['points'], s['line_color'], s['fill_color'])\ - for s in data['shapes']) - # Only replace data after everything is loaded. - self.shapes = shapes - self.imagePath = imagePath - self.imageData = imageData - self.lineColor = lineColor - self.fillColor = fillColor - except Exception, e: - raise LabelFileError(e) - - def save(self, filename, shapes, imagePath, imageData, - lineColor=None, fillColor=None): - try: - with open(filename, 'wb') as f: - json.dump(dict( - shapes=shapes, - lineColor=lineColor, fillColor=fillColor, - imagePath=imagePath, - imageData=b64encode(imageData)), - f, ensure_ascii=True, indent=2) - except Exception, e: - raise LabelFileError(e) - def savePascalVocFormat(self, filename, shapes, imagePath, imageData, lineColor=None, fillColor=None, databaseSrc=None): imgFolderPath = os.path.dirname(imagePath)