action='store_true')

    return parser.parse_args()


if __name__ == '__main__':
    args = parse_arguments()

    reader = TensorStreamConverter(
        args.input,
        max_consumers=5,
        cuda_device=args.cuda_device,
        buffer_size=args.buffer_size,
        framerate_mode=FrameRate[args.framerate_mode])
    #To log initialize stage, logs should be defined before initialize call
    reader.enable_logs(LogsLevel[args.verbose],
                       LogsType[args.verbose_destination])

    if args.nvtx:
        reader.enable_nvtx()

    reader.initialize(repeat_number=20)

    if args.skip_analyze:
        reader.skip_analyze()

    reader.start()

    if args.output:
        if os.path.exists(args.output + ".yuv"):
            os.remove(args.output + ".yuv")
 def test_logs_enabling(self):
     reader = TensorStreamConverter(self.path)
     reader.enable_logs(LogsLevel.LOW, LogsType.CONSOLE)
     reader.enable_nvtx()
Exemple #3
0
                        default="LOW",
                        choices=["LOW", "MEDIUM", "HIGH"],
                        help="Set output level from library (default: LOW)")
    parser.add_argument("-n",
                        "--number",
                        help="Number of frame to parse (default: unlimited)",
                        type=int,
                        default=0)
    return parser.parse_args()


if __name__ == '__main__':
    args = parse_arguments()

    reader = TensorStreamConverter(args.input, repeat_number=20)
    reader.enable_logs(LogsLevel[args.verbose], LogsType.CONSOLE)
    reader.initialize()

    reader.start()

    if args.output:
        if os.path.exists(args.output):
            os.remove(args.output)

    tensor = None
    try:
        while True:
            tensor, index = reader.read(pixel_format=FourCC[args.fourcc],
                                        return_index=True,
                                        width=args.width,
                                        height=args.height)
Exemple #4
0
        if index % int(reader.fps) == 0:
            print("consumer2 frame index", index)

    reader.stop()
    time.sleep(1.0)  # prevent simultaneous print
    print("consumer2 shape:", tensor.shape)
    print("consumer2 dtype:", tensor.dtype)
    print("consumer2 last frame index:", index)


if __name__ == "__main__":
    args = parse_arguments()

    reader1 = TensorStreamConverter(args.input1, cuda_device=args.cuda_device1)
    reader1.enable_logs(LogsLevel[args.verbose1], LogsType.CONSOLE)
    reader1.initialize(repeat_number=20)

    reader2 = TensorStreamConverter(args.input2, cuda_device=args.cuda_device2)
    reader2.enable_logs(LogsLevel[args.verbose2], LogsType.CONSOLE)
    reader2.initialize(repeat_number=20)

    reader1.start()
    reader2.start()

    thread1 = Thread(target=consumer1, args=(reader1, args.number1))
    thread2 = Thread(target=consumer2, args=(reader2, args.number2))

    thread1.start()
    thread2.start()