In [26]:
# define the expected input shape for the model
input_w, input_h = 416, 416
# define our new photo
photo_filename = 'crossroad.jpg'
# load and prepare image
image, image_w, image_h = load_image_pixels(photo_filename, (input_w, input_h))
# make prediction
yhat = model.predict(image,steps=2)
boxes = list()
for i in range(len(yhat)):
    # decode the output of the network
    boxes += decode_netout(yhat[i][0], anchors[i], class_threshold, input_h, input_w)
# correct the sizes of the bounding boxes for the shape of the image
correct_yolo_boxes(boxes, image_h, image_w, input_h, input_w)
# suppress non-maximal boxes
do_nms(boxes, 0.6)
# summarize what we found
# get the details of the detected objects
v_boxes, v_labels, v_scores = get_boxes(boxes, labels, class_threshold)
for i in range(len(v_boxes)):
    print(v_labels[i], v_scores[i])
# draw what we found
draw_boxes(photo_filename, v_boxes, v_labels, v_scores)
bus 87.15487122535706
train 76.38503909111023
car 84.04464721679688
car 86.41052842140198
car 86.0455870628357
car 76.35767459869385
person 95.71267366409302
person 98.09613823890686