def eval_train(checkpoint_dir, checkpoint_list, image_set): '''Evaluate training on list of stored checkpoints''' results = dict() for cp in checkpoint_list: cp_path = checkpoint_dir + 'model.ckpt-' + str(cp) print('Evaluating: ' + cp_path) net = nn.init(cp_path) ap, recall = eval_set(net, image_set) results[cp] = (ap, recall) return results
return cp, np.mean(all_ap, axis=0), np.mean(all_rec, axis=0) #CHECKPOINT = '/home/tommaso/scenicEx/data/scenic/checkpoints/train/model.ckpt-5500' #CHECKPOINT = '/home/tommaso/scenicEx/data/matrix/checkpoints_overlap_250/train/model.ckpt-32670' #CHECKPOINT = '/home/tommaso/scenicEx/data/matrix/checkpoints/train/model.ckpt-5250' CHECKPOINT = '/home/tommaso/squeezeDet/data/webots/train/checkpoints/train/model.ckpt-1150' FILE = '/home/tommaso/squeezeDet/data/webots/test/images/1003.png' PREFIX = '/home/tommaso/scenicEx/data/matrix/' PREFIX_LABELS = PREFIX + 'labels/' PREFIX_IMAGES = PREFIX + 'images/' image_set = '/home/tommaso/scenicEx/data/matrix/ImageSets/test_overlap.txt' net = nn.init(CHECKPOINT) pred = nn.classify(FILE, net, NN_PROB_THRESH) print(pred) #ap, recall = eval_set(net, image_set) # avg_precs = [] # avg_recs = [] # max_precs = [] # max_recs = [] # # for i in range(1,9,1): # precs = [] # recs = [] # for j in range(4950,5020,10): # checkpoint_path = '/home/tommaso/scenicEx/data/matrix/checkpoints_overlap_250/checkpoints_overlap_250_' + str(i) + '/train/model.ckpt-' + str(j) # print(checkpoint_path)
'''Write predictions into files''' f = open(preds_directory + filename + '.txt', "w") for p in prediction: kitti = box_2_kitti_format(p[2:]) f.write("Car " + str(p[1]) + " " + " ".join([str(x) for x in kitti]) + '\n') f.close() print('saved to {}'.format(preds_directory + filename + '.txt')) IOU_THRESH = 0.5 IOU2_THRESH = 0.7 NN_PROB_THRESH = 0.5 PREFIX = './data/data/training/' PREFIX_LABELS = PREFIX + 'label/' # directory path to label PREFIX_IMAGES = PREFIX + 'image/' # directory path to image SAVE_DIRECTORY = 'model_10000_prediction_label/' checkpoint = './data/model_checkpoints/squeezeDet/model.ckpt-10000' # This .txt is generated by following instruction in squeezeDet repo README # go to ImageSet and execute command : # ls ../directory_path_to_image | grep ".png" | sed s/.png// > train.txt # this command parses out only the names of images into a .txt file test_set = './data/gta/ImageSets/testing2_3_correct_label.txt' net = nn.init(checkpoint) print("model initiated!!") c = evaluate_set(net, test_set) print(c)