covid-chestxray-dataset icon indicating copy to clipboard operation
covid-chestxray-dataset copied to clipboard

Minimal jupyter notebook to train models

Open rcillavicomtech opened this issue 4 years ago • 12 comments

Hi, I'm a deep learning researcher from Spain. I have created a minimal jupyter notebook to train with the images from your repo.

https://drive.google.com/file/d/19T_qebLa1keUNpkp7FDNEBmsNRQUVtfJ/view?usp=sharing

I want to experiment with visual attention models on next days. Rodrigo

rcillavicomtech avatar Mar 15 '20 20:03 rcillavicomtech

Can you make that link public? Or maybe just upload the notebook to this issue page?

ieee8023 avatar Mar 15 '20 20:03 ieee8023

Now the link should work. I attach the notebook too.

COVID_19.ipynb.txt

rcillavicomtech avatar Mar 15 '20 20:03 rcillavicomtech

Cool! Looks good! I had just released the torchxrayvision code! I have been doing something similar but I wasn't able to get good prediction performance. Can you include an AUC calculation on the resulting model? Also, I would expect monitoring test performance here as you do would cause you to overfit. Maybe leave out a few cases that you only test the final model on.

ieee8023 avatar Mar 15 '20 21:03 ieee8023

Yes, good ideas to keep improving it. I'll do it when I have spare time during the week. Perhaps something like a VAE-GAN data augmentation approach could be useful to.

rcillavicomtech avatar Mar 15 '20 21:03 rcillavicomtech

Thanks for sharing, In dataset class we have 9 labels, what they stand for? And in your code we have 2 classes, could you explain it? Thanks!!!

jovenwayfarer avatar Mar 18 '20 21:03 jovenwayfarer

@jovenwayfarer Labels are binary. My code is to predict COVID19 status stored at column 2. Tomorrow I'll improve it with some ideas....

rcillavicomtech avatar Mar 18 '20 23:03 rcillavicomtech

@rcillavicomtech I tested your code 4 days ago, but due to CUDA usage in the snippet I had to run on colab, because I don't have access to any Nvidia GPU, so it took quiet some time to train the model... I am also trying to find more datasets, I look forward of your improved code

RazaGR avatar Mar 19 '20 11:03 RazaGR

model=xrv.models.DenseNet(num_classes=2).cuda() is it densenet121? it is pretrained? if yes, on what? Thnaks again for the notebook

jovenwayfarer avatar Mar 19 '20 19:03 jovenwayfarer

@ieee8023 Hi, could you help? If I load a model like below model=xrv.models.DenseNet(num_classes=2).cuda() is it densenet121? it is pretrained? if yes, on what?

jovenwayfarer avatar Mar 20 '20 03:03 jovenwayfarer

You can view the code here: https://github.com/mlmed/torchxrayvision/

If you specify weights you will get pretrained DenseNet 121 models based on the models trained for this paper: https://arxiv.org/abs/2002.02497

ieee8023 avatar Mar 20 '20 04:03 ieee8023

@rcillavicomtech not sure to understand your training, what does PA and lab stands for?

        inputs=data['PA'].cuda()
        labels=data['lab'].long().cuda()

dzlab avatar Mar 24 '20 18:03 dzlab

@rcillavicomtech Thank you for your great work! When I used the covid dataset the same way as yours, I encountered an assertion error:

Traceback (most recent call last): File "/Users/Documents/ProgramData/Pycharm/EfficientNet-PyTorch-master/COVID-Test.py", line 222, in train(model, train_dataloader, optimizer, criterion) File "/Users/Documents/ProgramData/Pycharm/EfficientNet-PyTorch-master/COVID-Test.py", line 53, in train for batch_idx, samples in enumerate(train_dataloader, 0): File "/Users/opt/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/Users/opt/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 475, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/Users/opt/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/Users/opt/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/Users/Documents/ProgramData/Pycharm/EfficientNet-PyTorch-master/dataset.py", line 304, in getitem return self.dataset[self.idxs[idx]] File "/Users/Documents/ProgramData/Pycharm/EfficientNet-PyTorch-master/dataset.py", line 247, in getitem sample["img"] = self.transform(sample["img"]) File "/Users/opt/anaconda3/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 61, in call img = t(img) File "/Users/opt/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/Users/Documents/ProgramData/Pycharm/EfficientNet-PyTorch-master/utilsForCovid.py", line 35, in forward assert isinstance(x, torch.Tensor) AssertionError

Can anyone help with this problem? Thank you in advance!

Qing21 avatar Feb 16 '21 18:02 Qing21