jcreinhold / synthtorch

deep neural network-based image translation/synthesis
Other
27 stars 7 forks source link

Guide to modify the package for customer dataset #14

Closed JingyaLiu closed 5 years ago

JingyaLiu commented 5 years ago

Hi, Thanks for the great work! I want to play with my customer data from the CT image to CT image. Could you briefly guide me for the dataset modification? The dataset has been saved as train, train_label, test, test label. In addition, what can I do if I want to modify the unet or any data augmentation or debugging? Thanks in advance!

jcreinhold commented 5 years ago

I believe the questions about formatting the dataset are answered in the 5 minute overview. If you want to modify the U-Net, then you should download the code and modify the code directly.

However, the U-Net class has many arguments that changes it, e.g., the number of channels in each layer, the number of downsamples, etc. These options are available in the command-line interface (CLI) options or as arguments to the U-Net class, if you are not using the CLI. Some data augmentation functions are already supported, especially in the CLI. See the docs for all of these options.

Please re-open if you run into a bug or error.

JingyaLiu commented 5 years ago

Thanks for the reply. One error occurred while I was using mean and std for data norm. The code in config.json: "mean": [68], "std": [55], The error is shown as

TypeError: Traceback (most recent call last):
  File "/home/tensor-server/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/home/tensor-server/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in <listcomp>
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/home/tensor-server/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/niftidataset/dataset.py", line 84, in __getitem__
    sample = self.transform(sample)
  File "/home/tensor-server/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 61, in __call__
    img = t(img)
  File "/home/tensor-server/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/niftidataset/transforms.py", line 465, in __call__
    if self.tfm_x: src = tv.transforms.functional.normalize(src, self.mean, self.std)
  File "/home/tensor-server/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 201, in normalize
    raise TypeError('tensor is not a torch image.')
TypeError: tensor is not a torch image.

Is there a way to modify the code?

jcreinhold commented 5 years ago

If you reinstall niftidataset and synthtorch, this issue should be fixed.