sara-nl / 3D-VQ-VAE-2

3D VQ-VAE-2 for high-resolution CT scan synthesis
https://scripties.uba.uva.nl/search?id=722710
42 stars 8 forks source link

Steps for Training VQ-VAE? #2

Open aksg87 opened 2 years ago

aksg87 commented 2 years ago

Hello,

I wanted to confirm the steps for training a VQ-VAE on radiology data. Thank you for working on such an interesting and important application of VQ-VAE. Our research group is particularly interested in applications to oncologic imaging.

1. Sample data

2. Training

aksg87 commented 2 years ago

Just an update!

I was able to get the train.py script running which is cool 🙂. Will share a few details in case anyone finds them helpful.

  1. I created a folder with a bunch of .nrrd volume files which is the only input I am using right now for train.py

  2. The code initially threw in an error as it expected a list for num_embeddings but the default is an int so I did the following. vqvae/model.py

        # assert len(args.num_embeddings) in (1, args.n_bottleneck_blocks)  # expects list     
        self.num_embeddings = [args.num_embeddings for _ in range(args.n_bottleneck_blocks)]
    
        # if len(args.num_embeddings) == 1:
        #     self.num_embeddings = [args.num_embeddings[0] for _ in range(args.n_bottleneck_blocks)]
        # else:
        #     self.num_embeddings = args.num_embeddings
  3. I added a batch-size default of 1 as I otherwise received an error: vqvae/train.py

    parser.add_argument("--batch-size", type=int, default=1)
27yw commented 1 year ago

thanks for your answer! It helps a lot. I am trying to training it as well and could you help me with my dataset_path, pls? I wanna train the data named like this :BraTS2021_00377_t1.nii.gz. Does it mean that I put all the files in one dir and what do I need to change the code and where?