示例#1
0
def loop():
    n = 0
    while True:
        yield n
        n += 1


if __name__ == "__main__":
    webcam = args.webcam
    mode = args.mode
    if not os.path.exists(args.outputpath):
        os.mkdir(args.outputpath)

    # Load input video
    fvs = WebcamLoader(webcam).start()
    (fourcc, fps, frameSize) = fvs.videoinfo()
    # Data writer
    save_path = os.path.join(args.outputpath,
                             'AlphaPose_webcam' + webcam + '.avi')
    writer = DataWriter(args.save_video, save_path,
                        cv2.VideoWriter_fourcc(*'XVID'), fps,
                        frameSize).start()

    # Load YOLO model
    print('Loading YOLO model..')
    sys.stdout.flush()
    det_model = Darknet("yolo/cfg/yolov3.cfg")
    det_model.load_weights('models/yolo/yolov3.weights')
    det_model.net_info['height'] = args.inp_dim
    det_inp_dim = int(det_model.net_info['height'])
    while True:
        yield n
        n += 1


if __name__ == '__main__':

    url_1 = "rtsp://*****:*****@192.168.200.253:554/Streaming/Channels/101"
    url_2 = "rtsp://*****:*****@192.168.200.253:554/Streaming/Channels/301"
    num_cam = 2
    webcam = args.webcam
    if not os.path.exists(args.outputpath):
        os.mkdir(args.outputpath)

    # Load input video
    fvs_0 = WebcamLoader(url_1).start()
    fvs_1 = WebcamLoader(url_2).start()

    (fourcc, fps, frameSize) = fvs_0.videoinfo()

    # read the camera parameter of this dataset
    # with open ( opt.camera_parameter_path,'rb' ) as f:
    #     camera_parameter = pickle.load (f)

    # Data writer
    save_path = os.path.join(args.outputpath,
                             'AlphaPose_webcam' + webcam + '.avi')
    writer = DataWriter(args.save_video, save_path,
                        cv2.VideoWriter_fourcc(*'XVID'), fps,
                        frameSize).start()
示例#3
0
    img, orig_img, dim = prep_frame(frame, inp_dim)
    im_dim_list = torch.FloatTensor([dim]).repeat(1, 2)
    return img, orig_img, dim, im_dim_list


if __name__ == '__main__':

    url_1 = "rtsp://*****:*****@192.168.200.253:554/Streaming/Channels/101"
    url_2 = "rtsp://*****:*****@192.168.200.253:554/Streaming/Channels/301"
    num_cam = 2
    webcam = args.webcam
    if not os.path.exists(args.outputpath):
        os.mkdir(args.outputpath)

    # Load input video
    fvs_0 = WebcamLoader(url_1).start()
    fvs_1 = WebcamLoader(url_2).start()

    # detection module
    print('Loading detection model ')
    sys.stdout.flush()
    det_model = inference.yolo_detecter()

    # pose module
    print('Loading pose model')
    sys.stdout.flush()
    pose_model = inference.pose_detection()

    print('Starting webcam demo, press Ctrl + C to terminate...')
    sys.stdout.flush()
    im_names_desc = loop()  # tqdm(loop())
示例#4
0
    def isfull(self):
        return self.Q.full()


if __name__ == '__main__':

    url_1 = "rtsp://*****:*****@192.168.200.253:554/Streaming/Channels/101"
    # url_1 = 0
    url_2 = "rtsp://*****:*****@192.168.200.253:554/Streaming/Channels/301"
    # url_2 = 0
    webcam = args.webcam
    if not os.path.exists(args.outputpath):
        os.mkdir(args.outputpath)

    # Load input video
    fvs_0 = WebcamLoader(url_1).start()
    fvs_1 = WebcamLoader(url_2).start()

    (fourcc, fps1, frameSize1) = fvs_0.videoinfo()
    (fourcc, fps2, frameSize2) = fvs_1.videoinfo()
    # read the camera parameter of this dataset
    # with open ( opt.camera_parameter_path,'rb' ) as f:
    #     camera_parameter = pickle.load (f)

    # detection module
    print('Loading detection model ')
    sys.stdout.flush()
    det_loader_1 = DetectionLoader(fvs_0, batchSize=1).start()
    det_loader_2 = DetectionLoader(fvs_1, batchSize=1).start()

    save_path = os.path.join(args.outputpath,