Beispiel #1
0
 print('FRAME: {}'.format(frame_itt))
 pic_name = 'output/{:05d}.png'.format(frame_itt)
 img1 = img2
 img2 = cam.read()[1]
 tt_reading.append(time_tressing(t0, '\t\treading'))
 # for skiping video
 if frame_itt < 1360:
     print('\tpass')
     continue
 T_v = frame_itt / 25  # - 120
 Ta.append(T_v)
 sa.append(speed_g[frame_itt + delta_fr])
 angles_objects = []
 boxes_main = []
 time_start_itt = time.time()
 boxes_out = nn.get_features(img1)
 tt_nn.append(time_tressing(time_start_itt, '\t\tneural network'))
 t0 = time.time()
 if debug:
     out = img1.copy()
     for box in boxes_out:
         cl_name = box[0]
         pt1 = box[1]
         pt2 = box[2]
         if cl_name in vehicles_classes:
             out = draw.draw_bounding_box(out, cl_name, draw.red, pt1, pt2,
                                          3)
         else:
             out = draw.draw_bounding_box(out, cl_name, draw.blue, pt1, pt2,
                                          3)
 tt_draw_rec.append(time_tressing(t0, '\t\tbounding box drawing'))
Beispiel #2
0
import matplotlib.pyplot as plt
import draw
import neural_network as nn
import openpose_to_Json as op
#itt = 1
times = []
times_yolo = []
times_openpose = []
for itt in range(1, 15 + 1):
    print('start itt =', itt)
    T = time.time()
    image = cv2.imread('input/img/i/cars&humans/{}.jpg'.format(itt))
    frameWidth = image.shape[1]
    frameHeight = image.shape[0]
    t_y = time.time()
    output_yolo = nn.get_features(image)
    times_yolo.append(time.time() - t_y)
    t_op = time.time()
    output_opnps = op.getPose(image, True)
    pp, ll = op.getPose(image)
    times_openpose.append(time.time() - t_op)
    yolo_result = image.copy()
    for box in output_yolo:
        name = box[0]
        pt1 = box[1]
        pt2 = box[2]
        color = box[3]
        yolo_result = draw.draw_bounding_box(yolo_result, name, color, pt1,
                                             pt2)
    yolo_result = op.drawPose(yolo_result, pp, ll, 3, 1)
    cv2.imwrite('output/cars&humans/{}_yolo.png'.format(itt), yolo_result)