conda install pyqt=5
pyrcc5 -o resources.py resources.qrc
出現錯誤
Traceback (most recent call last):
File "labelImg.py", line 1452, in <module>
sys.exit(main())
File "labelImg.py", line 1448, in main
app, _win = get_main_app(sys.argv)
File "labelImg.py", line 1441, in get_main_app
argv[3] if len(argv) >= 4 else None)
File "labelImg.py", line 109, in __init__
self.settings.load()
File "D:\TensorFlow\ObjectDetection\labelImg\libs\settings.py", line 33, in load
self.data = pickle.load(f, encoding="iso-8859-1")
ModuleNotFoundError: No module named 'PyQt4'
請刪除 c:\users\user name\.labelImgSettings.pkl
pascal_voc_io.py
def addBndBox(self, xmin, ymin, xmax, ymax, name, pose, difficult):
bndbox['pose'] = pose
self.boxlist.append(bndbox)
def appendObjects(self, top):
for each_object in self.boxlist:
pose.text = unicode(each_object['pose'])
def save(self, targetFile=None):
self.appendObjects(root)
labelFile.py
def savePascalVocFormat(self, filename, shapes, imagePath, imageData, lineColor=None, fillColor=None, databaseSrc=None):
for shape in shapes:
pose = shape['pose']
writer.addBndBox(bndbox[0], bndbox[1], bndbox[2], bndbox[3], label, pose, difficult)
canvas.py
labelImage.py
class MainWindow(QMainWindow, WindowMixin):
def __init__(self, defaultFilename=None, defaultPrefdefClassFile=None, defaultSaveDir=None):
self.labelList = QListWidget()
self.canvas = Canvas(parent=self)
def saveLabels(self, annotationFilePath):
shapes = [format_shape(shape) for shape in self.canvas.shapes]
self.labelFile.savePascalVocFormat(annotationFilePath, shapes, self.filePath, self.imageData, self.lineColor.getRgb(), self.fillColor.getRgb())
def addLabel(self, shape):
item = HashableQListWidgetItem(shape.label)
item.setPose(shape.pose)
self.labelList.addItem(item)
def currentItem(self):
items = self.labelList.selectedItems()
return items[0]
def editLabel(self):
item = self.currentItem()
text, pose = self.labelDialog.popUp(item.text(), item.getPose())
item.setPose(pose)
item.setLabel(label)
item.setText(label + "_" + pose)
def labelItemChanged(self, item):
shape = self.itemsToShapes[item]
shape.label = item.text()
class HashableQListWidgetItem(QListWidgetItem):
labelDialog.py
def popUp(self, text='', pose='', move=True):
沒有留言:
張貼留言