def test_close_start(self): reader = TensorStreamConverter(self.path) reader.initialize() reader.stop() #won't work but at least no crush reader.start()
def test_stop_without_init(self): reader = TensorStreamConverter(self.path) reader.stop()
def test_start_close(self): reader = TensorStreamConverter(self.path) reader.initialize() reader.start() time.sleep(1.0) reader.stop()
print(f"Normalize {args.crop}") tensor = None try: while True: parameters = {'pixel_format': FourCC[args.fourcc], 'width': args.width, 'height': args.height, 'crop_coords' : args.crop, 'normalization': args.normalize, 'planes_pos': Planes[args.planes], 'resize_type': ResizeType[args.resize_type]} tensor, index = reader.read(**parameters, return_index=True) if args.number: if index > args.number: break if args.output: reader.dump(tensor, args.output, **parameters) except RuntimeError as e: print(f"Bad things happened: {e}") finally: print("Frame size: ", reader.frame_size) print("FPS: ", reader.fps) if tensor is not None: print("Tensor shape:", tensor.shape) print("Tensor dtype:", tensor.dtype) print("Tensor device:", tensor.device) reader.stop()