totalResultsFile.write("\npre nms:" + str(cfg.TEST.RPN_PRE_NMS_TOP_N))
    totalResultsFile.write("\npost nms:" + str(cfg.TEST.RPN_POST_NMS_TOP_N))
    totalResultsFile.write("\ntest lists:" + readlists)
    for model_idx in xrange(iterStart, iterEnd, iterStep):
        caffemodel = modelprefix + str(model_idx) + "0000.caffemodel"
        writeFile = open(
            toTxtDir + "/ret_" + caffemodel.split('.')[0] + ".txt", "w")
        net = caffe.Net(prototxt, modelPath + caffemodel, caffe.TEST)
        numFrame = 0
        n_pos_gt = 0
        n_pos_re = 0
        n_pos_tp = 0
        for filename in filelists:
            picName = filename.strip().split(' ')[0].split('.')[0] + '.jpg'
            nhand_gt, handcls_gt, box_gt = get_gt_from_xml(
                from_xml_path + filename.strip().split(' ')[0].split('.')[0] +
                '.xml')

            n_pos_gt += nhand_gt
            frame = cv2.imread(from_img_path + picName)
            numFrame += 1
            handcls, handbox, handscore = demo(net, frame)
            nhand = handbox.shape[0]
            n_pos_re += nhand
            nTP = 0
            if nhand > 0:
                writeFile.write(picName + ' ' + str(nhand))
                for i in xrange(0, nhand):
                    writeFile.write(' hand %d %d %d %d' %
                                    (handbox[i][0], handbox[i][1],
                                     handbox[i][2], handbox[i][3]))
if __name__ == '__main__':
    speical_config()
    filelists = readFile.readlines()
    writeFile = open(to_xml_path+"../neg_"+ caffemodel.split('.')[-2].split('/')[-1]+".txt", "w")
    net = caffe.Net(prototxt, model_path+caffemodel, caffe.TEST)
    # print '\n\nLoaded network: {:s}'.format(caffemodel)
    numFrame = 0
    n_hand_gt = 0
    n_false_null = 0
    n_false_neg = 0
    handcls_gt = np.array([], dtype = int)
    box_gt = np.array([], dtype = int)
    for line in filelists:
        fileame = line.strip().split(' ')[0].split('.')[0]
        xml_path = from_xml_path + fileame+ '.xml'
        n_hand_gt, handcls_gt, box_gt = get_gt_from_xml( from_xml_path + fileame+ '.xml' )
        frame = cv2.imread(from_img_path+fileame+'.jpg')
        copyframe = frame.copy()
        numFrame+=1
        handcls, handbox, handscore = demo(net, frame, CONF_THRESH, NMS_THRESH)
        nhand = handbox.shape[0]
        nTP = 0
        if nhand > 0:
            for i in xrange(0, nhand):
                writeFile.write(' hand %d %d %d %d'%(handbox[i][0],handbox[i][1],handbox[i][2],handbox[i][3]))
                if (IOU_multi(handbox[i], box_gt) > iouN):
                    n_false_neg += 1
                else:
                    for gt_idx in xrange(box_gt.shape[0]):
                        print box_gt[gt_idx]
                        cv2.rectangle(frame, (box_gt[gt_idx][0], box_gt[gt_idx][1]), (box_gt[gt_idx][2], box_gt[gt_idx][3]), (255, 0, 0), 4)