资源简介
使用Python写的一个用于标注数据集的软件,该软件可以将数据集标注成为VOC2007格式,适合计算机视觉应用。
代码片段和文件信息
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
import os.path
import re
import sys
import subprocess
from functools import partial
from collections import defaultdict
try:
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
except ImportError:
# needed for py3+qt4
# Ref:
# http://pyqt.sourceforge.net/Docs/PyQt4/incompatible_apis.html
# http://stackoverflow.com/questions/21217399/pyqt4-qtcore-qvariant-object-instead-of-a-string
if sys.version_info.major >= 3:
import sip
sip.setapi(‘QVariant‘ 2)
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import resources
# Add internal libs
from libs.constants import *
from libs.lib import struct newAction newIcon addActions fmtShortcut generateColorByText
from libs.settings import Settings
from libs.shape import Shape DEFAULT_LINE_COLOR DEFAULT_FILL_COLOR
from libs.canvas import Canvas
from libs.zoomWidget import ZoomWidget
from libs.labelDialog import LabelDialog
from libs.colorDialog import ColorDialog
from libs.labelFile import LabelFile LabelFileError
from libs.toolBar import ToolBar
from libs.pascal_voc_io import PascalVocReader
from libs.pascal_voc_io import xml_EXT
from libs.yolo_io import YoloReader
from libs.yolo_io import TXT_EXT
from libs.ustr import ustr
from libs.version import __version__
__appname__ = ‘labelImg‘
# Utility functions and classes.
def have_qstring():
‘‘‘p3/qt5 get rid of QString wrapper as py3 has native unicode str type‘‘‘
return not (sys.version_info.major >= 3 or QT_VERSION_STR.startswith(‘5.‘))
def util_qt_strlistclass():
return QStringList if have_qstring() else list
class WindowMixin(object):
def menu(self title actions=None):
menu = self.menuBar().addMenu(title)
if actions:
addActions(menu actions)
return menu
def toolbar(self title actions=None):
toolbar = ToolBar(title)
toolbar.setobjectName(u‘%sToolBar‘ % title)
# toolbar.setOrientation(Qt.Vertical)
toolbar.setToolButtonstyle(Qt.ToolButtonTextUnderIcon)
if actions:
addActions(toolbar actions)
self.addToolBar(Qt.LeftToolBarArea toolbar)
return toolbar
# PyQt5: TypeError: unhashable type: ‘QListWidgetItem‘
class HashableQListWidgetItem(QListWidgetItem):
def __init__(self *args):
super(HashableQListWidgetItem self).__init__(*args)
def __hash__(self):
return hash(id(self))
class MainWindow(QMainWindow WindowMixin):
FIT_WINDOW FIT_WIDTH MANUAL_ZOOM = list(range(3))
def __init__(self defaultFilename=None defaultPrefdefClassFile=None):
super(MainWindow self).__init__()
self.setWindowtitle(__appname__)
# Load setting in the main thread
self.settings = Settings()
self.settings.load()
settings = self.settings
# Save as Pascal voc xml
self.defaultSaveDir = None
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 142 2018-03-24 23:56 labelImg-master\.gitignore
文件 455 2018-03-26 22:01 labelImg-master\.idea\labelImg-master.iml
文件 185 2018-03-26 22:01 labelImg-master\.idea\misc.xm
文件 282 2018-03-26 22:01 labelImg-master\.idea\modules.xm
文件 12354 2018-03-26 22:08 labelImg-master\.idea\workspace.xm
文件 2491 2018-03-24 23:56 labelImg-master\.travis.yml
文件 108 2018-03-24 23:56 labelImg-master\build-tools\.gitignore
文件 680 2018-03-24 23:56 labelImg-master\build-tools\build-for-pypi.sh
文件 656 2018-03-24 23:56 labelImg-master\build-tools\build-ubuntu-binary.sh
文件 882 2018-03-24 23:56 labelImg-master\build-tools\build-windows-binary.sh
文件 1566 2018-03-24 23:56 labelImg-master\build-tools\envsetup.sh
文件 378 2018-03-24 23:56 labelImg-master\build-tools\README.md
文件 383 2018-03-24 23:56 labelImg-master\build-tools\run-in-container.sh
文件 83 2018-03-24 23:56 labelImg-master\CONTRIBUTING.rst
文件 145 2018-03-24 23:56 labelImg-master\data\predefined_classes.txt
文件 58243 2018-03-24 23:56 labelImg-master\demo\demo.jpg
文件 91238 2018-03-24 23:56 labelImg-master\demo\demo3.jpg
文件 2843527 2018-03-24 23:56 labelImg-master\demo\demo4.png
文件 3240759 2018-03-24 23:56 labelImg-master\demo\demo5.png
文件 1022 2018-03-24 23:56 labelImg-master\HISTORY.rst
文件 170413 2018-03-24 23:56 labelImg-master\icons\app.icns
文件 30534 2018-03-24 23:56 labelImg-master\icons\app.png
文件 2282 2018-03-24 23:56 labelImg-master\icons\app.svg
文件 2136 2018-03-24 23:56 labelImg-master\icons\cancel.png
文件 3111 2018-03-24 23:56 labelImg-master\icons\close.png
文件 1461 2018-03-24 23:56 labelImg-master\icons\color.png
文件 2368 2018-03-24 23:56 labelImg-master\icons\color_line.png
文件 646 2018-03-24 23:56 labelImg-master\icons\copy.png
文件 1486 2018-03-24 23:56 labelImg-master\icons\delete.png
文件 2198 2018-03-24 23:56 labelImg-master\icons\done.png
............此处省略131个文件信息
评论
共有 条评论