本文整理匯總了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)
示例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)
示例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)
示例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)
示例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)
示例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