示例#1
0
                    dest='image_path',
                    type=str,
                    required=True,
                    help='本地图像路径')
    ag.add_argument('-u',
                    '--triton_url',
                    dest='triton_url',
                    type=str,
                    required=True,
                    help='triton url')
    ag.add_argument('-p',
                    '--triton_port',
                    dest='triton_port',
                    type=int,
                    default=8001,
                    help='triton grpc 端口')
    args = ag.parse_args()
    img = cv2.imread(args.image_path)
    qrcode_detect_handler = QRCodeDetectWithSSD(
        {
            'name': 'triton',
            'triton_url': args.triton_url,
            'triton_port': args.triton_port
        }, True, 384, 0.2, 0.45)
    detected_code_result = qrcode_detect_handler.execute(img)
    to_draw_image = img.copy()
    for m_location in detected_code_result['locations']:
        draw_rotated_bbox(to_draw_image, m_location, (0, 255, 0), 3)
    cv2.imshow('to_draw_image', to_draw_image)
    cv2.waitKey(0)
示例#2
0
    args = ag.parse_args()
    img = cv2.imread(args.image_path)
    db_mbv3 = TritonInferenceHelper('DB_mbv3', args.triton_url,
                                    args.triton_port, 'DB_mbv3', 1)
    db_mbv3.add_image_input(
        'INPUT__0', (-1, -1, 3), '识别用的图像',
        ([123.675, 116.28, 103.53], [58.395, 57.12, 57.375]))
    db_mbv3.add_output('OUTPUT__0', (1, -1, -1), 'detect score')
    db_res18 = TritonInferenceHelper('DB_res18', args.triton_url,
                                     args.triton_port, 'DB_res18', 1)
    db_res18.add_image_input(
        'INPUT__0', (-1, -1, 3), '识别用的图像',
        ([123.675, 116.28, 103.53], [58.395, 57.12, 57.375]))
    db_res18.add_output('OUTPUT__0', (1, -1, -1), 'detect score')
    db_mbv3_handler = GeneralDBDetect(db_mbv3, True, 0.3, 1.5, 5)
    db_res18_handler = GeneralDBDetect(db_res18, True, 0.3, 5, 5)
    db_mbv3_boxes = db_mbv3_handler.execute(img)['locations']
    db_res18_boxes = db_res18_handler.execute(img)['locations']
    db_mbv3_result_to_show = img.copy()
    for m_box in db_mbv3_boxes:
        draw_rotated_bbox(db_mbv3_result_to_show, m_box['box_info'],
                          (255, 0, 0), 2)
    cv2.imshow('db_mbv3_result_to_show', db_mbv3_result_to_show)
    db_res18_result_to_show = img.copy()
    for m_box in db_res18_boxes:
        draw_rotated_bbox(db_res18_result_to_show, m_box['box_info'],
                          (0, 0, 255), 2)
    cv2.imshow('db_res18_result_to_show', db_res18_result_to_show)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
示例#3
0
    ultra_light_face_detect_handler = GeneralUltraLightFaceDetect(
        {
            'name': 'triton',
            'triton_url': args.triton_url,
            'triton_port': args.triton_port
        }, True, 0.7, 0.5)
    retina_face_detect_handler = GeneralRetinaFaceDetect(
        {
            'name': 'triton',
            'triton_url': args.triton_url,
            'triton_port': args.triton_port
        }, True, 0.7, 0.5)
    ultra_light_face_detected_boxes = ultra_light_face_detect_handler.execute(
        img)['locations']

    ultra_light_face_result = img.copy()
    for m_box in ultra_light_face_detected_boxes:
        draw_rotated_bbox(ultra_light_face_result, m_box['box_info'],
                          (255, 0, 0), 2)
    cv2.imshow('ultra_light_face_result', ultra_light_face_result)

    retina_detected_face_boxes = retina_face_detect_handler.execute(
        img)['locations']
    retina_detected_face_result = img.copy()
    for m_box in retina_detected_face_boxes:
        draw_rotated_bbox(retina_detected_face_result, m_box['box_info'],
                          (0, 0, 255), 2)
    cv2.imshow('retina_detected_face_result', retina_detected_face_result)
    cv2.waitKey(0)
    cv2.destroyAllWindows()