print "Loading models" #Load the models for j in range(len(name_models)): #For the moment don't put True is there are more that 2 models in Ubuntu gm = loadModel(name_models[j],th[j],False) list_models.append(gm) print "Calculating weigths" #Used to calculate the weights v0 = Classifier() for j in range(len(name_models)): print "\nFor model " + name_models[j] + ":" w_g, w_b = v0.calculateW(list_files[j],list_models[j]) list_models[j].addWeight("gravity",w_g) list_models[j].addWeight("body",w_b) print "\n Init classifers" l_class = [] for j in range(len(name_models)): l_class.append(Classifier()) print "Give the model to each classifier" for j in range(len(name_models)): l_class[j].classify(list_models[j])
#For ROS we must stay in the src folder files1 = ["A/mod(1).txt","A/mod(2).txt","A/mod(3).txt","A/mod(4).txt","A/mod(5).txt","A/mod(6).txt" ] #newModel("A",files1,th=3) gm1 = loadModel("A",25) files2 = ["P/mod(1).txt","P/mod(2).txt","P/mod(3).txt","P/mod(4).txt","P/mod(5).txt", "P/mod(6).txt"] #newModel("P",files2,th=3) gm2 = loadModel("P",22) print "1" v1 = Classifier() v2 = Classifier() w_g, w_b = v1.calculateW(files1,gm1) print w_g, w_b gm1.addWeight("gravity",w_g) gm1.addWeight("body",w_b) w_g, w_b = v1.calculateW(files2,gm2) print w_g, w_b gm2.addWeight("gravity",w_g) gm2.addWeight("body",w_b)