def loadFile(self, fileName=None, startDir=None): """load a new prototxt file""" if fileName is None: if startDir is None: startDir = self.filePath if startDir is None: startDir = '.' self.fileDialog = FileDialog(None, "Load Flowchart..", startDir, "Protobuf (*.prototxt)") self.fileDialog.show() self.fileDialog.fileSelected.connect(self.loadFile) return fileName = unicode(fileName) self.clear() self.proto = parsePrototxt(fileName, 'net') self.layerList = self.proto.layer self.setupNodes() self.sigFileLoaded.emit(fileName)
def __init__(self, prototxt=None, weights=None): """ A flowchart that enables visualizing, editing, and running a caffe neural network model :param prototxt: string Optional path to a caffe prototxt file, which will be used as the initial model for the network :param weights: string Optional path to a caffe caffemodel file, which will be used as the initial weights for the network """ self.nodeList = [] self.displayNodes = {} self.netNeedsUpdate = True self.netNeedsEval = True self.holdUpdateConnects = True self.nextData = None Flowchart.__init__(self, terminals={ 'dataIn': {'io': 'in'}, 'dataOut': {'io': 'out'} }) if prototxt is None: self.proto = NetProto() self.layerList = self.proto.layer self.plotList = {} else: self.proto = parsePrototxt(prototxt, 'net') self.layerList = self.proto.layer # for old proto format if len(self.layerList) == 0: self.layerList = self.proto.layers self.weights = weights for proto in self.layerList: print proto self.setupNodes() fcw = self.widget().chartWidget fcw.viewDock.sizePolicy().setHorizontalPolicy(QtGui.QSizePolicy.Maximum) fcw.moveDock(fcw.hoverDock, 'bottom', fcw.viewDock) fcw.moveDock(fcw.selDock, 'right', fcw.hoverDock)
def setProto(self, proto): self.proto = parsePrototxt(proto, 'solver') self.updateParamList(self.proto)