Skip to content

about the pretrained vqgan #18

@Ideal-Bushgorman

Description

@Ideal-Bushgorman

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)

`
B0R LJJK%RRT(IPQ18RP_L

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions