Ejemplo n.º 1
0
def main():
    '''
    Parse command line arguments and execute the code

    '''
    start = time.time()

    parser = argparse.ArgumentParser()
    parser.add_argument('--det_frames_folder', default='det_frames/', type=str)
    parser.add_argument('--det_result_folder',
                        default='det_results/',
                        type=str)
    parser.add_argument('--result_folder', default='summary_result/', type=str)
    parser.add_argument('--summary_file', default='results.txt', type=str)
    parser.add_argument('--output_name', default='output.mp4', type=str)
    parser.add_argument('--perc', default=100, type=int)
    #parser.add_argument('--path_video', dest='path_video', required=True, type=str)
    parser.add_argument('--path_video', dest='path_video', type=str)
    args = parser.parse_args()
    args.path_video = './DAVIS-2017-TrainVal.mp4'

    #with tf.device('/gpu:0'):
    frame_list, frames = Utils_Video.extract_frames(args.path_video, args.perc)
    det_frame_list, det_result_list = still_image_YOLO_DET(
        frame_list, frames, args.det_frames_folder, args.det_result_folder)
    Utils_Video.make_video_from_list(args.output_name, det_frame_list)
    print_YOLO_DET_result(det_result_list, args.result_folder,
                          args.summary_file)

    end = time.time()

    print("Elapsed Time:%d Seconds" % (end - start))
    print("Running Completed with Success!!!")
def main():
    '''
    Parse command line arguments and execute the code

    '''
    start = time.time()

    parser = argparse.ArgumentParser()
    parser.add_argument('--det_frames_folder', default='det_frames/', type=str)
    parser.add_argument('--det_result_folder', default='det_results/', type=str)
    parser.add_argument('--result_folder', default='summary_result/', type=str)
    parser.add_argument('--summary_file', default='results.txt', type=str)
    parser.add_argument('--output_name', default='output.mp4', type=str)
    parser.add_argument('--perc', default=5, type=int)
    parser.add_argument('--path_video', required=True, type=str)
    args = parser.parse_args()

    frame_list, frames = Utils_Video.extract_frames(args.path_video, args.perc)
    det_frame_list,det_result_list=still_image_YOLO_DET(frame_list, frames, args.det_frames_folder,args.det_result_folder)
    Utils_Video.make_video_from_list(args.output_name, det_frame_list)
    print_YOLO_DET_result(det_result_list,args.result_folder, args.summary_file)

    end = time.time()

    print("Elapsed Time:%d Seconds"%(end-start))
    print("Running Completed with Success!!!")
def main():
    '''
    Parse command line arguments and execute the code 

    '''

    ######### TENSORBOX PARAMETERS

    start = time.time()

    parser = argparse.ArgumentParser()
    # parser.add_argument('--result_folder', default='summary_result/', type=str)
    # parser.add_argument('--summary_file', default='results.txt', type=str)
    parser.add_argument('--output_name', default='output.mp4', type=str)
    parser.add_argument('--hypes',
                        default='./TENSORBOX/hypes/overfeat_rezoom.json',
                        type=str)
    parser.add_argument('--weights',
                        default='./TENSORBOX/data/save.ckpt-1090000',
                        type=str)
    parser.add_argument('--perc', default=2, type=int)
    parser.add_argument('--path_video', required=True, type=str)

    args = parser.parse_args()

    # hypes_file = './hypes/overfeat_rezoom.json'
    # weights_file= './output/save.ckpt-1090000'

    path_video_folder = os.path.splitext(os.path.basename(args.path_video))[0]
    pred_idl = './%s/%s_val.idl' % (path_video_folder, path_video_folder)
    idl_filename = path_video_folder + '/' + path_video_folder + '.idl'
    frame_list = []
    frame_list = Utils_Video.extract_idl_from_frames(args.path_video,
                                                     args.perc,
                                                     path_video_folder,
                                                     'frames/', idl_filename)

    progress = progressbar.ProgressBar(widgets=[
        progressbar.Bar('=', '[', ']'), ' ',
        progressbar.Percentage(), ' ',
        progressbar.ETA()
    ])

    for image_path in progress(frame_list):
        Utils_Image.resizeImage(image_path)
    Utils_Image.resizeImage(-1)

    det_frame_list = Utils_Tensorbox.still_image_TENSORBOX_singleclass(
        frame_list, path_video_folder, args.hypes, args.weights, pred_idl)
    Utils_Video.make_video_from_list(args.output_name, det_frame_list)
    end = time.time()

    print("Elapsed Time:%d Seconds" % (end - start))
    print("Running Completed with Success!!!")
def main():
    '''
    Parse command line arguments and execute the code 

    '''

    ######### TENSORBOX PARAMETERS


    start = time.time()

    parser = argparse.ArgumentParser()

    parser.add_argument('--det_frames_folder', default='det_frames/', type=str)
    parser.add_argument('--det_result_folder', default='det_results/', type=str)
    parser.add_argument('--frames_folder', default='frames/', type=str)
    # parser.add_argument('--result_folder', default='summary_result/', type=str)
    # parser.add_argument('--summary_file', default='results.txt', type=str)
    parser.add_argument('--output_name', default='output.mp4', type=str)
    parser.add_argument('--hypes', default='./TENSORBOX/hypes/overfeat_rezoom.json', type=str)
    parser.add_argument('--weights', default='./TENSORBOX/output/save.ckpt-1090000', type=str)
    parser.add_argument('--perc', default=2, type=int)
    parser.add_argument('--path_video', required=True, type=str)

    args = parser.parse_args()

    # hypes_file = './hypes/overfeat_rezoom.json'
    # weights_file= './output/save.ckpt-1090000'

    path_video_folder = os.path.splitext(os.path.basename(args.path_video))[0]
    pred_idl = './%s/%s_val.idl' % (path_video_folder, path_video_folder)
    idl_filename=path_video_folder+'/'+path_video_folder+'.idl'
    frame_list=[]
    frame_list = Utils_Video.extract_idl_from_frames(args.path_video, args.perc, path_video_folder, args.frames_folder, idl_filename )

    progress = progressbar.ProgressBar(widgets=[progressbar.Bar('=', '[', ']'), ' ',progressbar.Percentage(), ' ',progressbar.ETA()])

    for image_path in progress(frame_list):
        Utils_Image.resizeImage(image_path)

    det_frame_list=still_image_TENSORBOX(idl_filename, frame_list, args.det_frames_folder, args.det_result_folder, args.frames_folder, path_video_folder, args.hypes, args.weights, pred_idl)
    Utils_Video.make_video_from_list(args.output_name, det_frame_list)

    end = time.time()

    print("Elapsed Time:%d Seconds"%(end-start))
    print("Running Completed with Success!!!")
Ejemplo n.º 5
0
def main():
    '''
    Parse command line arguments and execute the code 

    '''

    ######### TENSORBOX PARAMETERS

    start = time.time()

    parser = argparse.ArgumentParser()
    # parser.add_argument('--result_folder', default='summary_result/', type=str)
    # parser.add_argument('--summary_file', default='results.txt', type=str)
    parser.add_argument('--output_name', default='output.mp4', type=str)
    parser.add_argument('--hypes',
                        default='./TENSORBOX/hypes/overfeat_rezoom.json',
                        type=str)
    parser.add_argument('--weights',
                        default='./TENSORBOX/data/save.ckpt-1250000',
                        type=str)
    parser.add_argument('--perc', default=100, type=int)
    parser.add_argument('--path_video',
                        default='DAVIS-2017-TrainVal.mp4',
                        type=str)  # required=True, type=str)

    args = parser.parse_args()

    # hypes_file = './hypes/overfeat_rezoom.json'
    # weights_file= './output/save.ckpt-1090000'

    path_video_folder = os.path.splitext(os.path.basename(args.path_video))[0]
    pred_idl = './%s/%s_val.idl' % (path_video_folder, path_video_folder)
    idl_filename = path_video_folder + '/' + path_video_folder + '.idl'
    frame_tensorbox = []
    frame_inception = []
    frame_tensorbox, frame_inception = Utils_Video.extract_frames_incten(
        args.path_video, args.perc, path_video_folder, idl_filename)

    progress = progressbar.ProgressBar(widgets=[
        progressbar.Bar('=', '[', ']'), ' ',
        progressbar.Percentage(), ' ',
        progressbar.ETA()
    ])

    for image_path in progress(frame_tensorbox):
        Utils_Image.resizeImage(image_path)
    Utils_Image.resizeImage(-1)

    video_info = Utils_Tensorbox.bbox_det_TENSORBOX_multiclass(
        frame_tensorbox, path_video_folder, args.hypes, args.weights, pred_idl)
    tracked_video = Utils_Video.recurrent_track_objects(video_info)
    # tracked_video=utils_video.track_objects(video_info)
    # labeled_video=Utils_Imagenet.label_video(tracked_video, frame_inception)
    labeled_video = Utils_Imagenet.recurrent_label_video(
        tracked_video, frame_inception)
    # tracked_video=utils_video.track_objects(video_info)

    # tracked_video=utils_video.track_and_label_objects(video_info)
    labeled_frames = Utils_Video.draw_rectangles(path_video_folder,
                                                 labeled_video)
    Utils_Video.make_tracked_video(args.output_name, labeled_frames)
    frame.saveVideoResults(idl_filename, labeled_video)

    # utils_video.make_tracked_video(args.output_name, labeled_video)
    end = time.time()

    print("Elapsed Time:%d Seconds" % (end - start))
    print("Running Completed with Success!!!")