This release includes the pretrained model weights for the Back-in-Time Diffusion (BTD) project, designed for unsupervised detection of medical deepfakes in MRI and CT scans.
Contents:
MRI_model.pt: Pretrained weights for the MRI model.CT_model.pt: Pretrained weights for the CT model.
Usage:
To use these weights in your own project or in a Colab environment, download the MRI_model.pt and CT_model.pt files and load them using the following code snippet:
import torch
from denoising_diffusion_pytorch import Unet, GaussianDiffusion
# Paths to the downloaded weights
CT_weights = "path_to_CT_model.pt"
MRI_weights = "path_to_MRI_model.pt"
# Initialize the UNet model
unet = Unet(
dim = 32,
dim_mults = (1, 2, 4, 8),
channels = 1
)
# Load the CT model
CT_model = GaussianDiffusion(
unet,
objective = "pred_noise",
image_size = 96,
timesteps = 1000,
sampling_timesteps = 250
).to(device)
CT_model.load_state_dict(torch.load(CT_weights)['model'])
CT_model.eval()
# Load the MRI model
MRI_model = GaussianDiffusion(
unet,
objective = "pred_noise",
image_size = 128,
timesteps = 1000,
sampling_timesteps = 250
).to(device)
MRI_model.load_state_dict(torch.load(MRI_weights)['model'])
MRI_model.eval()