def verifyProxies(self, proxies): ''' Take as input dictionary of {name:proxystring} and verify that we can communicate with the server (by getting the detector or trainer). Return a dictionary with 'detector running' or 'trainer running' if running and 'configured' if not. Also print now so with long config files user sees output. ''' res = {} for key, value in proxies.iteritems(): # add short timeout value = value + ' -t 100' try: detector = easy.getDetector(value) res[key] = 'detector running' print("{0} {1}".format(key, res[key])) continue except: pass try: trainer = easy.getTrainer(value) res[key] = 'trainer running' print("{0} {1}".format(key, res[key])) continue except: pass try: trainer = easy.getFileServer(value) res[key] = 'FileServer running' print("{0} {1}".format(key, res[key])) continue except: pass try: trainer = easy.getCorpusServer(value) res[key] = 'Corpus running' print("{0} {1}".format(key, res[key])) continue except: pass res[key] = 'not running' print("{0} {1}".format(key, res[key])) return res
# Example 1: Test on a remote machine. # specify the host name of the service # host = "-h vision.nps.edu" # # create a simple RunSet with just one unlabeled image # rs1 = easy.createRunSet( "testImg/italia.jpg" ) # # Make sure all files in the RunSet are available on the remote site; # it is the client's responsibility to upload them if not. # The putResult contains information about which files were actually transferred. # fileserver = easy.getFileServer( "FileService:default -p 10110 " + host ) putResult = easy.putAllFiles( fileserver, rs1 ) modelfile = "detectors/haarcascade_frontalface_alt.xml" if not fileserver.exists( easy.getCvacPath(modelfile) ): easy.putFile( fileserver, easy.getCvacPath(modelfile) ) # # detect remotely: note the host specification # print("------- Remote detection, local result display: -------") detector = easy.getDetector( "OpenCVCascadeDetector:default -p 10102 "+host ) results = easy.detect( detector, modelfile, rs1 ) easy.printResults( results ) # # Example 2:
# specify the host name of the service # host = "-h vision.nps.edu" # # create a simple RunSet with just one unlabeled image # rs1 = easy.createRunSet("testImg/italia.jpg") # # Make sure all files in the RunSet are available on the remote site; # it is the client's responsibility to upload them if not. # The putResult contains information about which files were actually transferred. # print("------- Remote detection, local result display: -------") fileserver = easy.getFileServer("PythonFileService:default -p 10111 " + host) putResult = easy.putAllFiles(fileserver, rs1) modelfile = "detectors/haarcascade_frontalface_alt.xml" if not fileserver.exists(easy.getCvacPath(modelfile)): easy.putFile(fileserver, easy.getCvacPath(modelfile)) # # detect remotely: note the host specification # detector = easy.getDetector("OpenCVCascadeDetector:default -p 10102 " + host) results = easy.detect(detector, modelfile, rs1) easy.printResults(results) # # Example 2: # Train on a remote machine, obtain the model file, and test locally.
# specify the host name of the service # host = "-h vision.nps.edu" # # create a simple RunSet with just one unlabeled image # rs1 = easy.createRunSet( "testImg/italia.jpg" ) # # Make sure all files in the RunSet are available on the remote site; # it is the client's responsibility to upload them if not. # The putResult contains information about which files were actually transferred. # print("------- Remote detection, local result display: -------") fileserver = easy.getFileServer( "PythonFileService:default -p 10111 " + host ) putResult = easy.putAllFiles( fileserver, rs1 ) modelfile = "detectors/haarcascade_frontalface_alt.xml" if not fileserver.exists( easy.getCvacPath(modelfile) ): easy.putFile( fileserver, easy.getCvacPath(modelfile) ) # # detect remotely: note the host specification # detector = easy.getDetector( "OpenCVCascadeDetector:default -p 10102 "+host ) results = easy.detect( detector, modelfile, rs1 ) easy.printResults( results ) # # Example 2: # Train on a remote machine, obtain the model file, and test locally.