def _getDefaultCaffeVersion(self):
     msg = self.asyncRead()
     if caffeVersions.getDefaultVersion():
         msg["defaultVersionName"] = caffeVersions.getDefaultVersion(
         ).getName()
         msg["status"] = True
     else:
         msg["status"] = False
     self.send(msg)
 def _onRemoveVersion(self, name, host):
     """Removes the selected caffe version"""
     if host == None:
         if caffeVersions.getAvailableVersions() > 1:
             caffeVersions.removeVersion(
                 caffeVersions.getVersionByName(name))
             if (self.project.getCaffeVersion() == name):
                 self.project.changeProjectCaffeVersion(
                     caffeVersions.getDefaultVersion().getName())
         else:
             QMessageBox.warning(
                 self, self.tr("Warning"),
                 self.
                 tr("Cannot delete version. At least one caffe-version must be available at all times in barista."
                    ))
     else:
         msg = {"key": Protocol.REMOVECAFFEVERSION, "versionname": name}
         sendMsgToHost(host.host, host.port, msg)
     self.updateList()
 def checkHardware(self, verbose=True, transaction=None):
     caffe_versions.loadVersions(self.sessionPath)
     if caffe_versions.versionCount() == 0:
         if verbose:
             sys.stderr.write(
                 "Warning: Can't check hardware without Caffeversions\n")
             logging.warning("Can't check hardware without Caffeversions")
         if transaction:
             msg = {
                 "key": Protocol.SCANHARDWARE,
                 "status": False,
                 "error": "Can't check hardware without Caffeversions"
             }
             transaction.send(msg)
         return
     try:
         binary = caffe_versions.getDefaultVersion().getBinarypath()
         self.hardware = checkHardware(binary, not verbose, transaction)
         if verbose:
             sys.stdout.write("Finished scanning Hardware. " +
                              str(len(self.hardware)) + " devices found.\n")
             logging.info("Finished scanning Hardware. %s devices found.",
                          str(len(self.hardware)))
         if transaction:
             msg = {
                 "key": Protocol.SCANHARDWARE,
                 "status": True,
                 "finished": True,
                 "hardware": self.hardware,
                 "current": self.trainOnHW
             }
             transaction.send(msg)
     except:
         if verbose:
             sys.stderr.write("Error: Failed to check hardware!\n")
             logging.error("Failed to check hardware!")
         if transaction:
             msg = {
                 "key": Protocol.SCANHARDWARE,
                 "status": False,
                 "error": "Failed to check hardware!"
             }
             transaction.send(msg)
Exemple #4
0
    def __init__(self, directory):
        super(Project, self).__init__()
        # Make sure needed directoies exists
        self.caffeVersion = caffeVersions.getDefaultVersion().getName()
        self.projectRootDir = directory
        self.projectId = None
        self.current_sid = None
        self.callerId = None
        self.__activeSID = None
        self.__sessions = {}
        self.__inputManagerState = dict()
        self.__transform = None

        self.sessions = os.path.join(self.projectRootDir, 'sessions')
        # self.logs = os.path.join(self.projectRootDir, 'logs')
        self.__ensureDirectory(self.sessions)
        # self.__ensureDirectory(self.logs)
        self.settings = self.__loadDefaultSettings()
        self.loadProject(True)
 def __init__(self):
     self.path = caffeVersions.getDefaultVersion().getPythonpath()