当前位置: 首页>>代码示例>>Python>>正文


Python model.preprocess_true_boxes方法代码示例

本文整理汇总了Python中yolo3.model.preprocess_true_boxes方法的典型用法代码示例。如果您正苦于以下问题:Python model.preprocess_true_boxes方法的具体用法?Python model.preprocess_true_boxes怎么用?Python model.preprocess_true_boxes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yolo3.model的用法示例。


在下文中一共展示了model.preprocess_true_boxes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: data_generator

# 需要导入模块: from yolo3 import model [as 别名]
# 或者: from yolo3.model import preprocess_true_boxes [as 别名]
def data_generator(annotation_lines, batch_size, input_shape, anchors, num_classes, random=True, verbose=False):
    '''data generator for fit_generator'''
    n = len(annotation_lines)
    i = 0
    while True:
        image_data = []
        box_data = []
        for b in range(batch_size):
            if i==0 and random:
                np.random.shuffle(annotation_lines)
            image, box = get_random_data(annotation_lines[i], input_shape, random=random)
            image_data.append(image)
            box_data.append(box)
            i = (i+1) % n
        image_data = np.array(image_data)
        if verbose:
            print("Progress: ",i,"/",n)
        box_data = np.array(box_data)
        y_true = preprocess_true_boxes(box_data, input_shape, anchors, num_classes)
        yield [image_data, *y_true], np.zeros(batch_size) 
开发者ID:bing0037,项目名称:keras-yolo3,代码行数:22,代码来源:train_bottleneck.py

示例2: bottleneck_generator

# 需要导入模块: from yolo3 import model [as 别名]
# 或者: from yolo3.model import preprocess_true_boxes [as 别名]
def bottleneck_generator(annotation_lines, batch_size, input_shape, anchors, num_classes, bottlenecks):
    n = len(annotation_lines)
    i = 0
    while True:
        box_data = []
        b0=np.zeros((batch_size,bottlenecks[0].shape[1],bottlenecks[0].shape[2],bottlenecks[0].shape[3]))
        b1=np.zeros((batch_size,bottlenecks[1].shape[1],bottlenecks[1].shape[2],bottlenecks[1].shape[3]))
        b2=np.zeros((batch_size,bottlenecks[2].shape[1],bottlenecks[2].shape[2],bottlenecks[2].shape[3]))
        for b in range(batch_size):
            _, box = get_random_data(annotation_lines[i], input_shape, random=False, proc_img=False)
            box_data.append(box)
            b0[b]=bottlenecks[0][i]
            b1[b]=bottlenecks[1][i]
            b2[b]=bottlenecks[2][i]
            i = (i+1) % n
        box_data = np.array(box_data)
        y_true = preprocess_true_boxes(box_data, input_shape, anchors, num_classes)
        yield [b0, b1, b2, *y_true], np.zeros(batch_size) 
开发者ID:bing0037,项目名称:keras-yolo3,代码行数:20,代码来源:train_bottleneck.py

示例3: data_generator

# 需要导入模块: from yolo3 import model [as 别名]
# 或者: from yolo3.model import preprocess_true_boxes [as 别名]
def data_generator(annotation_lines, batch_size, input_shape, anchors, num_classes):
    '''data generator for fit_generator'''
    n = len(annotation_lines)
    i = 0
    while True:
        image_data = []
        box_data = []
        for b in range(batch_size):
            if i==0:
                np.random.shuffle(annotation_lines)
            image, box = get_random_data(annotation_lines[i], input_shape, random=True)
            image_data.append(image)
            box_data.append(box)
            i = (i+1) % n
        image_data = np.array(image_data)   # input of original yolo: image
        box_data = np.array(box_data)       # output of original yolo: boxes
        y_true = preprocess_true_boxes(box_data, input_shape, anchors, num_classes) # some kind of output description?!
        yield [image_data, *y_true], np.zeros(batch_size) 
开发者ID:bing0037,项目名称:keras-yolo3,代码行数:20,代码来源:train.py

示例4: _main

# 需要导入模块: from yolo3 import model [as 别名]
# 或者: from yolo3.model import preprocess_true_boxes [as 别名]
def _main():
    annotation_path = 'train.txt'
    data_path = 'train.npz'
    output_path = 'model_data/my_yolo.h5'
    log_dir = 'logs/000/'
    classes_path = 'model_data/voc_classes.txt'
    anchors_path = 'model_data/yolo_anchors.txt'
    class_names = get_classes(classes_path)
    anchors = get_anchors(anchors_path)

    input_shape = (416,416) # multiple of 32
    image_data, box_data = get_training_data(annotation_path, data_path,
        input_shape, max_boxes=100, load_previous=True)
    y_true = preprocess_true_boxes(box_data, input_shape, anchors, len(class_names))

    infer_model, model = create_model(input_shape, anchors, len(class_names),
        load_pretrained=True, freeze_body=True)

    train(model, image_data/255., y_true, log_dir=log_dir)

    infer_model.save(output_path) 
开发者ID:scutan90,项目名称:YOLO-3D-Box,代码行数:23,代码来源:train.py

示例5: data_generator

# 需要导入模块: from yolo3 import model [as 别名]
# 或者: from yolo3.model import preprocess_true_boxes [as 别名]
def data_generator(annotation_lines, batch_size, input_shape, anchors, num_classes):
    n = len(annotation_lines)
    np.random.shuffle(annotation_lines)
    i = 0
    while True:
        image_data = []
        box_data = []
        for b in range(batch_size):
            i %= n
            image, box = get_random_data(annotation_lines[i], input_shape, random=True)
            image_data.append(image)
            box_data.append(box)
            i += 1
        image_data = np.array(image_data)
        box_data = np.array(box_data)
        y_true = preprocess_true_boxes(box_data, input_shape, anchors, num_classes)
        yield [image_data, *y_true], np.zeros(batch_size) 
开发者ID:lijialinneu,项目名称:keras-yolo3-master,代码行数:19,代码来源:train.py

示例6: data_generator

# 需要导入模块: from yolo3 import model [as 别名]
# 或者: from yolo3.model import preprocess_true_boxes [as 别名]
def data_generator(annotation_lines, batch_size, input_shape, anchors, num_classes):
    '''data generator for fit_generator'''
    n = len(annotation_lines)
    i = 0
    while True:
        image_data = []
        box_data = []
        for b in range(batch_size):
            if i==0:
                np.random.shuffle(annotation_lines)
            image, box = get_random_data(annotation_lines[i], input_shape, random=True)
            image_data.append(image)
            box_data.append(box)
            i = (i+1) % n
        image_data = np.array(image_data)
        box_data = np.array(box_data)
        y_true = preprocess_true_boxes(box_data, input_shape, anchors, num_classes)
        yield [image_data, *y_true], np.zeros(batch_size) 
开发者ID:Akhtar303,项目名称:Vehicle-Detection-and-Tracking-Usig-YOLO-and-Deep-Sort-with-Keras-and-Tensorflow,代码行数:20,代码来源:train.py


注:本文中的yolo3.model.preprocess_true_boxes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。