示例#1
0
    )
    
    parser.add_argument(
        '--postfix', type=str, dest = 'postfix', default = '_catface',
        help='Specify the postfix for images with bounding boxes. Default is "_catface"'
    )
    

    FLAGS = parser.parse_args()

    save_img = not FLAGS.no_save_img

    file_types = FLAGS.file_types

    if file_types:
        input_paths = GetFileList(FLAGS.input_path, endings = file_types)
    else:
        input_paths = GetFileList(FLAGS.input_path)

    #Split images and videos
    img_endings = ('.jpg','.jpg','.png')
    vid_endings = ('.mp4','.mpeg','.mpg','.avi')

    input_image_paths = [] 
    input_video_paths =[]
    for item in input_paths:
        if item.endswith(img_endings):
            input_image_paths.append(item)
        elif item.endswith(vid_endings):
            input_video_paths.append(item)    
    #FLAGS.model_path = model_weights
    #FLAGS.anchors_path = anchors_path
    #FLAGS.classes_path = model_classes
    #FLAGS.score = 0.25
    #FLAGS.box = detection_results_file
    FLAGS.postfix = '_withBox'
    FLAGS.gpu_num = 1
    #FLAGS.no_save_img = False
    #FLAGS.output = detection_results_folder
    #FLAGS.input_images = image_test_folder

    result_file = FLAGS.result_file

    save_img = not FLAGS.no_save_img

    input_image_paths = GetFileList(FLAGS.input_images)

    #print('Found {} input images: {}...'.format(len(input_image_paths), [ os.path.basename(f) for f in input_image_paths[:5]]))

    output_path = FLAGS.output

    if not os.path.exists(output_path):
        os.makedirs(output_path)

    # define YOLO detector
    yolo = YOLO(
        **{
            "model_path": FLAGS.model_path,
            "anchors_path": FLAGS.anchors_path,
            "classes_path": FLAGS.classes_path,
            "score": FLAGS.score,