JianghaoWu / SIFA-pytorch

a pytorch version for SIFA, Unsupervised Bidirectional Cross-Modality Adaptation via Deeply Synergistic Image and Feature Alignment for Medical Image Segmentation
25 stars 1 forks source link

How to use this git? #1

Open quxianjiuguo opened 11 months ago

quxianjiuguo commented 11 months ago

I am interested in your prominent work. Could you teach me to use this git?

JianghaoWu commented 11 months ago

I have updated the readme file. Please refer to that file for dataset preparation instructions. If you have any other questions, feel free to ask

quxianjiuguo commented 11 months ago

I have updated the readme file. Please refer to that file for dataset preparation instructions. If you have any other questions, feel free to ask

I used tf_to_np.py to process the MM-WHS 2017 data. Why used tf.reshape(img,[256,256,3]) function? image

I used the propressed data in train.py , an error appeared. Could you help me? image

JianghaoWu commented 11 months ago

Your data dimensions are incorrect. For 2D image inputs to a deep learning network, the dimensions should be [batch_size, channel, w, h], but your input dimensions [8, 1, 256, 256, 3] are obviously incorrect. If it's grayscale images, the channel should be 1, and if it's color images, the channel should be 3. I'm not sure where your data comes from, but I don't recommend using tf_to_np.py. It's an outdated data storage method. If you're dealing with medical image data, simply preprocess it into [1, 256, 256] and save it in npz format. This way, your input will be [8, 1, 256, 256], which is correct.

quxianjiuguo commented 11 months ago

Your data dimensions are incorrect. For 2D image inputs to a deep learning network, the dimensions should be [batch_size, channel, w, h], but your input dimensions [8, 1, 256, 256, 3] are obviously incorrect. If it's grayscale images, the channel should be 1, and if it's color images, the channel should be 3. I'm not sure where your data comes from, but I don't recommend using tf_to_np.py. It's an outdated data storage method. If you're dealing with medical image data, simply preprocess it into [1, 256, 256] and save it in npz format. This way, your input will be [8, 1, 256, 256], which is correct.

could you tell me about your email or other chatways? Thank you

quxianjiuguo commented 11 months ago

I processed the mmwhs data to train, but I got an error . The numclass is included background? image

JianghaoWu commented 11 months ago

Yes, the class number includes the background. So you should set the number classes to 4.

quxianjiuguo commented 11 months ago

Yes, the class number includes the background. So you should set the number classes to 4.

what about the cuda , tensorflow ,torch version ?

JianghaoWu commented 11 months ago

CUDA 11.4 torch 1.8.1

quxianjiuguo commented 11 months ago

CUDA 11.4 torch 1.8.1 How many epochs of convergence did the model run?

quxianjiuguo commented 11 months ago

CUDA 11.4 torch 1.8.1

could you share the preprocessed MM-WHS 2017 data? Thank you

JianghaoWu commented 11 months ago

I am not the author of the SIFA, and I do not use this dataset, please ask the author for the dataset.

lkfiean commented 10 months ago

你好,可以提供一下图片和标签转化为npz格式的代码吗 谢谢、

llkk2019 commented 9 months ago

Dear blogger, hello! Nice to see the code you wrote! May I ask if this code basically reproduces the official open source code of SIFA's paper? For example, the details of the overall framework, the number of network layers, and some hyperparameters. Looking forward to the blogger's reply very much, thank you!

JianghaoWu commented 5 months ago

The provided code is nearly identical to what you need. You can utilize this code as a basis, and kindly acknowledge the implementation from this GitHub repository in your footnotes.

jingluo-lan commented 3 months ago

![Uploading 1717429019876.png…]() ![Uploading 1717429019876.png…]() ![Uploading 1717429019876.png…]() ![Uploading 1717429019876.png…]() 你好,这个报错是要怎么解决?

jingluo-lan commented 3 months ago

Traceback (most recent call last): File "/home/user/lanzheng/CycleGAN/SIFA-pytorch/train.py", line 93, in train() File "/home/user/lanzheng/CycleGAN/SIFA-pytorch/train.py", line 65, in train sifa_model.sample_image(epoch, exp_name) File "/home/user/lanzheng/CycleGAN/SIFA-pytorch/model.py", line 174, in sample_image save_image(denorm(self.realA), '{}/realA-epoch-{}.jpg'.format(sample_image_dir, epoch + 1)) File "/home/lanzheng/anaconda3/envs/pytorch/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1688, in getattr raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'") AttributeError: 'SIFA' object has no attribute 'realA'

JianghaoWu commented 3 months ago

I am not sure how you rewrite this code, in my train.py, there is no line 93, and line 65 is not sifa_model.sample_image(epoch, exp_name). self.realA is introduced in update_seg and update_GAN, making sure they were ran before sifa_model.sample_image. And I can't see your loaded image.