Exemplo n.º 1
0
 def __init__(self,Pathx, B):
     path = "/media/iglu/Data/DatasetIglu"
     i = 0
     Analysis.initial()
     files = open("Output_1_L.txt", 'w')
     start_time = timeit.default_timer()
     for x in os.listdir(path):
         # if i == 0:
         #     i += 1
         #     continue
         # else:
         if Pathx != x:
             continue
         for y in os.listdir(path + "/" + x) :
             if (y != "Objects.txt") and not y.endswith(".zip"):
                 # print path+"/"+x+"/"+y+"/k1"
                 f = open(path + "/" + x + "/" + y + "/k1" + "/List.txt", 'r')
                 f2 = open(path + "/" + x + "/" + y + "/speech.txt", 'r')
                 speak = f2.readline()
                 if speak == 'This...':
                     sp = 1
                 elif speak == 'That...':
                     sp = 2
                 else:
                     sp = 0
                 mn = 0
                 for line in f:
                     Time = line
                     file1 = next(f).rstrip('\n')
                     file2 = next(f).rstrip('\n')
                     Label = next(f).rstrip('\n')
                     # files.write(RGB.__str__())
                     # files.write(Depth.__str__())
                     # files.write(Label+" "+x+" "+file1+"\n")
                     if mn == 0:
                         RGB = cv2.imread(path + "/" + x + "/" + y + "/k1" + "/RGB/" + file1)
                         Depth = cv2.imread(path + "/" + x + "/" + y + "/k1" + "/Depth/" + file2)
                         Analysis.addDepth(Depth)
                         Analysis.addRGB(RGB)
                         Analysis.addSpeech(sp)
                         Analysis.addScene(Label)
                     else:
                         if mn == 2:
                             mn = -1
                     mn += 1
             # print "Enviado " + x + " " + y
         i += 1
     elapsed = timeit.default_timer() - start_time
     print "Tiempo: " + elapsed.__str__()
     print "Starting Training"
     start_time = timeit.default_timer()
     Analysis.CompleteAnalysis(B, False, True, 0.3, files)
     files.close()
     # Analysis.Mostrar()
     # code you want to evaluate
     elapsed = timeit.default_timer() - start_time
     print "Tiempo: " + elapsed.__str__()
Exemplo n.º 2
0
    def __init__(self,B):
        path = "/media/iglu/Data/Dataset/DatasetIglu/Dataset_cleaned_v4"
        i = 0
        Analysis.initial()
        files = open("Output_1_L.txt", 'w')
        start_time = timeit.default_timer()
        for x in os.listdir(path):
            # if i == 0:
            #     i += 1
            #     continue
            # else:

            f = open(path+"/"+x+"/List.txt",'r')
            for line in f:
                Time = line
                file1 = next(f).rstrip('\n')
                file2 = next(f).rstrip('\n')
                Label = next(f).rstrip('\n')
                RGB = cv2.imread(path+"/"+x+"/RGB/"+file1)
                Depth = cv2.imread(path+"/"+x+"/Depth/"+file2)
                # files.write(RGB.__str__())
                # files.write(Depth.__str__())
                # files.write(Label+" "+x+" "+file1+"\n")
                Analysis.addDepth(Depth)
                Analysis.addRGB(RGB)
                Analysis.addScene(Label)
                i += 1
            print "Enviado "+x
            # if i > 150:
            #     break
        elapsed = timeit.default_timer() - start_time
        print "Tiempo: "+elapsed.__str__()
        print "Starting Training"
        start_time = timeit.default_timer()
        Analysis.CompleteAnalysis(B,True,0.3,files)
        files.close()
        #Analysis.Mostrar()
        # code you want to evaluate
        elapsed = timeit.default_timer() - start_time
        print "Tiempo: "+elapsed.__str__()