from pyspark import SparkContext

if __name__ == "__main__":
    #    if len(sys.argv) != 5:
    #        print >> sys.stderr, "Usage: cnnspark <modelpath> <imgpath> <divsize> <partitions>"
    #        exit(-1)

    sc = SparkContext(appName="cnnspark",
                      pyFiles=['cnnpredict.py', 'cnnparsemodel.py'])

    #    model = cnnparsemodel.load_matcnn(sys.argv[1])
    #    img0 = misc.imread(sys.argv[2])
    #    divsize = int(sys.argv[3])
    #    partitions = int(sys.argv[4])

    model = cnnparsemodel.load_matcnn('muscle-caffe-20.mat')
    img0 = misc.imread('test.jpg')
    divsize = 200
    partitions = [8, 16]

    # pad image
    padsz = cnnpredict.pad_size(model)
    img = cnnpredict.pad_img(img0, padsz)
    H, W, Channels = img.shape
    hDivs, wDivs = int(np.floor(H / divsize)), int(np.floor(W / divsize))
    divs = []
    for ih in range(hDivs):
        for iw in range(wDivs):
            divs.append((ih, iw))

    timeused = []
예제 #2
0


if __name__ == "__main__":
#    if len(sys.argv) != 5:
#        print >> sys.stderr, "Usage: cnnspark <modelpath> <imgpath> <divsize> <partitions>"
#        exit(-1)
    
    sc = SparkContext(appName = "cnnspark", pyFiles=['cnnpredict.py', 'cnnparsemodel.py'])
    
#    model = cnnparsemodel.load_matcnn(sys.argv[1])
#    img0 = misc.imread(sys.argv[2])
#    divsize = int(sys.argv[3])
#    partitions = int(sys.argv[4])
    
    model = cnnparsemodel.load_matcnn('muscle-caffe-20.mat')
    img0 = misc.imread('test.jpg')
    divsizes = [600, 500, 400, 300, 200, 100]
    #partitions = [1, 2, 4, 8, 16]
    
    # pad image
    padsz = cnnpredict.pad_size(model)
    img = cnnpredict.pad_img(img0, padsz)
    H, W, Channels = img.shape
    
   
    
    timeused = []
    numDivs = []
    for divsize in divsizes:
        hDivs, wDivs = int(np.floor(H/divsize)), int(np.floor(W/divsize))
예제 #3
0
import cnnparsemodel
import matplotlib.pyplot as plt
from datetime import datetime
from scipy import misc

from pyspark import SparkContext

if __name__ == "__main__":
    if len(sys.argv) != 5:
        print >> sys.stderr, "Usage: cnnspark <modelpath> <imgpath> <divsize> <partitions>"
        exit(-1)

    sc = SparkContext(appName="cnnspark",
                      pyFiles=['cnnpredict.py', 'cnnparsemodel.py'])

    model = cnnparsemodel.load_matcnn(sys.argv[1])
    img0 = misc.imread(sys.argv[2])
    divsize = int(sys.argv[3])
    partitions = int(sys.argv[4])

    #    model = cnnparsemodel.load_matcnn('muscle-caffe-20.mat')
    #    img0 = misc.imread('test.jpg')
    #    divsize = 200
    #    partitions = 20

    # pad image
    padsz = cnnpredict.pad_size(model)
    img = cnnpredict.pad_img(img0, padsz)
    H, W, Channels = img.shape
    hDivs, wDivs = int(np.floor(H / divsize)), int(np.floor(W / divsize))
    divs = []
예제 #4
0
import matplotlib.pyplot as plt
from datetime import datetime
from scipy import misc

from pyspark import SparkContext



if __name__ == "__main__":
    if len(sys.argv) != 5:
        print >> sys.stderr, "Usage: cnnspark <modelpath> <imgpath> <divsize> <partitions>"
        exit(-1)
    
    sc = SparkContext(appName = "cnnspark", pyFiles=['cnnpredict.py', 'cnnparsemodel.py'])
    
    model = cnnparsemodel.load_matcnn(sys.argv[1])
    img0 = misc.imread(sys.argv[2])
    divsize = int(sys.argv[3])
    partitions = int(sys.argv[4])
    
#    model = cnnparsemodel.load_matcnn('muscle-caffe-20.mat')
#    img0 = misc.imread('test.jpg')
#    divsize = 200
#    partitions = 20
    
    # pad image
    padsz = cnnpredict.pad_size(model)
    img = cnnpredict.pad_img(img0, padsz)
    H, W, Channels = img.shape
    hDivs, wDivs = int(np.floor(H/divsize)), int(np.floor(W/divsize))
    divs = []