Hi ! I just load the pretrained vqgan, and reconstruct the input as below, but the backgound is noisy and the forground is blur. Is thre any thing wrong in my code?
`
images, labels = batch["image"], batch["label"]
batch_size = images.shape[0]
times = [4, 9, 14, 19]
outputs = []
# 移除批量和通道维度,得到 (96, 96, 96)
ct_image_np = images.squeeze().cpu().numpy().astype(np.float32)
# 创建一个 NIfTI 图像对象
nii_image = nib.Nifti1Image(ct_image_np, affine=np.eye(4))
nib.save(nii_image, path)
img_ = self.vqgan.encode(images, quantize=False, include_embeddings=True)
_sample = self.vqgan.decode(img_, quantize=True)
ct_pre = _sample.squeeze().cpu().numpy().astype(np.float32)
# 创建一个 NIfTI 图像对象
nii_image = nib.Nifti1Image(ct_pre, affine=np.eye(4))
# 保存为 .nii.gz 文件
nib.save(nii_image, path2)
`

Hi ! I just load the pretrained vqgan, and reconstruct the input as below, but the backgound is noisy and the forground is blur. Is thre any thing wrong in my code?
`
images, labels = batch["image"], batch["label"]
batch_size = images.shape[0]
times = [4, 9, 14, 19]
outputs = []
# 移除批量和通道维度,得到 (96, 96, 96)
ct_image_np = images.squeeze().cpu().numpy().astype(np.float32)
`
