def test_video(self): asset_path = self.asset_path + ".gif" event = video(asset_path=asset_path, tensor=tensor_np(shape=(4, 3, 1, 8, 8))) assert event.path == asset_path assert os.path.exists(asset_path) is True event = video( asset_path=asset_path, tensor=tensor_np(shape=(16, 48, 1, 28, 28)) ) assert event.path == asset_path assert os.path.exists(asset_path) is True event = video(asset_path=asset_path, tensor=tensor_np(shape=(20, 7, 1, 8, 8))) assert event.path == asset_path assert os.path.exists(asset_path) is True
def test_float32_image(self): """Tests that float32 image (pixel values in [0, 1]) are scaled correctly to [0, 255]""" assert os.path.exists(self.asset_path) is False event = image(asset_path=self.asset_path, data=tensor_np(shape=(3, 32, 32))) assert event.path == self.asset_path assert os.path.exists(self.asset_path) is True
def test_image_with_one_channel(self): event = image( asset_path=self.asset_path, data=tensor_np(shape=(1, 8, 8)), dataformats="CHW", ) assert event.path == self.asset_path assert os.path.exists(self.asset_path) is True
def test_image_with_boxes(self): event = image_boxes( asset_path=self.asset_path, tensor_image=tensor_np(shape=(3, 32, 32)), tensor_boxes=np.array([[10, 10, 40, 40]]), ) assert event.path == self.asset_path assert os.path.exists(self.asset_path) is True
def test_image_with_four_channel_batched(self): event = image( asset_path=self.asset_path, data=tensor_np(shape=(2, 4, 8, 8)), dataformats="NCHW", ) assert event.path == self.asset_path assert os.path.exists(self.asset_path) is True
def test_uint8_image(self): """Tests that uint8 image (pixel values in [0, 255]) is not changed""" assert os.path.exists(self.asset_path) is False event = image( asset_path=self.asset_path, data=tensor_np(shape=(3, 32, 32), dtype=np.uint8), ) assert event.path == self.asset_path assert os.path.exists(self.asset_path) is True
def test_histogram_doane(self): event = histogram(tensor_np(shape=(1024, )), bins="doane", max_bins=5) assert event.values is not None assert event.counts is not None
def test_histogram_auto(self): event = histogram(values=tensor_np(shape=(1024, )), bins="auto", max_bins=5) assert event.values is not None assert event.counts is not None
def test_audio(self): event = audio(asset_path=self.asset_path, tensor=tensor_np(shape=(42, ))) assert event.path == self.asset_path assert os.path.exists(self.asset_path) is True