예제 #1
0
def writeOF():
    root = "../videos"
    path = os.path.join(root, "train")
    startTime = datetime.now()
    w = 224
    h = 224
    c = 0
    data = {}

    for path, subdirs, files in os.walk(root):
        for filename in files:
            c += 1
            count = ofp.writeOpticalFlow(path, filename, w, h, c)
            data[filename] = count

    root = "../videos"
    path = os.path.join(root, "test")
    w = 224
    h = 224

    for path, subdirs, files in os.walk(root):
        for filename in files:
            c += 1
            count = ofp.writeOpticalFlow(path, filename, w, h, c)
            data[filename] = count

    with open('../dataset/frame_count.pickle', 'wb') as f:
        pickle.dump(data, f)
    print 'Time taken for ' + str(c) + 'testing videos: ' + str(
        datetime.now() - startTime)
def writeOF():
	root = "../videos"
	path = os.path.join(root, "train")
	startTime = datetime.now()
	w=224
	h=224
	c=0
	data={}

	for path, subdirs, files in os.walk(root):
		for filename in files:
			c+=1
			count=ofp.writeOpticalFlow(path,filename,w,h,c)
			data[filename]=count

	root = "../videos"
	path = os.path.join(root, "test")
	w=224
	h=224

	for path, subdirs, files in os.walk(root):
		for filename in files:
			c+=1
			count=ofp.writeOpticalFlow(path,filename,w,h,c)
			data[filename]=count

	with open('../dataset/frame_count.pickle','wb') as f:
		pickle.dump(data,f)
	print 'Time taken for '+str(c)+'testing videos: '+str(datetime.now() - startTime)
def writeOF():

    root = "../videos"
    w = 224
    h = 224
    c = 0
    data = {}

    for path, subdsirs, files in scandir.walk(root):
        for filename in files:
            count = ofp.writeOpticalFlow(path, filename, w, h, c)
            if count:
                data[filename] = count
            print filename
            c += 1
            with open("done.txt", "a") as myfile:
                myfile.write(filename + '-' + str(c) + '\n')

    with open('../dataset/frame_count.pickle', 'wb') as f:
        pickle.dump(data, f)
def writeOF():

    root = "../videos"
    w=224
    h=224
    c=0
    data={}

    for path, subdsirs, files in scandir.walk(root):
        for filename in files:
            count=ofp.writeOpticalFlow(path,filename,w,h,c)
            if count:
                data[filename]=count
            print filename
            c+=1
            with open("done.txt", "a") as myfile:
                myfile.write(filename+'-'+str(c)+'\n')

    with open('../dataset/frame_count.pickle','wb') as f:
        pickle.dump(data,f)
예제 #5
0
파일: main.py 프로젝트: zhcf/AICourse
def writeOF():

    root = "F:\Dataset/UCF-101"
    w = 224
    h = 224
    c = 0
    data = {}

    for path, subdsirs, files in scandir.walk(root):
        for filename in files:
            count = ofp.writeOpticalFlow(path, filename, w, h, c)
            if count:
                data[filename] = count
            print(filename)
            c += 1
            with open("done.txt", "a") as myfile:
                myfile.write(filename + '-' + str(c) + '\n')

    with open(
            'D:\MyDrivers\software/anaconda\wokspace\Video-Classification-2-Stream-CNN-master\dataset/frame_count.pickle',
            'wb') as f:
        pickle.dump(data, f)
예제 #6
0
def writeOF():
    '''create OpticalFlow images
  '''

    root = '../dataset/train'
    w = 224
    h = 224
    c = 0
    data = {}

    for path, dirs, files in os.walk(root):
        for filename in files:
            filename = filename[:-4] + '.h264'
            print(filename)
            count = ofp.writeOpticalFlow(path, filename, w, h, c)
            if count:
                data[filename] = count
            c += 1
            with open("done.txt", "a") as myfile:
                myfile.write(filename + '_' + str(c) + '\n')

    with open('../dataset/frame_count.pickle', 'wb') as f:
        pickle.dump(data, f)
def writeOF():

    ##root = "../videos"
    root = '/media/yanrui/文档/迅雷下载/Two-Stream/hmdb51_org/video/'
    w = 224
    h = 224
    c = 0
    data = {}

    for path, subdsirs, files in scandir.walk(root):
        for filename in files:

            count = ofp.writeOpticalFlow(path, filename, w, h, c)
            filename = filename.split('.')[0]
            if count:
                data[filename] = count
            print filename
            c += 1
            with open("done.txt", "a") as myfile:
                myfile.write(filename + '-' + str(c) + '\n')

    with open('../dataset/frame_count.pickle', 'wb') as f:
        pickle.dump(data, f)
def main():
    if len(sys.argv) > 1 and sys.argv[1] == '--test':
        pickleFile = "../dataset/temporal_test_data.pickle"
        fileList = "../dataset/ucfTrainTestlist/testlist01.txt"
        print "Saving data at: ", pickleFile
    else:
        pickleFile = "../dataset/temporal_train_data.pickle"
        fileList = "../dataset/ucfTrainTestlist/trainlist01.txt"
        print "Saving data at: ", pickleFile
    training_data = {}
    types = CreateDict("../dataset/ucfTrainTestlist/classInd.txt")
    rootDir = '../dataset/ucf101/'
    f = open(fileList, 'r')
    for line in f:
        filePath = line.split()[0]
        folder, file = filePath.split('/')
        count = writeOpticalFlow(rootDir + folder, file, 150, 150, 1)
        print count
        blockno = int(count / 50)
        key = file + '@' + str(blockno)
        training_data[key] = types[folder]
    print training_data
    with open(pickleFile, 'wb') as f:
        pickle.dump(training_data, f)